/* Cookie consent — compact bar with smooth enter/exit */
.cookie-consent {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px 14px 18px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.cookie-consent.cookie-consent-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cookie-consent.cookie-consent-hiding {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.cookie-consent-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(61, 30, 74, 0.18);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.cookie-consent.cookie-consent-visible .cookie-consent-backdrop {
    opacity: 1;
}

.cookie-consent-panel {
    position: relative;
    width: 100%;
    max-width: 520px;
    transform: translateY(24px) scale(0.97);
    opacity: 0;
    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.35s ease;
}

.cookie-consent.cookie-consent-visible .cookie-consent-panel {
    transform: translateY(0) scale(1);
    opacity: 1;
    transition-delay: 0.05s;
}

.cookie-consent.cookie-consent-hiding .cookie-consent-panel {
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transition-duration: 0.28s;
}

.cookie-consent-inner {
    background: #fff;
    border: 1px solid rgba(61, 30, 74, 0.1);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(61, 30, 74, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 12px 14px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 6px 10px;
    align-items: center;
}

[data-theme="dark"] .cookie-consent-inner {
    background: #2a1a33;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.cookie-consent-icon {
    grid-row: 1 / span 2;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(123, 63, 158, 0.15), rgba(250, 187, 14, 0.25));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7b3f9e;
    font-size: 0.85rem;
    flex-shrink: 0;
    animation: cookieIconPop 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

[data-theme="dark"] .cookie-consent-icon {
    color: #FABB0E;
}

@keyframes cookieIconPop {
    from {
        transform: scale(0.6);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.cookie-consent-text {
    min-width: 0;
}

.cookie-consent-title {
    font-size: 0.78rem;
    font-weight: 700;
    margin: 0 0 2px;
    letter-spacing: 0.02em;
    color: #3D1E4A !important;
    line-height: 1.3;
}

[data-theme="dark"] .cookie-consent-title {
    color: #FABB0E !important;
}

.cookie-consent-desc {
    margin: 0;
    font-size: 0.68rem;
    line-height: 1.45;
    color: #6b5a75 !important;
}

[data-theme="dark"] .cookie-consent-desc {
    color: #c9b0d4 !important;
}

.cookie-consent-desc a {
    color: #7b3f9e;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

[data-theme="dark"] .cookie-consent-desc a {
    color: #FABB0E;
}

.cookie-consent-actions {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}

.cookie-btn {
    border: none;
    border-radius: 999px;
    padding: 5px 11px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.cookie-btn:active {
    transform: scale(0.96);
}

.cookie-btn-primary {
    background: #FABB0E;
    color: #3D1E4A;
    box-shadow: 0 2px 8px rgba(250, 187, 14, 0.35);
}

.cookie-btn-primary:hover {
    background: #e5a90c;
    box-shadow: 0 3px 12px rgba(250, 187, 14, 0.45);
}

.cookie-btn-ghost {
    background: rgba(61, 30, 74, 0.06);
    color: #3D1E4A;
    border: 1px solid rgba(61, 30, 74, 0.12);
}

[data-theme="dark"] .cookie-btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    color: #e8d4f0;
    border-color: rgba(255, 255, 255, 0.12);
}

.cookie-btn-ghost:hover,
[data-theme="dark"] .cookie-btn-ghost:hover {
    border-color: #7b3f9e;
    color: #7b3f9e;
}

[data-theme="dark"] .cookie-btn-ghost:hover {
    color: #FABB0E;
    border-color: #FABB0E;
}

#cookie-settings[aria-expanded="true"] {
    background: rgba(123, 63, 158, 0.12);
    border-color: #7b3f9e;
    color: #7b3f9e;
}

/* Preferences panel — expand/collapse */
.cookie-preferences {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding: 0 14px;
    background: #faf8fc;
    border: 1px solid transparent;
    border-radius: 0 0 14px 14px;
    transition:
        max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.3s ease,
        margin-top 0.35s ease,
        padding 0.35s ease,
        border-color 0.3s ease;
}

.cookie-preferences.cookie-prefs-open {
    max-height: 200px;
    opacity: 1;
    margin-top: -6px;
    padding: 10px 14px 12px;
    border-color: rgba(61, 30, 74, 0.08);
    border-top: none;
    border-radius: 0 0 14px 14px;
}

[data-theme="dark"] .cookie-preferences {
    background: #1f1226;
}

[data-theme="dark"] .cookie-preferences.cookie-prefs-open {
    border-color: rgba(255, 255, 255, 0.06);
}

.cookie-consent-panel:has(.cookie-prefs-open) .cookie-consent-inner {
    border-radius: 14px 14px 0 0;
}

.cookie-pref-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.65rem;
    line-height: 1.35;
    color: #5c4a66 !important;
    cursor: pointer;
}

.cookie-pref-row:last-of-type {
    margin-bottom: 8px;
}

[data-theme="dark"] .cookie-pref-row {
    color: #d4b3e3 !important;
}

.cookie-pref-row input {
    width: 14px;
    height: 14px;
    accent-color: #7b3f9e;
    flex-shrink: 0;
}

.cookie-pref-row strong {
    font-weight: 600;
    color: #3D1E4A !important;
}

[data-theme="dark"] .cookie-pref-row strong {
    color: #FABB0E !important;
}

.cookie-btn-save {
    width: 100%;
    padding: 6px 12px;
}

.cookie-settings-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}

@media (min-width: 480px) {
    .cookie-consent {
        justify-content: flex-end;
        align-items: flex-end;
        padding: 16px 20px;
    }

    .cookie-consent-panel {
        max-width: 400px;
    }
}

@media (max-width: 380px) {
    .cookie-consent-inner {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .cookie-consent-icon {
        grid-row: auto;
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .cookie-consent-actions {
        grid-column: 1;
        justify-content: stretch;
    }

    .cookie-btn {
        flex: 1;
        text-align: center;
        padding: 6px 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-consent,
    .cookie-consent-panel,
    .cookie-consent-backdrop,
    .cookie-preferences,
    .cookie-consent-icon {
        transition: none !important;
        animation: none !important;
    }
}
