/* ================================================================
   COOKIE CONSENT — modernized UI (Studio v2)
   Same markup + element IDs/classes as before, so cookie-consent.js
   and every page embedding the banner keep working unchanged.
   Visual language matches the site's current brand direction:
   floating glass card, lime → cyan → violet gradient accents,
   pill buttons, soft elevated shadows.

   NOTE: the previous stylesheet gated dark mode on `body.dark-theme`,
   which the site never actually sets (the real convention is
   `[data-theme="dark"]` on <html>, see styles.css). That meant dark
   mode never applied to this popup. Fixed here.
   ================================================================ */

:root {
    --cc-gradient: linear-gradient(135deg, #a3e635, #22d3ee 55%, #7c5cff);
    --cc-gradient-ink: #0a0d1a;
}

/* ---------------- Consent banner ---------------- */
.cookie-consent-container {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: 20px;
    max-width: 980px;
    margin: 0 auto;
    z-index: 9999;
    display: none; /* JS toggles this */
    padding: 22px 26px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 30px 70px -30px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(15, 23, 42, 0.02);
    opacity: 0;
    transform: translateY(24px) scale(0.98);
    transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.35s ease;
    overflow: hidden; /* clips the accent line below to the card's own rounded corners */
}

[data-theme="dark"] .cookie-consent-container {
    background: rgba(17, 24, 39, 0.82);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.cookie-consent-container.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* subtle top accent line, brand gradient — spans full width and relies on
   the container's own overflow:hidden to clip cleanly into its rounded
   corners, instead of floating as a separate inset bar. */
.cookie-consent-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--cc-gradient);
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

.cookie-text { flex: 1; min-width: 0; }

.cookie-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* icon badge, matches the res-card__icon treatment used elsewhere on the site */
.cookie-title i {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--cc-gradient);
    color: var(--cc-gradient-ink);
    font-size: 0.92rem;
    -webkit-text-fill-color: initial;
}

.cookie-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 0;
}

.cookie-description a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(139, 92, 246, 0.35);
    transition: border-color 0.2s ease, color 0.2s ease;
}

.cookie-description a:hover {
    color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.cookie-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.cookie-btn {
    padding: 11px 20px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 7px;
    border: none;
    white-space: nowrap;
}

.cookie-btn i { font-size: 0.82rem; }

.cookie-btn-accept {
    background: var(--cc-gradient);
    color: var(--cc-gradient-ink);
    box-shadow: 0 10px 24px -10px rgba(124, 92, 255, 0.55);
}

.cookie-btn-accept:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -10px rgba(124, 92, 255, 0.65);
}

.cookie-btn-settings {
    background: rgba(139, 92, 246, 0.08);
    color: var(--primary);
}

.cookie-btn-settings:hover {
    background: rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
}

.cookie-btn-deny {
    background: transparent;
    color: var(--text-secondary);
}

.cookie-btn-deny:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

[data-theme="dark"] .cookie-btn-settings { background: rgba(167, 139, 250, 0.14); }
[data-theme="dark"] .cookie-btn-settings:hover { background: rgba(167, 139, 250, 0.22); }

/* ---------------- Settings modal ---------------- */
.cookie-settings-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(9, 13, 26, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: cookieFadeIn 0.25s ease;
}

@keyframes cookieFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cookie-settings-content {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 32px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    box-shadow: 0 40px 90px -30px rgba(15, 23, 42, 0.45);
    position: relative;
    animation: cookiePopIn 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes cookiePopIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.cookie-settings-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-secondary);
    font-size: 1.05rem;
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.cookie-settings-close:hover {
    background: rgba(139, 92, 246, 0.14);
    color: var(--primary);
    transform: rotate(90deg);
}

.cookie-settings-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cookie-settings-title i {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--cc-gradient);
    color: var(--cc-gradient-ink);
    font-size: 1rem;
    -webkit-text-fill-color: initial;
}

.cookie-toggle-group { margin-bottom: 22px; }

.cookie-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 14px;
    margin-bottom: 10px;
    border: 1px solid transparent;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.cookie-toggle-item:hover {
    border-color: rgba(139, 92, 246, 0.25);
    transform: translateY(-1px);
}

.cookie-toggle-info h4 {
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cookie-toggle-info h4 i { color: var(--primary); font-size: 0.85rem; }

.cookie-toggle-info p {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
    margin: 0;
}

/* Toggle switch — smoother, brand-gradient when active */
.cookie-toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.cookie-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    transition: background 0.25s ease;
    border-radius: 999px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.cookie-toggle-slider:before {
    position: absolute;
    content: '';
    height: 20px;
    width: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

input:checked + .cookie-toggle-slider {
    background: var(--cc-gradient);
}

input:checked + .cookie-toggle-slider:before {
    transform: translateX(20px);
}

.cookie-toggle-item.required .cookie-toggle-switch { opacity: 0.55; cursor: not-allowed; }
.cookie-toggle-item.required input { pointer-events: none; }

.cookie-settings-description {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 22px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 14px;
    border-left: 3px solid transparent;
    border-image: var(--cc-gradient) 1;
}

.cookie-settings-description p:first-child { margin-bottom: 6px; }
.cookie-settings-description p { color: var(--text-secondary); }

.cookie-settings-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 26px;
}

.cookie-settings-btn {
    padding: 11px 22px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), background 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.cookie-settings-save {
    background: var(--cc-gradient);
    color: var(--cc-gradient-ink);
    box-shadow: 0 10px 24px -10px rgba(124, 92, 255, 0.55);
    display: flex;
    align-items: center;
    gap: 7px;
}

.cookie-settings-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -10px rgba(124, 92, 255, 0.65);
}

.cookie-settings-cancel {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.cookie-settings-cancel:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--primary);
}

/* ---------------- Responsive ---------------- */
@media (max-width: 768px) {
    .cookie-consent-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
        padding: 20px;
        border-radius: 20px;
    }

    .cookie-content {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
    }

    .cookie-buttons {
        flex-direction: column;
        width: 100%;
    }

    .cookie-btn {
        width: 100%;
        justify-content: center;
    }

    .cookie-settings-content {
        padding: 22px;
        border-radius: 20px;
    }

    .cookie-settings-buttons {
        flex-direction: column;
    }

    .cookie-settings-btn {
        width: 100%;
        justify-content: center;
    }
}
