/* ============================================================
   CLOUDFIVE — Gestion des cookies (bannière + préférences)
   Charte : accent #f96e1e, fond clair, coins arrondis, ombres douces
   ============================================================ */

/* ---------- Bannière première visite (carte bas-gauche) ---------- */
.cookie-banner {
    position: fixed;
    left: 20px;
    bottom: 20px;
    right: auto;
    z-index: 100000;
    width: 100%;
    max-width: 360px;
    background: #fff;
    border: 1px solid #eaecf0;
    border-radius: 18px;
    box-shadow: 0 20px 55px rgba(20, 20, 40, 0.18);
    padding: 22px 22px 20px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    font-family: inherit;
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.45s ease, transform 0.45s ease;
    pointer-events: none;
}
.cookie-banner.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.cookie-banner-head {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cookie-banner-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(249, 110, 30, 0.1);
    color: #f96e1e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.cookie-banner-text h3 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 800;
    color: #1a1a2e;
}
.cookie-banner-text p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #6c757d;
}
.cookie-banner-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cookie-banner-actions .cookie-btn-primary { width: 100%; }
.cookie-banner-actions-row {
    display: flex;
    gap: 8px;
}
.cookie-banner-actions-row .cookie-btn { flex: 1 1 0; padding-left: 12px; padding-right: 12px; }

/* ---------- Boutons communs ---------- */
.cookie-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease,
        background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.cookie-btn:hover { transform: translateY(-2px); }
.cookie-btn-ghost {
    background: transparent;
    border-color: #dfe3e9;
    color: #4b5563;
}
.cookie-btn-ghost:hover { border-color: #c7cdd6; color: #1a1a2e; }
.cookie-btn-outline {
    background: rgba(249, 110, 30, 0.07);
    border-color: rgba(249, 110, 30, 0.25);
    color: #c2410c;
}
.cookie-btn-outline:hover { background: rgba(249, 110, 30, 0.13); }
.cookie-btn-primary {
    background: linear-gradient(135deg, #f96e1e 0%, #ff8f3c 100%);
    color: #fff;
    box-shadow: 0 8px 22px rgba(249, 110, 30, 0.35);
}
.cookie-btn-primary:hover { box-shadow: 0 12px 28px rgba(249, 110, 30, 0.45); }

/* Empêche le scroll de la page pendant que la modale est ouverte */
body.cookie-modal-locked { overflow: hidden; }

/* ---------- Overlay + fenêtre de préférences ---------- */
.cookie-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100010;
    background: rgba(15, 17, 26, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.cookie-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}
.cookie-modal {
    width: 100%;
    max-width: 640px;
    max-height: 88vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
    transform: translateY(18px) scale(0.98);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}
.cookie-modal-overlay.is-open .cookie-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.cookie-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 26px 28px 16px;
    position: sticky;
    top: 0;
    background: #fff;
    border-bottom: 1px solid #f1f2f5;
    z-index: 1;
}
.cookie-modal-header h2 {
    margin: 0 0 6px;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1a1a2e;
}
.cookie-modal-header p {
    margin: 0;
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.6;
}
.cookie-modal-close {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #f4f5f8;
    color: #6c757d;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.cookie-modal-close:hover { background: #eef0f4; color: #1a1a2e; transform: rotate(90deg); }

.cookie-modal-body { padding: 10px 28px 6px; }

/* ---------- Catégories ---------- */
.cookie-category {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 0;
    border-bottom: 1px solid #f1f2f5;
}
.cookie-category:last-child { border-bottom: none; }
.cookie-category-info h3 {
    margin: 0 0 6px;
    font-size: 0.96rem;
    font-weight: 700;
    color: #1a1a2e;
}
.cookie-category-info p {
    margin: 0 0 6px;
    font-size: 0.83rem;
    line-height: 1.6;
    color: #6c757d;
}
.cookie-category-examples {
    font-size: 0.76rem;
    color: #9aa4b2;
}
.cookie-category-examples strong { color: #6c757d; font-weight: 600; }
.cookie-category-control {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding-top: 2px;
}
/* ---------- Interrupteur ON/OFF ---------- */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}
.cookie-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}
.cookie-switch-track {
    position: absolute;
    inset: 0;
    background: #d7dbe2;
    border-radius: 50px;
    transition: background 0.25s ease;
}
.cookie-switch-track::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cookie-switch input:checked + .cookie-switch-track {
    background: linear-gradient(135deg, #f96e1e 0%, #ff8f3c 100%);
}
.cookie-switch input:checked + .cookie-switch-track::before {
    transform: translateX(20px);
}
.cookie-switch.is-locked {
    opacity: 0.55;
}
.cookie-switch input:disabled + .cookie-switch-track {
    background: linear-gradient(135deg, #f96e1e 0%, #ff8f3c 100%);
    cursor: not-allowed;
}
.cookie-switch input:disabled {
    cursor: not-allowed;
}
.cookie-switch input:focus-visible + .cookie-switch-track {
    outline: 2px solid #f96e1e;
    outline-offset: 2px;
}

/* ---------- Footer de la modale ---------- */
.cookie-modal-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px 28px 28px;
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #f1f2f5;
}
.cookie-modal-footer .cookie-btn { flex: 1 1 auto; }

/* ---------- Lien permanent (footer) ---------- */
.cf-footer-legal a.cookie-settings-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
    .cookie-banner {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
        padding: 20px;
    }
    .cookie-modal-header,
    .cookie-modal-body,
    .cookie-modal-footer { padding-left: 20px; padding-right: 20px; }
    .cookie-category { flex-direction: column; gap: 10px; }
    .cookie-category-control { padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .cookie-banner,
    .cookie-modal,
    .cookie-modal-overlay,
    .cookie-modal-close,
    .cookie-switch-track,
    .cookie-switch-track::before {
        transition: none !important;
        animation: none !important;
    }
}
