/* ================================================================
   cookie-banner.css — ODIV GDPR Cookie Consent Banner
   Depends on: css/variables.css (loaded before this file)
   Z-index slots: banner = 500, re-open button = 490
   ================================================================ */

/* ── Banner Root ──────────────────────────────────────────────── */
#odiv-cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 500;
    display: flex;
    flex-direction: column;
    /* Off-screen on load; cb-visible slides it up */
    transform: translateY(100%);
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

#odiv-cookie-banner.cb-visible {
    transform: translateY(0);
    pointer-events: all;
}

/* ── Inner Wrapper ────────────────────────────────────────────── */
.cb-inner {
    background: var(--bg-card);
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -8px 40px -8px rgba(0, 0, 0, 0.55),
                0 -1px 0 0 rgba(37, 211, 102, 0.08);
}

/* ── Preferences Panel (expands upward above the bar) ─────────── */
.cb-prefs {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.38s cubic-bezier(0.16, 1, 0.3, 1),
                border-top-width 0.38s ease;
    border-top: 0px solid var(--glass-border);
}

.cb-prefs.cb-prefs-open {
    max-height: 80vh;
    border-top-width: 1px;
    overflow-y: auto;
}

.cb-prefs-inner {
    padding: 1.25rem 1.5rem 1rem;
}

.cb-prefs-title {
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.875rem;
    letter-spacing: -0.01em;
}

/* ── Cookie Category List ─────────────────────────────────────── */
.cb-category-list {
    list-style: none;
    margin: 0 0 0.875rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cb-category {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    transition: border-color 0.2s;
}

.cb-category:has(input:checked) {
    border-color: rgba(37, 211, 102, 0.2);
}

.cb-category-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.cb-category-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cb-category-desc {
    font-size: 0.77rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* ── Toggle Switch ────────────────────────────────────────────── */
.cb-toggle-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* "Always On" locked badge */
.cb-locked-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 0.22rem 0.65rem;
    border-radius: 100px;
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.22);
    white-space: nowrap;
}

/* Custom checkbox-based toggle */
.cb-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.cb-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cb-toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: background 0.22s ease, border-color 0.22s ease;
}

.cb-toggle input:checked + .cb-toggle-track {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.cb-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.cb-toggle input:checked + .cb-toggle-track::after {
    transform: translateX(18px);
}

/* Keyboard focus ring */
.cb-toggle input:focus-visible + .cb-toggle-track {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

/* ── Preferences Footer ───────────────────────────────────────── */
.cb-prefs-actions {
    display: flex;
    justify-content: flex-start;
    padding-top: 0.875rem;
    border-top: 1px solid var(--glass-border);
}

.cb-prefs-actions .btn {
    padding: 0.5rem 1.3rem;
    font-size: 0.85rem;
}

/* ── Compact Bar ──────────────────────────────────────────────── */
.cb-bar {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 10rem 0.875rem 1.5rem;
    flex-wrap: wrap;
}

.cb-bar-icon {
    flex-shrink: 0;
    color: var(--accent-green);
    display: flex;
    align-items: center;
}

.cb-bar-icon svg {
    width: 20px;
    height: 20px;
}

.cb-bar-text {
    flex: 1;
    min-width: 180px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}

.cb-bar-text a {
    color: var(--accent-green);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.cb-bar-text a:hover {
    color: var(--accent-mint);
}

.cb-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Compact sizing for bar buttons */
.cb-bar-actions .btn {
    padding: 0.48rem 1.1rem;
    font-size: 0.84rem;
    white-space: nowrap;
}

/* ── Re-open Floating Button ──────────────────────────────────── */
#odiv-cookie-reopen {
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    z-index: 490;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--accent-green);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-elevated);
    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
    transform: scale(0.75);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.2s, box-shadow 0.2s;
}

#odiv-cookie-reopen.cb-reopen-visible {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
}

#odiv-cookie-reopen:hover {
    border-color: rgba(37, 211, 102, 0.4);
    box-shadow: var(--shadow-glow);
    transform: scale(1.1);
}

#odiv-cookie-reopen svg {
    width: 17px;
    height: 17px;
}

/* ── External Voice Widget — z-index only ────────────────────── */
/* The ASK ODIV widget (embed-loader.js) injects elements with inline
   position:fixed + bottom styles. Keep it below the cookie banner. */

div[style*="position: fixed"][style*="bottom"],
iframe[style*="position: fixed"][style*="bottom"] {
    z-index: 400 !important;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
    .cb-bar {
        padding: 0.875rem 1rem;
        gap: 0.625rem;
        /* Reset desktop widget-clearance padding on mobile */
        padding-right: 1rem;
    }

    .cb-bar-icon {
        order: 1;
    }

    .cb-bar-text {
        order: 2;
        width: 100%;
        flex: none;
        min-width: unset;
        font-size: 0.82rem;
    }

    .cb-bar-actions {
        order: 3;
        width: 100%;
    }

    .cb-bar-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .cb-prefs-inner {
        padding: 1rem;
    }

    .cb-prefs-actions {
        justify-content: stretch;
    }

    .cb-prefs-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .cb-category {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    #odiv-cookie-reopen {
        bottom: 1rem;
        left: 1rem;
        width: 36px;
        height: 36px;
    }
}

/* Safety overrides removed — inline styles on the elements handle
   position:fixed, max-height:0, and overflow:hidden directly in
   cookie-consent.js buildHTML() to prevent FOUC on any page. */
