/* ==========================================================================
   COOKIE CONSENT
   ========================================================================== */

.cookie-consent-bar {
    position: fixed;
    left: 50%;
    bottom: var(--space-5);
    z-index: 1200;
    width: calc(100% - var(--space-10));
    max-width: var(--container-max);
    background-color: var(--color-secondary);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateX(-50%) translateY(16px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.35s ease, opacity 0.35s ease, visibility 0.35s ease;
}

.cookie-consent-bar[aria-hidden="false"] {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.cookie-consent-bar-inner {
    padding: var(--space-4) var(--space-6);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.cookie-consent-copy {
    flex: 1 1 380px;
}

.cookie-consent-heading {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--color-white);
    margin: 0 0 var(--space-1);
}

.cookie-consent-desc {
    font-family: var(--font-secondary);
    font-size: var(--text-sm);
    line-height: 1.5;
    color: rgba(255, 255, 255, var(--on-dark-2, 0.7));
    margin: 0;
}

.cookie-consent-link {
    color: var(--color-white);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-consent-link:hover {
    color: var(--color-primary);
}

.cookie-consent-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    flex: 0 0 auto;
}

.cookie-consent-actions .btn {
    white-space: nowrap;
}

.cookie-consent-actions .btn-outline-primary {
    color: var(--color-white);
    border-color: rgba(255, 255, 255, 0.35);
}

.cookie-consent-actions .btn-outline-primary:hover {
    color: var(--color-white);
    border-color: var(--color-primary);
    background: var(--color-primary);
}

/* Preferences modal — mirrors .video-modal's overlay/scale idiom */

.cookie-consent-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cookie-consent-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.cookie-consent-modal-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
}

.cookie-consent-modal-container {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-10) var(--space-8);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.cookie-consent-modal[aria-hidden="false"] .cookie-consent-modal-container {
    transform: scale(1);
}

.cookie-consent-modal-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    color: var(--color-text-light);
    line-height: 0;
}

.cookie-consent-modal-close svg {
    width: 20px;
    height: 20px;
}

.cookie-consent-modal-close:hover {
    color: var(--color-primary);
}

.cookie-consent-modal-heading {
    font-family: var(--font-primary);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-secondary);
    margin: 0 0 var(--space-6);
    padding-right: var(--space-6);
}

.cookie-consent-category {
    padding: var(--space-4) 0;
    border-top: 1px solid var(--color-bg-alt);
}

.cookie-consent-category:first-of-type {
    border-top: none;
}

.cookie-consent-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.cookie-consent-category-title {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-secondary);
}

.cookie-consent-category-desc {
    font-family: var(--font-secondary);
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--color-text-light);
    margin: var(--space-2) 0 0;
}

/* Toggle switch */

.cookie-consent-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.cookie-consent-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

.cookie-consent-switch-track {
    position: absolute;
    inset: 0;
    background-color: #d5d5d5;
    border-radius: var(--radius-full);
    transition: background-color 0.2s ease;
}

.cookie-consent-switch-track::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background-color: var(--color-white);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.cookie-consent-switch input:checked ~ .cookie-consent-switch-track {
    background-color: var(--color-primary);
}

.cookie-consent-switch input:checked ~ .cookie-consent-switch-track::before {
    transform: translateX(18px);
}

.cookie-consent-switch input:focus-visible ~ .cookie-consent-switch-track {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.cookie-consent-switch-disabled {
    opacity: 0.6;
}

.cookie-consent-switch-disabled input {
    cursor: default;
}

.cookie-consent-modal .cookie-consent-actions {
    justify-content: flex-end;
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-bg-alt);
}

/* Floating reopen button */

.cookie-consent-reopen {
    position: fixed;
    left: var(--space-5);
    bottom: var(--space-5);
    z-index: 1100;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-secondary);
    color: var(--color-white);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.cookie-consent-reopen:hover {
    background-color: var(--color-primary);
    transform: translateY(-2px);
}

.cookie-consent-reopen svg {
    width: 22px;
    height: 22px;
}

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

@media (max-width: 767px) {
    .cookie-consent-bar {
        width: calc(100% - var(--space-6));
        bottom: var(--space-3);
    }

    /* Keep the bar compact on phones so it covers as little of the page
       (and the hero) as possible. */
    .cookie-consent-bar-inner {
        padding: var(--space-4);
        gap: var(--space-3);
    }

    .cookie-consent-desc {
        font-size: var(--text-xs);
        line-height: 1.45;
    }

    .cookie-consent-actions {
        width: 100%;
        gap: var(--space-2);
    }

    .cookie-consent-actions .btn {
        flex: 1 1 auto;
        padding-left: var(--space-4);
        padding-right: var(--space-4);
        letter-spacing: 0.5px;
    }

    /* Accept is the primary path — give it the full width, the two
       secondary actions share the row above it. */
    .cookie-consent-actions [data-cookie-consent-accept] {
        flex-basis: 100%;
        order: 3;
    }

    .cookie-consent-modal-container {
        padding: var(--space-8) var(--space-5);
    }
}
