/* =========================================================
   ANALYTICS CONSENT — bottom notice and Privacy & cookies dialog
   Behaviour: src/app/privacy/consent.js. Accept and Decline share one
   button style so neither choice is emphasised over the other.
   ========================================================= */

.consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99990;                 /* above pages, below the floating buttons and modals */

    padding: 14px clamp(16px, 4vw, 40px) calc(14px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;

    background: rgba(3, 12, 26, 0.96);
    border-top: 1px solid rgba(0, 217, 255, 0.22);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
    color: #e8f4ff;
    font-family: 'Inter', sans-serif;
}

.consent-banner[hidden] {
    display: none;
}

/* Never over the entry gate: hidden (and out of the Tab order) until
   enterSwimtics() adds .exit, then revealed once the gate has faded,
   like the floating controls (entry-gate-motion.css). */
#entryGate:not(.exit) ~ .consent-banner {
    visibility: hidden;
    opacity: 0;
}

#entryGate.exit ~ .consent-banner {
    transition: opacity .4s ease 1.1s, visibility 0s linear 1.1s;
}

@media (prefers-reduced-motion: reduce) {
    #entryGate.exit ~ .consent-banner {
        transition-delay: 0s;
    }
}

.consent-inner {
    display: flex;
    align-items: center;
    gap: 16px 28px;
    max-width: 1100px;
    margin: 0 auto;
}

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

.consent-banner h2,
.privacy-dialog h2 {
    margin: 0 0 4px;
    font-family: 'Exo 2', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: inherit;
}

.consent-banner p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(232, 244, 255, 0.85);
}

.consent-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
}

/* the same look for both choices */
.consent-btn {
    width: 190px;                   /* one fixed width, so the longer label isn't a bigger button */
    max-width: 100%;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid rgba(0, 217, 255, 0.55);
    background: rgba(0, 217, 255, 0.10);
    color: #e8f4ff;
    font: 600 0.95rem 'Exo 2', sans-serif;
    cursor: pointer;
}

.consent-btn:hover {
    background: rgba(0, 217, 255, 0.20);
}

.consent-btn:focus-visible,
.privacy-close:focus-visible {
    outline: 2px solid #00d9ff;
    outline-offset: 3px;
}

/* While the notice is up, keep it from covering anything: lift the
   floating theme / Coach ATLAS buttons above it (margin offsets a fixed
   element's `bottom` in every existing media query) and leave room at
   the end of the page and for scrolled-to focus. */
body.consent-pending #themeToggle,
body.consent-pending #aiCoachBtn {
    margin-bottom: var(--consent-banner-height, 0px);
}

body.consent-pending {
    padding-bottom: var(--consent-banner-height, 0px);
}

html {
    scroll-padding-bottom: var(--consent-banner-height, 0px);
}

@media (max-width: 760px) {
    .consent-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .consent-banner p {
        font-size: 0.85rem;
    }

    .consent-actions .consent-btn {
        flex: 1 1 0;
        min-width: 0;
    }
}

/* ---------- Privacy & cookies dialog ---------- */
.privacy-dialog {
    width: min(520px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 24px;
    border-radius: 18px;
    border: 1px solid rgba(0, 217, 255, 0.25);
    background: #061426;
    color: #e8f4ff;
    font-family: 'Inter', sans-serif;
    line-height: 1.55;
}

.privacy-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.privacy-dialog p {
    margin: 0 0 12px;
    font-size: 0.92rem;
}

.privacy-dialog .privacy-status {
    font-weight: 600;
}

.privacy-dialog .consent-actions {
    margin: 16px 0 8px;
}

.privacy-dialog .consent-actions .consent-btn {
    flex: 1 1 0;
    min-width: 0;
}

.privacy-result {
    min-height: 1.4em;
    color: #34d399;
}

.privacy-close {
    display: block;
    margin: 8px 0 0 auto;
    min-height: 44px;
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: none;
    color: inherit;
    font: 600 0.9rem 'Exo 2', sans-serif;
    cursor: pointer;
}

/* ---------- light mode ---------- */
body.light-mode .consent-banner {
    background: rgba(255, 252, 246, 0.97);
    border-top-color: rgba(0, 0, 0, 0.10);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.10);
    color: #111;
}

body.light-mode .consent-banner p {
    color: rgba(0, 0, 0, 0.75);
}

body.light-mode .consent-btn {
    border-color: rgba(0, 102, 204, 0.55);
    background: rgba(0, 102, 204, 0.06);
    color: #0b3d6e;
}

body.light-mode .consent-btn:hover {
    background: rgba(0, 102, 204, 0.14);
}

body.light-mode .privacy-dialog {
    background: #fffdf8;
    border-color: rgba(0, 0, 0, 0.10);
    color: #111;
}

body.light-mode .privacy-result {
    color: #087f5b;
}

body.light-mode .privacy-close {
    border-color: rgba(0, 0, 0, 0.25);
}
