/* =============================================================
   Cookie Consent Manager — styles
   Toutes les classes scopées sous .cookie-*.
   Réutilise les tokens d'app.css (--accent, --black-1, --line, etc.).
   Valeurs sans tokens : alignées sur le reste du projet (border-radius
   20px/999px/16px, blur 20px saturate(180%), etc.).
   ============================================================= */

/* ===== Bannière première visite (bottom-left) ===== */
.cookie-banner {
    position: fixed; bottom: 24px; left: 24px; z-index: 9000;
    max-width: 420px;
    background: rgb(var(--tint) / 0.04);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 0.5px solid var(--line-strong, rgb(var(--tint) / 0.14));
    border-radius: 20px;
    padding: 20px 22px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 300ms ease, transform 300ms ease;
}
.cookie-banner.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.cookie-banner__inner { display: flex; flex-direction: column; gap: 16px; }
.cookie-banner__text {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px; line-height: 1.55;
    color: var(--text);
}
.cookie-banner__actions {
    display: flex; flex-wrap: wrap; gap: 8px;
    justify-content: flex-end;
}

/* ===== Modale préférences (<dialog> natif) ===== */
.cookie-modal {
    padding: 0; border: none; background: transparent;
    max-width: none; max-height: none; overflow: visible;
    color: var(--text);
}
.cookie-modal::backdrop {
    background: var(--scrim);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.cookie-modal[open] {
    position: fixed; inset: 0;
    width: 100vw; height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 24px;
}
.cookie-modal__inner {
    width: 100%; max-width: 480px;
    background: var(--surface-elevated);
    border: 0.5px solid var(--line-strong, rgb(var(--tint) / 0.14));
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    display: flex; flex-direction: column;
    max-height: calc(100vh - 80px);
    overflow: hidden;
    animation: cookieModalIn 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cookieModalIn {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.cookie-modal__header {
    padding: 20px 24px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 0.5px solid var(--line, rgb(var(--tint) / 0.08));
}
.cookie-modal__title {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 18px; font-weight: 500; letter-spacing: -0.01em;
    color: var(--text);
}
.cookie-modal__close {
    width: 32px; height: 32px; border-radius: 999px;
    background: rgb(var(--tint) / 0.05);
    border: 0;
    color: var(--text-dim);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 180ms ease;
}
.cookie-modal__close:hover { color: var(--text); background: rgb(var(--tint) / 0.1); transform: rotate(90deg); }
.cookie-modal__body {
    padding: 18px 24px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 14px;
}
.cookie-modal__footer {
    padding: 18px 24px;
    border-top: 0.5px solid var(--line, rgb(var(--tint) / 0.08));
    display: flex; flex-wrap: wrap; gap: 8px;
    justify-content: flex-end;
}

/* ===== Catégories ===== */
.cookie-category {
    padding: 14px 16px;
    background: rgb(var(--tint) / 0.025);
    border: 0.5px solid var(--line, rgb(var(--tint) / 0.08));
    border-radius: 12px;
}
.cookie-category__head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.cookie-category__name {
    font-family: var(--font-sans);
    font-size: 14px; font-weight: 500; color: var(--text);
}
.cookie-category__badge {
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text-dim);
    padding: 3px 9px; border-radius: 999px;
    background: rgb(var(--tint) / 0.05);
    border: 0.5px solid var(--line, rgb(var(--tint) / 0.08));
}
.cookie-category__desc {
    margin: 0;
    font-size: 12px; line-height: 1.5; color: var(--text-dim);
}

/* ===== Toggle switch (iOS-like) ===== */
.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 36px; height: 20px;
    cursor: pointer;
}
.cookie-toggle input[type="checkbox"] {
    position: absolute; opacity: 0;
    width: 100%; height: 100%; margin: 0; cursor: pointer;
}
.cookie-toggle__track {
    position: absolute; inset: 0;
    background: rgb(var(--tint) / 0.1);
    border: 0.5px solid var(--line-strong, rgb(var(--tint) / 0.14));
    border-radius: 999px;
    transition: all 240ms ease;
}
.cookie-toggle__thumb {
    position: absolute;
    top: 2px; left: 2px;
    width: 14px; height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.cookie-toggle input[type="checkbox"]:checked ~ .cookie-toggle__track {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(0, 113, 227, 0.4);
}
.cookie-toggle input[type="checkbox"]:checked ~ .cookie-toggle__track .cookie-toggle__thumb {
    transform: translateX(16px);
}
.cookie-toggle input[type="checkbox"]:focus-visible ~ .cookie-toggle__track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===== Boutons ===== */
.cookie-btn {
    display: inline-flex; align-items: center; justify-content: center;
    height: 40px; padding: 0 18px;
    border-radius: 999px;
    font-family: var(--font-sans); font-size: 13px; font-weight: 500;
    letter-spacing: -0.005em;
    cursor: pointer;
    transition: all 240ms ease;
    white-space: nowrap;
    border: 0;
}
.cookie-btn--primary {
    background: var(--accent); color: #fff;
    box-shadow: 0 1px 0 rgb(var(--tint) / 0.2) inset, 0 8px 24px rgba(0, 113, 227, 0.3);
}
.cookie-btn--primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.cookie-btn--ghost {
    background: rgb(var(--tint) / 0.05); color: var(--text);
    border: 0.5px solid var(--line-strong, rgb(var(--tint) / 0.14));
}
.cookie-btn--ghost:hover { background: rgb(var(--tint) / 0.09); }

/* ===== Icône persistante (bottom-left) + tooltip ===== */
.cookie-icon-wrap {
    position: fixed; bottom: 24px; left: 24px; z-index: 8999;
    display: flex; align-items: center; gap: 10px;
    pointer-events: none; /* le tooltip ne bloque pas, mais l'icône réactive */
}
.cookie-icon {
    pointer-events: auto;
    width: 40px; height: 40px; border-radius: 999px;
    background: rgb(var(--tint) / 0.04);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 0.5px solid var(--line-strong, rgb(var(--tint) / 0.14));
    color: var(--text-dim);
    cursor: pointer;
    display: inline-grid; place-items: center;
    opacity: 0; transform: scale(0.85);
    pointer-events: none;
    transition: opacity 300ms ease, transform 300ms cubic-bezier(0.16, 1, 0.3, 1), color 240ms ease, background 240ms ease;
}
.cookie-icon.is-visible {
    opacity: 1; transform: scale(1);
    pointer-events: auto;
}
.cookie-icon:hover {
    color: var(--text);
    background: rgb(var(--tint) / 0.09);
    transform: scale(1.06);
}
.cookie-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.cookie-tooltip {
    background: rgb(var(--tint) / 0.04);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 0.5px solid var(--line-strong, rgb(var(--tint) / 0.14));
    border-radius: 999px;
    padding: 8px 14px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateX(-8px);
    pointer-events: none;
    transition: opacity 300ms ease, transform 300ms ease;
}
.cookie-tooltip.is-visible {
    opacity: 1; transform: translateX(0);
}

/* ===== Lien footer "Gérer les cookies" ===== */
.footer-cookie-link {
    background: none; border: 0; padding: 0;
    font-family: var(--font-mono); font-size: 10px;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text-dimmer);
    cursor: pointer;
    transition: color 240ms ease;
}
.footer-cookie-link:hover { color: var(--text); }

/* ===== Responsive ===== */
@media (max-width: 560px) {
    .cookie-banner {
        left: 12px; right: 12px; bottom: 12px;
        max-width: none;
        padding: 18px 18px;
    }
    .cookie-banner__actions { justify-content: stretch; }
    .cookie-banner__actions .cookie-btn { flex: 1; min-width: 0; }

    .cookie-modal[open] { padding: 16px; }
    .cookie-modal__inner { max-width: 100%; }
    .cookie-modal__footer { flex-direction: column; }
    .cookie-modal__footer .cookie-btn { width: 100%; }

    .cookie-icon-wrap { bottom: 16px; left: 12px; }
}
