/* Optimized Variables */
:root {
    --primary: #AD4754;
    --secondary: #E5865D;
    --background: #FFEEDA;
    --text: #606161;
    --text-light: #757575;
    --text-muted: #9a9a9a;
    --radius: 30px;
    --radius-sm: 12px;
    --shadow: 0 8px 32px rgba(173, 71, 84, 0.15);
    --shadow-hover: 0 12px 40px rgba(173, 71, 84, 0.25);
    --gradient: linear-gradient(90deg, #FBAD42 2.22%, #FAAF6A 12.39%, #E5865D 43.9%, #D4726F 79.48%, #AD4754 100.83%);
    --bg-overlay: rgba(173, 125, 71, 0.3);
    --bg-card: rgba(255, 238, 218, 0.9);
    --border: rgba(173, 71, 84, 0.2);
    --transition: all 0.2s ease;
}

/* Optimized Keyframes */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Optimized Container */
.cookie-popup-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9999999;
    padding: 0;
    animation: fadeIn 0.3s ease-out;
    height: 100vh;
}

/* Optimized Modal */
.cookie-popup {
    background: var(--background);
    color: var(--text);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow);
    max-width: 800px;
    width: 100%;
    position: relative;
    border: none;
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.cookie-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient);
    z-index: 1;
}

.cookie-popup:hover {
    box-shadow: var(--shadow-hover);
}

/* Optimized Panel */
.cookie-panel {
    padding: 32px 40px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.cookie-panel ul {
    list-style: none;
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 0;
}

.cookie-panel .consent-panel {
    display: none;
}

.cookie-panel .details-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 32px;
    border-radius: var(--radius);
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
    cursor: pointer;
    transition: var(--transition);
}



/* Optimized Heading */
.cookie-main-heading {
    color: var(--secondary);
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary);
    position: relative;
}

.cookie-main-heading::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

.details-panel .subtitle {
    display: none;
}

/* Optimized Content */
.cookie-content {
    padding: 0 40px;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
}

.cookie-cookies-display {
    padding: 24px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

/* Optimized Scrollbar */
.cookie-cookies-display::-webkit-scrollbar {
    width: 8px;
    background: transparent;
    border-radius: 8px;
}

.cookie-cookies-display::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 8px;
}

.cookie-cookies-display > p {
    margin-bottom: 24px;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.6;
    color: var(--text-light);
    background: rgba(173, 71, 84, 0.1);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.cookie-category {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    margin-bottom: 16px;
    padding: 20px 24px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(173, 71, 84, 0.05);
    transition: var(--transition);
    color: var(--text-light);
    position: relative;
    overflow: hidden;
}

.cookie-category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.cookie-category:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(173, 71, 84, 0.1);
    border-color: rgba(173, 71, 84, 0.4);
}

.cookie-category:hover::before {
    opacity: 1;
}

.cat-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.cat-main > div {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cookie-cat-name {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cat-describe {
    margin-top: 8px;
    padding-left: 4px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-muted);
}

/* Toggle Switch Style */
.choose {
    width: 52px;
    height: 28px;
    border-radius: 30px;
    border: 2px solid var(--primary);
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(173, 71, 84, 0.2);
    transition: var(--transition);
}

.choose::after {
    content: "";
    position: absolute;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.choose:hover:not(.always-on) {
    border-color: var(--secondary);
    box-shadow: 0 4px 12px rgba(173, 71, 84, 0.3);
    transform: scale(1.05);
}

.choose.active,
.choose.always-on {
    border-color: var(--secondary);
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(173, 71, 84, 0.3);
}

.choose.active::after,
.choose.always-on::after {
    left: calc(100% - 23px);
    background: white;
}

.choose.always-on {
    cursor: not-allowed;
    opacity: 0.9;
}

/* Optimized Button Area */
.cookie-decide {
    padding: 32px 40px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    justify-content: center;
}

.pre-cookie-box {
    display: none;
    color: var(--text-light);
    line-height: 1.5;
}

.pre-cookie-box h4 {
    color: var(--secondary);
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: 600;
}

.pre-cookie-box p {
    margin-bottom: 8px;
}

.pre-cookie-box p:last-child {
    margin-bottom: 0;
}

.pre-cookie-box a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid var(--primary);
    transition: var(--transition);
}

.pre-cookie-box a:hover {
    color: var(--secondary);
    border-color: var(--secondary);
}

.cookie-decide ul {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.allow-selection {
    display: none;
}

/* Optimized Responsive */
@media (max-width: 768px) {
    .cookie-popup-container {
        padding: 0;
    }
    
    .cookie-popup {
        max-width: 100%;
        border-radius: 24px 24px 0 0;
    }
    
    .cookie-panel {
        padding: 24px 20px 0;
    }
    
    .details-panel {
        font-size: 18px;
        gap: 12px;
        padding: 12px 20px;
    }
    
    .cookie-content {
        padding: 0 20px;
    }
    
    .cookie-cookies-display {
        max-height: 320px;
        padding: 20px;
    }
    
    .cookie-cookies-display > p {
        margin-bottom: 20px;
        font-size: 15px;
        padding: 14px 16px;
    }
    
    .cookie-category {
        padding: 16px 18px;
    }
    
    .cookie-cat-name {
        font-size: 15px;
    }
    
    .cat-describe {
        font-size: 13px;
    }
    
    .choose {
        width: 48px;
        height: 26px;
    }
    
    .choose::after {
        width: 18px;
        height: 18px;
    }
    
    .choose.active::after,
    .choose.always-on::after {
        left: calc(100% - 21px);
    }
    
    .cookie-decide {
        gap: 16px;
        padding: 24px 20px;
    }
    
    .cookie-decide ul {
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .cookie-popup {
        border-radius: 18px 18px 0 0;
    }
    
    .cookie-panel {
        padding: 20px 16px 0;
    }
    
    .details-panel {
        font-size: 16px;
        gap: 10px;
        padding: 10px 16px;
    }
    
    .cookie-cookies-display {
        max-height: 280px;
        padding: 16px;
    }
    
    .cookie-category {
        padding: 14px 16px;
    }
    
    .cookie-decide {
        padding: 20px 16px;
    }
    
    .cookie-decide ul {
        flex-direction: column;
        gap: 12px;
    }
}