/* ==========================================================================
   PARLIXA COOKIE CONSENT
   Design: Glassmorphism banner / Light-card modal
   ========================================================================== */

:root {
    --cookie-bg:  #ffffff;
    --cookie-ink: #0f1113;
    --cookie-hair: rgba(15,17,19,.16);
    --cookie-hair-firm: rgba(15,17,19,.32);
    --cookie-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
    --cookie-modal-bg: #ffffff;
    --cookie-border: 1px solid rgba(15, 17, 19, 0.32);
    --cookie-text: #4a5057;
    --cookie-text-highlight: #ffffff;
    --cookie-accent: var(--pen, #16365c);
    --cookie-accent-dark: #0f2540;
    --cookie-shadow: 0 1px 2px rgba(15,17,19,.05), 0 18px 40px -18px rgba(15,17,19,.22);
}

/* --- BANNER CONTAINER --- */
.cookie-consent-banner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100% - 40px);
    background: var(--cookie-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: var(--cookie-border);
    border-radius: 2px;
    box-shadow: var(--cookie-shadow);
    z-index: 10000;
    transform: translateY(20px);
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s 0.35s;
    visibility: hidden;
}

.cookie-consent-banner.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-consent-banner.hide {
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
}

/* Gradient border shimmer */
.cookie-consent-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 2px;
    padding: 1px;
    background: linear-gradient(160deg, rgba(0,122,77,0.4), rgba(255,255,255,0.06) 60%, transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* --- CONTENT --- */
.cookie-banner-content {
    padding: 22px 24px 24px;
    position: relative;
    z-index: 2;
}

.cookie-banner-text {
    margin-bottom: 18px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.cookie-banner-text::before {
    /* Was a Font Awesome glyph, which rendered as a missing-character box
       once the icon font was dropped. A CSS rule needs no font and matches
       the hairline vocabulary used across the site. */
    content: '';
    width: 2px;
    align-self: stretch;
    background: var(--cookie-accent);
    flex-shrink: 0;
}

.cookie-banner-text p {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--cookie-text);
    margin: 0;
}

.cookie-banner-text a {
    color: #1e293b;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.cookie-banner-text a:hover {
    color: var(--cookie-accent);
}

/* --- ACTIONS --- */
.cookie-banner-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cookie-banner-actions .btn,
.modal-footer .btn {
    flex: 1;
    padding: 9px 16px;
    border-radius: 2px;
    font-family: var(--cookie-mono);
    font-size: 0.72rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s, transform 0.15s, box-shadow 0.2s, background 0.2s, color 0.2s, border-color 0.2s;
    text-align: center;
    border: none;
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
}

.cookie-banner-actions .btn.btn-primary,
.modal-footer .btn.btn-primary {
    background: linear-gradient(135deg, var(--cookie-accent) 0%, var(--cookie-accent-dark) 100%);
    color: #ffffff;
    box-shadow: none;
}

.cookie-banner-actions .btn.btn-primary:hover,
.modal-footer .btn.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: none;
}

.cookie-banner-actions .btn.btn-secondary,
.modal-footer .btn.btn-secondary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.cookie-banner-actions .btn.btn-secondary:hover,
.modal-footer .btn.btn-secondary:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

/* Info icon button */
.cookie-banner-actions .btn.btn-link {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 1px;
    background: transparent;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.cookie-banner-actions .btn.btn-link:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

/* --- TOAST NOTIFICATION --- */
.cookie-consent-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #fff;
    padding: 11px 22px;
    border-radius: 2px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-consent-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

.toast-content i {
    color: #10b981;
}

/* ==========================================================================
   PREFERENCES MODAL
   ========================================================================== */

.cookie-consent-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10005;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.cookie-consent-overlay.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.cookie-preferences-modal {
    width: 480px;
    max-width: 92%;
    background: #ffffff;
    border: 1px solid var(--cookie-hair-firm);
    border-radius: 2px;
    box-shadow: var(--cookie-shadow);
    padding: 24px;
    transform: scale(0.96) translateY(8px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    opacity: 0;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 16px;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.2s, background 0.2s;
    padding: 6px;
    border-radius: 2px;
    line-height: 1;
}

.btn-close:hover {
    color: #475569;
    background: #f1f5f9;
}

.modal-body {
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 4px;
}

.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-track { background: #f8fafc; border-radius: 2px; }
.modal-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.preference-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #f1f5f9;
}

.preference-item:last-child { border-bottom: none; }

.pref-info { padding-right: 16px; }

.pref-info h4 {
    margin: 0 0 3px 0;
    color: #1e293b;
    font-size: 0.9rem;
    font-weight: 600;
}

.pref-info p {
    margin: 0;
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.45;
}

.modal-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Modal footer buttons use light-theme variants */
.modal-footer .btn {
    flex: 0 0 auto;
}

.modal-footer .btn.btn-primary {
    background: linear-gradient(135deg, var(--cookie-accent) 0%, var(--cookie-accent-dark) 100%);
    color: #ffffff;
    box-shadow: none;
    border: none;
}

.modal-footer .btn.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: none;
}

.modal-footer .btn.btn-secondary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.modal-footer .btn.btn-secondary:hover {
    background: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
    transform: none;
    filter: none;
}

/* --- TOGGLE SWITCH (iOS style) --- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 25px;
    flex-shrink: 0;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    border-radius: 2px;
    transition: background-color 0.25s ease;
}

.slider:before {
    position: absolute;
    content: "";
    height: 19px;
    width: 19px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    border-radius: 1px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

input:checked + .slider {
    background-color: var(--cookie-accent);
}

input:checked + .slider:before {
    transform: translateX(21px);
}

input:disabled + .slider {
    cursor: not-allowed;
    opacity: 0.55;
}

input:checked:disabled + .slider {
    background-color: var(--cookie-accent);
    opacity: 0.65;
}

/* ==========================================================================
   RESPONSIVE MOBILE
   ========================================================================== */

@media (max-width: 480px) {
    .cookie-consent-banner {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        border-left: none;
        border-right: none;
        backdrop-filter: blur(28px);
        -webkit-backdrop-filter: blur(28px);
    }

    .cookie-banner-content {
        padding: 22px 20px 28px;
    }

    .cookie-banner-actions {
        flex-wrap: wrap;
    }

    .cookie-banner-actions .btn.btn-primary,
    .cookie-banner-actions .btn.btn-secondary {
        padding: 11px;
        font-size: 0.875rem;
    }

    /* Modal: bottom sheet on mobile */
    .cookie-preferences-modal {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 24px);
        transform: translateY(100%);
        opacity: 1;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .cookie-consent-overlay.show .cookie-preferences-modal {
        transform: translateY(0);
    }
}

/* Locked toggle (always-on essential cookies) */
.toggle-switch.locked {
    pointer-events: none;
}

.toggle-switch.locked .slider {
    background-color: var(--cookie-accent) !important;
    opacity: 0.75;
    cursor: not-allowed;
}

.toggle-switch.locked .slider:before {
    transform: translateX(21px) !important;
    background-color: #ffffff !important;
}

/* ==========================================================================
   ACCESSIBILITY & PRINT
   ========================================================================== */

@media print {
    .cookie-consent-banner,
    .cookie-consent-toast,
    .cookie-consent-overlay { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-consent-banner,
    .cookie-consent-toast,
    .cookie-preferences-modal,
    .cookie-consent-overlay,
    .slider { transition: none !important; }
}
