/**
 * Bandeau cookies — pleine largeur, fond blanc
 * La modale est fermée par défaut (display:none) pour éviter un écran blanc
 * si [hidden] ou ce fichier CSS ne s'appliquent pas correctement.
 */

#cookie-banner:not(.is-visible),
#cookie-modal:not(.is-open) {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#cookie-banner[hidden]:not(.is-visible),
#cookie-modal[hidden]:not(.is-open) {
    display: none !important;
}

#cookie-banner.is-visible {
    display: block;
}

#cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 10000;
    margin: 0;
    padding: 0;
    border: none;
    border-top: 1px solid #d4d4d8;
    background: #ffffff;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
    pointer-events: auto;
}

#cookie-banner .cookie-banner__inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    padding: 1rem 1.25rem 1.125rem;
    box-sizing: border-box;
}

#cookie-banner .cookie-banner__content {
    flex: 1;
    min-width: 0;
}

#cookie-banner .cookie-banner__title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0a0a0b;
    line-height: 1.35;
}

#cookie-banner .cookie-banner__lead {
    margin: 0.375rem 0 0;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: #52525b;
}

#cookie-banner .cookie-banner__lead a {
    color: #0a0a0b;
    font-weight: 600;
    text-decoration: underline;
}

#cookie-banner .cookie-banner__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

#cookie-banner .cookie-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.5rem 1rem;
    margin: 0;
    border-radius: 0;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

#cookie-banner .cookie-btn--primary {
    background: #0a0a0b;
    color: #ffffff;
    border: 1px solid #0a0a0b;
}

#cookie-banner .cookie-btn--primary:hover {
    background: #27272a;
}

#cookie-banner .cookie-btn--secondary {
    background: #ffffff;
    color: #0a0a0b;
    border: 1px solid #a1a1aa;
}

#cookie-banner .cookie-btn--secondary:hover {
    background: #f4f4f5;
}

/* Modale préférences — visible uniquement avec .is-open */
#cookie-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    pointer-events: none;
    visibility: hidden;
    background: transparent;
}

#cookie-modal.is-open {
    display: flex;
    pointer-events: auto;
    visibility: visible;
}

#cookie-modal .cookie-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

#cookie-modal .cookie-modal__panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 28rem;
    max-height: min(90vh, 32rem);
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #d4d4d8;
    border-radius: 0;
    padding: 1.5rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

html.cookie-modal-open {
    overflow: hidden;
}

html.cookie-banner-visible {
    scroll-padding-bottom: var(--cookie-banner-height, 7rem);
}

#cookie-modal .cookie-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

#cookie-modal .cookie-modal__title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 700;
    color: #0a0a0b;
}

#cookie-modal .cookie-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid #d4d4d8;
    border-radius: 0;
    background: #fff;
    color: #52525b;
    cursor: pointer;
}

#cookie-modal .cookie-modal__intro {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
    color: #71717a;
    line-height: 1.55;
}

#cookie-modal .cookie-pref {
    margin-top: 0.875rem;
    padding: 0.875rem 1rem;
    border: 1px solid #e4e4e7;
    border-radius: 0;
    background: #fafafa;
}

#cookie-modal .cookie-pref__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

#cookie-modal .cookie-pref__label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #0a0a0b;
}

#cookie-modal .cookie-pref__desc {
    margin: 0.25rem 0 0;
    font-size: 0.75rem;
    color: #71717a;
}

#cookie-modal .cookie-pref__badge {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border: 1px solid #e4e4e7;
    border-radius: 0;
    background: #f4f4f5;
    color: #71717a;
}

#cookie-modal .cookie-pref__badge--on {
    border-color: #bbf7d0;
    background: #ecfdf5;
    color: #15803d;
}

#cookie-modal .cookie-modal__footer {
    margin-top: 1.25rem;
}

#cookie-modal .cookie-btn--block {
    width: 100%;
}

@media (min-width: 768px) {
    #cookie-banner .cookie-banner__inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 2rem;
    }

    #cookie-banner .cookie-banner__actions {
        flex-wrap: nowrap;
    }
}

@media (max-width: 767px) {
    #cookie-banner .cookie-banner__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    #cookie-banner .cookie-btn--primary {
        grid-column: 1 / -1;
    }

    #cookie-banner .cookie-btn {
        width: 100%;
    }
}
