/*
 * ═══════════════════════════════════════════════════════════════════════════
 *  LUNARA — Cookie Consent System CSS
 *  GDPR / UK GDPR / CCPA Compliant
 *  Version: 1.0.0
 *  Prefix: cc- (cookie consent namespace — no collisions with lunara.css)
 *
 *  Z-Index:
 *    .cc-overlay : 9988
 *    .cc-modal   : 9989
 *    .cc-banner  : 9990
 *  (Banner sits highest so it's always visible on first visit)
 *
 *  Dark mode: @media (prefers-color-scheme: dark)
 *  Reduced motion: @media (prefers-reduced-motion: reduce)
 * ═══════════════════════════════════════════════════════════════════════════
 */


/* ──────────────────────────────────────────────────────
   COOKIE BANNER — fixed bottom strip
   Slides in from below on first visit.
────────────────────────────────────────────────────── */
.cc-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9990;
    background: rgba(253, 249, 244, 0.96);
    backdrop-filter: blur(28px) saturate(1.8);
    -webkit-backdrop-filter: blur(28px) saturate(1.8);
    border-top: 1px solid rgba(200, 191, 231, 0.22);
    box-shadow: 0 -8px 48px rgba(28, 22, 36, 0.10), 0 -1px 0 rgba(200, 191, 231, 0.15);
    padding: 22px 48px 26px;
    transform: translateY(110%);
    transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.cc-banner.cc-visible {
    transform: translateY(0);
}

.cc-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 36px;
}

/* ── Text block ── */
.cc-banner-text {
    flex: 1;
    min-width: 0;
}

.cc-banner-title {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-size: 17px;
    font-weight: 500;
    font-style: italic;
    color: #1c1624;
    margin: 0 0 5px;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.cc-banner-desc {
    font-size: 13px;
    color: #7b6e8f;
    line-height: 1.65;
    margin: 0;
}

.cc-banner-desc a {
    color: #8b7cba;
    text-decoration: underline;
    text-decoration-color: rgba(139, 124, 186, 0.38);
    text-underline-offset: 2px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.cc-banner-desc a:hover {
    color: #6b5ea0;
    text-decoration-color: rgba(107, 94, 160, 0.65);
}

/* ── Action buttons ── */
.cc-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────
   SHARED BUTTON BASE
────────────────────────────────────────────────────── */
.cc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 999px;
    padding: 11px 22px;
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
    text-align: center;
    -webkit-font-smoothing: antialiased;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, border-color 0.22s ease;
}

.cc-btn:focus-visible {
    outline: 2px solid #8b7cba;
    outline-offset: 3px;
    border-radius: 999px;
}

/* Accept All — primary gradient */
.cc-btn-accept {
    background: linear-gradient(135deg, #8b7cba 0%, #c98472 100%);
    color: #fff;
    box-shadow: 0 4px 20px rgba(139, 124, 186, 0.34);
}

.cc-btn-accept:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(139, 124, 186, 0.52);
}

.cc-btn-accept:active {
    transform: translateY(0);
}

/* Reject Non-Essential — soft secondary */
.cc-btn-reject {
    background: rgba(200, 191, 231, 0.18);
    color: #3d3250;
    border: 1px solid rgba(200, 191, 231, 0.38);
}

.cc-btn-reject:hover {
    background: rgba(200, 191, 231, 0.32);
    border-color: rgba(200, 191, 231, 0.6);
    transform: translateY(-1px);
}

/* Manage Preferences — ghost */
.cc-btn-manage {
    background: transparent;
    color: #8b7cba;
    border: 1px solid rgba(139, 124, 186, 0.38);
}

.cc-btn-manage:hover {
    background: rgba(139, 124, 186, 0.07);
    border-color: rgba(139, 124, 186, 0.65);
    transform: translateY(-1px);
}


/* ──────────────────────────────────────────────────────
   BACKDROP OVERLAY
────────────────────────────────────────────────────── */
.cc-overlay {
    position: fixed;
    inset: 0;
    z-index: 9988;
    background: rgba(28, 22, 36, 0.52);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.cc-overlay.cc-visible {
    opacity: 1;
    pointer-events: all;
}


/* ──────────────────────────────────────────────────────
   PREFERENCES MODAL
   Centered, spring scale-in animation.
────────────────────────────────────────────────────── */
.cc-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 9989;
    transform: translate(-50%, -48%) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition:
        transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
        opacity   0.28s ease;

    background: rgba(253, 249, 244, 0.98);
    backdrop-filter: blur(32px) saturate(1.8);
    -webkit-backdrop-filter: blur(32px) saturate(1.8);
    border: 1px solid rgba(200, 191, 231, 0.22);
    border-radius: 22px;
    box-shadow:
        0 32px 80px rgba(28, 22, 36, 0.20),
        0 8px 24px rgba(28, 22, 36, 0.10),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;

    width: calc(100% - 48px);
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;

    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    scrollbar-width: thin;
    scrollbar-color: rgba(200, 191, 231, 0.45) transparent;
}

.cc-modal.cc-visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: all;
}

.cc-modal::-webkit-scrollbar          { width: 4px; }
.cc-modal::-webkit-scrollbar-track    { background: transparent; }
.cc-modal::-webkit-scrollbar-thumb    { background: rgba(200, 191, 231, 0.45); border-radius: 2px; }

/* ── Sticky header ── */
.cc-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 26px 26px 18px;
    border-bottom: 1px solid rgba(200, 191, 231, 0.18);
    position: sticky;
    top: 0;
    background: rgba(253, 249, 244, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1;
    border-radius: 22px 22px 0 0;
}

.cc-modal-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 21px;
    font-weight: 500;
    font-style: italic;
    color: #1c1624;
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin: 0;
    padding-top: 2px;
}

.cc-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border: none;
    background: rgba(200, 191, 231, 0.18);
    border-radius: 50%;
    color: #7b6e8f;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    margin-top: 1px;
}

.cc-modal-close:hover {
    background: rgba(200, 191, 231, 0.36);
    color: #1c1624;
}

.cc-modal-close:focus-visible {
    outline: 2px solid #8b7cba;
    outline-offset: 3px;
}

/* ── Body ── */
.cc-modal-body {
    padding: 20px 26px 4px;
}

.cc-modal-intro {
    font-size: 13px;
    color: #7b6e8f;
    line-height: 1.65;
    margin: 0 0 20px;
}

.cc-modal-intro a {
    color: #8b7cba;
    text-decoration: underline;
    text-decoration-color: rgba(139, 124, 186, 0.38);
    text-underline-offset: 2px;
}

/* ── Cookie Category Cards ── */
.cc-category {
    border: 1px solid rgba(200, 191, 231, 0.2);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 10px;
    background: rgba(248, 244, 239, 0.45);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.cc-category:last-child {
    margin-bottom: 0;
}

.cc-category:hover {
    border-color: rgba(200, 191, 231, 0.42);
    background: rgba(248, 244, 239, 0.7);
}

.cc-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.cc-category-name {
    font-size: 13.5px;
    font-weight: 500;
    color: #1c1624;
    letter-spacing: 0.01em;
    flex: 1;
    min-width: 0;
}

.cc-always-active {
    font-size: 10.5px;
    font-weight: 500;
    color: #8b7cba;
    background: rgba(200, 191, 231, 0.22);
    border-radius: 999px;
    padding: 3px 10px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    flex-shrink: 0;
}

.cc-category-desc {
    font-size: 12px;
    color: #7b6e8f;
    line-height: 1.62;
    margin: 0;
}

/* ──────────────────────────────────────────────────────
   TOGGLE SWITCH
   Custom CSS toggle — no JS for the visual state.
   Driven entirely by input[type=checkbox] :checked.
────────────────────────────────────────────────────── */
.cc-toggle {
    position: relative;
    display: inline-flex;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
    cursor: pointer;
}

/* The real checkbox — invisible but interactive */
.cc-toggle input[type="checkbox"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
}

.cc-toggle input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

/* Track */
.cc-toggle-track {
    display: block;
    width: 44px;
    height: 26px;
    border-radius: 999px;
    background: rgba(200, 191, 231, 0.28);
    border: 1px solid rgba(200, 191, 231, 0.38);
    transition: background 0.28s ease, border-color 0.28s ease;
    position: relative;
}

/* Thumb */
.cc-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 5px rgba(28, 22, 36, 0.22), 0 0 0 1px rgba(200, 191, 231, 0.2);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
    pointer-events: none;
}

/* Checked state */
.cc-toggle input[type="checkbox"]:checked ~ .cc-toggle-track {
    background: linear-gradient(135deg, #8b7cba 0%, #c98472 100%);
    border-color: transparent;
}

.cc-toggle input[type="checkbox"]:checked ~ .cc-toggle-track .cc-toggle-thumb {
    transform: translateX(18px);
    box-shadow: 0 1px 5px rgba(28, 22, 36, 0.28);
}

/* Disabled (essential cookies) */
.cc-toggle input[type="checkbox"]:checked:disabled ~ .cc-toggle-track {
    background: linear-gradient(135deg, #8b7cba 0%, #c98472 100%);
    opacity: 0.6;
}

/* Focus ring on the track */
.cc-toggle input[type="checkbox"]:focus-visible ~ .cc-toggle-track {
    outline: 2px solid #8b7cba;
    outline-offset: 3px;
}

/* ──────────────────────────────────────────────────────
   MODAL FOOTER
────────────────────────────────────────────────────── */
.cc-modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 18px 26px 26px;
    border-top: 1px solid rgba(200, 191, 231, 0.18);
    margin-top: 18px;
}

/* Save Preferences — primary */
.cc-btn-save {
    flex: 1;
    min-width: 130px;
    background: linear-gradient(135deg, #8b7cba 0%, #c98472 100%);
    color: #fff;
    box-shadow: 0 4px 18px rgba(139, 124, 186, 0.34);
}

.cc-btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(139, 124, 186, 0.52);
}

/* Accept All (modal) — secondary */
.cc-btn-modal-accept {
    flex: 1;
    min-width: 100px;
    background: rgba(200, 191, 231, 0.18);
    color: #3d3250;
    border: 1px solid rgba(200, 191, 231, 0.38);
}

.cc-btn-modal-accept:hover {
    background: rgba(200, 191, 231, 0.32);
    border-color: rgba(200, 191, 231, 0.6);
    transform: translateY(-1px);
}

/* Reject All (modal) — ghost */
.cc-btn-modal-reject {
    flex: 1;
    min-width: 90px;
    background: transparent;
    color: #8b7cba;
    border: 1px solid rgba(139, 124, 186, 0.32);
}

.cc-btn-modal-reject:hover {
    background: rgba(139, 124, 186, 0.07);
    border-color: rgba(139, 124, 186, 0.55);
    transform: translateY(-1px);
}


/* ──────────────────────────────────────────────────────
   FOOTER TRIGGER LINK
   A <button> that looks like an inline text link.
   Drop it inside any <li> in the footer.
────────────────────────────────────────────────────── */
.cc-footer-trigger {
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    margin: 0;
    padding: 0;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(253, 249, 244, 0.28);
    text-underline-offset: 2px;
    line-height: inherit;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.cc-footer-trigger:hover {
    color: #c8bfe7;
    text-decoration-color: rgba(200, 191, 231, 0.68);
}

.cc-footer-trigger:focus-visible {
    outline: 2px solid #8b7cba;
    outline-offset: 3px;
    border-radius: 3px;
}


/* ──────────────────────────────────────────────────────
   DARK MODE
────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {

    .cc-banner {
        background: rgba(28, 22, 36, 0.97);
        border-top-color: rgba(200, 191, 231, 0.10);
        box-shadow: 0 -8px 48px rgba(0, 0, 0, 0.38), 0 -1px 0 rgba(200, 191, 231, 0.08);
    }

    .cc-banner-title { color: #fdf9f4; }

    .cc-banner-desc {
        color: rgba(253, 249, 244, 0.46);
    }

    .cc-banner-desc a {
        color: #c8bfe7;
        text-decoration-color: rgba(200, 191, 231, 0.35);
    }

    .cc-btn-reject {
        background: rgba(200, 191, 231, 0.10);
        color: #fdf9f4;
        border-color: rgba(200, 191, 231, 0.18);
    }

    .cc-btn-reject:hover {
        background: rgba(200, 191, 231, 0.20);
        border-color: rgba(200, 191, 231, 0.35);
    }

    .cc-btn-manage {
        color: #c8bfe7;
        border-color: rgba(200, 191, 231, 0.25);
    }

    .cc-btn-manage:hover {
        background: rgba(200, 191, 231, 0.10);
    }

    .cc-overlay {
        background: rgba(10, 7, 16, 0.68);
    }

    .cc-modal {
        background: rgba(28, 22, 36, 0.98);
        border-color: rgba(200, 191, 231, 0.10);
        box-shadow:
            0 32px 80px rgba(0, 0, 0, 0.45),
            0 8px 24px rgba(0, 0, 0, 0.28),
            0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    }

    .cc-modal-header {
        background: rgba(28, 22, 36, 0.97);
        border-bottom-color: rgba(200, 191, 231, 0.10);
    }

    .cc-modal-title { color: #fdf9f4; }

    .cc-modal-close {
        background: rgba(200, 191, 231, 0.10);
        color: rgba(253, 249, 244, 0.42);
    }

    .cc-modal-close:hover {
        background: rgba(200, 191, 231, 0.20);
        color: #fdf9f4;
    }

    .cc-modal-intro {
        color: rgba(253, 249, 244, 0.44);
    }

    .cc-modal-intro a { color: #c8bfe7; }

    .cc-category {
        background: rgba(255, 255, 255, 0.03);
        border-color: rgba(200, 191, 231, 0.10);
    }

    .cc-category:hover {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(200, 191, 231, 0.22);
    }

    .cc-category-name { color: #fdf9f4; }

    .cc-category-desc { color: rgba(253, 249, 244, 0.40); }

    .cc-always-active {
        color: #c8bfe7;
        background: rgba(200, 191, 231, 0.12);
    }

    .cc-toggle-track {
        background: rgba(200, 191, 231, 0.16);
        border-color: rgba(200, 191, 231, 0.20);
    }

    .cc-toggle-thumb {
        background: rgba(253, 249, 244, 0.88);
    }

    .cc-modal-footer {
        border-top-color: rgba(200, 191, 231, 0.10);
    }

    .cc-btn-modal-accept {
        background: rgba(200, 191, 231, 0.10);
        color: #fdf9f4;
        border-color: rgba(200, 191, 231, 0.18);
    }

    .cc-btn-modal-accept:hover {
        background: rgba(200, 191, 231, 0.20);
    }

    .cc-btn-modal-reject {
        color: #c8bfe7;
        border-color: rgba(200, 191, 231, 0.20);
    }
}


/* ──────────────────────────────────────────────────────
   RESPONSIVE — Tablet and below
────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .cc-banner {
        padding: 18px 20px 22px;
    }

    .cc-banner-inner {
        flex-direction: column;
        gap: 14px;
        align-items: stretch;
    }

    .cc-banner-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .cc-banner-actions .cc-btn {
        flex: 1;
        min-width: calc(50% - 5px);
    }

    /* Accept All takes full width on tablet, others split */
    .cc-banner-actions .cc-btn-accept {
        flex-basis: 100%;
    }
}

/* ──────────────────────────────────────────────────────
   RESPONSIVE — Mobile
────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .cc-banner {
        padding: 16px 16px 20px;
    }

    .cc-banner-actions {
        flex-direction: column;
    }

    .cc-banner-actions .cc-btn {
        width: 100%;
        flex-basis: auto;
    }

    .cc-modal {
        width: calc(100% - 20px);
        max-height: 88vh;
        border-radius: 18px;
    }

    .cc-modal-header {
        padding: 20px 18px 14px;
        border-radius: 18px 18px 0 0;
    }

    .cc-modal-title {
        font-size: 18px;
    }

    .cc-modal-body {
        padding: 16px 18px 2px;
    }

    .cc-category {
        padding: 14px 16px;
        border-radius: 12px;
    }

    .cc-modal-footer {
        padding: 16px 18px 22px;
        flex-direction: column;
    }

    .cc-modal-footer .cc-btn {
        width: 100%;
        flex: none;
    }
}


/* ──────────────────────────────────────────────────────
   REDUCED MOTION — Respects WCAG 2.1 SC 2.3.3
────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .cc-banner,
    .cc-modal,
    .cc-overlay,
    .cc-btn,
    .cc-btn-save,
    .cc-toggle-thumb,
    .cc-toggle-track {
        transition: none !important;
        animation: none !important;
    }
}
