/* ==========================================================================
   ATTIMO — Bandeau cookies CNIL
   Direction artistique cohérente avec le reste de la plateforme :
     - Couleur primaire #6B9ECE
     - Fonts : Inter (body) + Space Grotesk (titres)
     - Design sobre, discret mais conforme CNIL 2020-091

   Règles d'intégration :
     - 3 boutons de poids visuel équivalent (même taille, même padding)
     - Refus aussi visible que l'acceptation
     - Dark pattern interdits (pas de "continuer sans accepter" caché)
   ========================================================================== */

/* Container principal du bandeau — fixé en bas de viewport */
.attimo-cookie-banner {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    z-index: 9998;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #1a1a1a;
    animation: attimoCookieSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.attimo-cookie-banner[hidden] {
    display: none !important;
}

@keyframes attimoCookieSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.attimo-cookie-banner__inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px 24px;
}

.attimo-cookie-banner__content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.attimo-cookie-banner__icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background-color: #eaf2fa;
    color: #6B9ECE;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.attimo-cookie-banner__text {
    flex: 1;
    min-width: 0;
}

.attimo-cookie-banner__title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 4px;
    color: #0a0a0a;
    line-height: 1.3;
}

.attimo-cookie-banner__desc {
    font-size: 13px;
    line-height: 1.5;
    color: #4a4a4a;
    margin: 0;
}

.attimo-cookie-banner__desc a {
    color: #6B9ECE;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.attimo-cookie-banner__desc a:hover {
    color: #5a8dbd;
}

/* ==========================================================================
   BOUTONS (3 boutons de poids équivalent — CNIL)
   ========================================================================== */

.attimo-cookie-banner__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.attimo-cookie-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    min-width: 120px;
    text-align: center;
}

.attimo-cookie-btn:focus-visible {
    outline: 2px solid #6B9ECE;
    outline-offset: 2px;
}

/* Variante primaire (Tout accepter) */
.attimo-cookie-btn--primary {
    background-color: #6B9ECE;
    color: #ffffff;
    border-color: #6B9ECE;
}

.attimo-cookie-btn--primary:hover {
    background-color: #5a8dbd;
    border-color: #5a8dbd;
    transform: translateY(-1px);
}

/* Variante outline (Tout refuser + Personnaliser) */
.attimo-cookie-btn--outline {
    background-color: #ffffff;
    color: #1a1a1a;
    border-color: #d4d4d8;
}

.attimo-cookie-btn--outline:hover {
    border-color: #1a1a1a;
    background-color: #fafafa;
    transform: translateY(-1px);
}

/* ==========================================================================
   MODALE "PERSONNALISER"
   ========================================================================== */

.attimo-cookie-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #1a1a1a;
}

.attimo-cookie-modal[hidden] {
    display: none !important;
}

.attimo-cookie-modal__backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(10, 10, 10, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: attimoCookieFadeIn 0.25s ease;
}

@keyframes attimoCookieFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.attimo-cookie-modal__dialog {
    position: relative;
    background-color: #ffffff;
    border-radius: 14px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    animation: attimoCookieScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes attimoCookieScaleIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.attimo-cookie-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f4f4f5;
}

.attimo-cookie-modal__title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #0a0a0a;
    margin: 0;
}

.attimo-cookie-modal__close {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: #71717a;
    border-radius: 6px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attimo-cookie-modal__close:hover {
    background-color: #f4f4f5;
    color: #1a1a1a;
}

.attimo-cookie-modal__intro {
    padding: 16px 24px;
    font-size: 13px;
    color: #4a4a4a;
    line-height: 1.55;
}

.attimo-cookie-modal__intro p {
    margin: 0;
}

/* ==========================================================================
   CATÉGORIES
   ========================================================================== */

.attimo-cookie-modal__categories {
    padding: 0 24px 16px;
}

.attimo-cookie-cat {
    padding: 16px 18px;
    background-color: #fafafa;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    margin-bottom: 10px;
}

.attimo-cookie-cat:last-child {
    margin-bottom: 0;
}

.attimo-cookie-cat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.attimo-cookie-cat__label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.attimo-cookie-cat__title {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #0a0a0a;
    margin: 0;
}

.attimo-cookie-cat__badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.attimo-cookie-cat__badge--required {
    background-color: #eaf2fa;
    color: #2c5a85;
}

.attimo-cookie-cat__desc {
    font-size: 12px;
    line-height: 1.5;
    color: #4a4a4a;
    margin: 0;
}

.attimo-cookie-cat__details {
    margin-top: 8px;
}

.attimo-cookie-cat__details summary {
    font-size: 12px;
    font-weight: 500;
    color: #6B9ECE;
    cursor: pointer;
    padding: 4px 0;
    user-select: none;
}

.attimo-cookie-cat__details summary:hover {
    color: #5a8dbd;
}

.attimo-cookie-cat__list {
    list-style: none;
    padding: 8px 0 0;
    margin: 0;
    font-size: 12px;
    color: #4a4a4a;
    line-height: 1.6;
}

.attimo-cookie-cat__list li {
    padding: 3px 0;
}

.attimo-cookie-cat__list li strong {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    color: #1a1a1a;
    margin-right: 4px;
}

/* ==========================================================================
   TOGGLE SWITCH
   ========================================================================== */

.attimo-cookie-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.attimo-cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.attimo-cookie-toggle__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #d4d4d8;
    border-radius: 24px;
    transition: background-color 0.2s ease;
}

.attimo-cookie-toggle__slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.attimo-cookie-toggle input:checked + .attimo-cookie-toggle__slider {
    background-color: #6B9ECE;
}

.attimo-cookie-toggle input:checked + .attimo-cookie-toggle__slider::before {
    transform: translateX(20px);
}

.attimo-cookie-toggle input:focus-visible + .attimo-cookie-toggle__slider {
    outline: 2px solid #6B9ECE;
    outline-offset: 2px;
}

.attimo-cookie-toggle--disabled .attimo-cookie-toggle__slider {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ==========================================================================
   FOOTER MODALE
   ========================================================================== */

.attimo-cookie-modal__footer {
    border-top: 1px solid #f4f4f5;
    padding: 16px 24px 20px;
}

.attimo-cookie-modal__footer-note {
    font-size: 12px;
    color: #71717a;
    margin: 0 0 14px;
    line-height: 1.5;
}

.attimo-cookie-modal__footer-note a {
    color: #6B9ECE;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.attimo-cookie-modal__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 900px) {
    .attimo-cookie-banner__inner {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 18px;
    }

    .attimo-cookie-banner__actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .attimo-cookie-btn {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 540px) {
    .attimo-cookie-banner {
        bottom: 8px;
        left: 8px;
        right: 8px;
    }

    .attimo-cookie-banner__inner {
        padding: 16px;
        gap: 14px;
    }

    .attimo-cookie-banner__content {
        gap: 12px;
    }

    .attimo-cookie-banner__icon {
        width: 36px;
        height: 36px;
    }

    .attimo-cookie-banner__title {
        font-size: 14px;
    }

    .attimo-cookie-banner__desc {
        font-size: 12px;
    }

    .attimo-cookie-banner__actions {
        flex-direction: column;
    }

    .attimo-cookie-btn {
        width: 100%;
        padding: 12px;
    }

    .attimo-cookie-modal__dialog {
        max-height: 95vh;
    }

    .attimo-cookie-modal__header,
    .attimo-cookie-modal__intro,
    .attimo-cookie-modal__categories,
    .attimo-cookie-modal__footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .attimo-cookie-modal__actions {
        flex-direction: column;
    }
}

/* ==========================================================================
   ACCESSIBILITÉ — réduction de mouvement
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .attimo-cookie-banner,
    .attimo-cookie-modal__backdrop,
    .attimo-cookie-modal__dialog {
        animation: none;
    }

    .attimo-cookie-btn:hover,
    .attimo-cookie-toggle__slider::before {
        transition: none;
    }
}

/* ==========================================================================
   Back-office — le bandeau laisse le menu latéral entier (registre n° 73)

   Le menu du back-office est fixé à gauche sur 260 px (layouts.tenant). Sur
   ordinateur, le bandeau commence à sa droite : « Déconnexion » et le bas du
   menu restent cliquables. Sur téléphone, le menu s'ouvre par-dessus la page
   (z-index 1000, voile 999) : le bandeau passe dessous. Les pages publiques
   ne portent pas cette classe et ne changent pas.
   ========================================================================== */
.attimo-cookie-banner--backoffice {
    left: calc(260px + 16px);
}

@media (max-width: 768px) {
    .attimo-cookie-banner--backoffice {
        left: 8px;
        z-index: 998;
    }
}
