/* ==========================================================================
   SHORTCUTLY — CONSENTEMENT AUX TRACEURS (site/js/consent.js)
   © Shortcutly

   Repose sur les jetons de styles/landing.css (--bg-glass, --text-primary,
   --shadow-lg, --radius-lg…) : ce fichier n'en redéfinit aucun, pour rester
   identique en clair et en sombre sans rien dupliquer.
   ========================================================================== */

:root {
    --sp-consent-scrim: rgba(15, 23, 42, 0.45);

    /* Transparence de la carte conservée à 60 % dans les deux thèmes. */
    --sp-glass-bg: rgba(255, 255, 255, 0.6);
    --sp-glass-border: rgba(255, 255, 255, 0.65);
    --sp-glass-blur: blur(32px) saturate(120%);
    --sp-glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.10), 0 2px 8px -2px rgba(0, 0, 0, 0.06);
    --sp-glass-highlight: inset 0 1px 1px rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] {
    --sp-consent-scrim: rgba(2, 3, 8, 0.65);

    --sp-glass-bg: rgba(15, 23, 42, 0.6);
    --sp-glass-border: rgba(255, 255, 255, 0.12);
    --sp-glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4), 0 2px 8px -2px rgba(0, 0, 0, 0.2);
    --sp-glass-highlight: inset 0 1px 1px rgba(255, 255, 255, 0.08);
}

/* --- 1. BANDEAU — carte flottante, détachée du bord ---------------------- */
/* Centrée, mais toujours PAS bord à bord : une carte qui flotte, avec sa
   propre ombre et ses coins arrondis partout, se distingue du reste de la
   page au lieu de s'y fondre. left/right + marge auto plutôt que
   transform: translateX(-50%) pour centrer : un élément fixe combinant
   transform + backdrop-filter peut se décrocher au défilement sur mobile
   (Samsung Internet, WebView). */
.sp-consent-bar {
    position: fixed;
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    max-width: 840px;
    margin: 0 auto;
    z-index: 10000;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    background: var(--sp-glass-bg);
    backdrop-filter: var(--sp-glass-blur);
    -webkit-backdrop-filter: var(--sp-glass-blur);
    border: 1px solid var(--sp-glass-border);
    box-shadow: var(--shadow-lg), var(--sp-glass-highlight);
    transform: translateY(calc(100% + 32px));
    transition: transform .4s cubic-bezier(.16, .84, .32, 1);
}

.sp-consent-bar.is-visible {
    transform: translateY(0);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .sp-consent-bar {
        background: var(--bg-surface);
    }
}

@media (prefers-reduced-transparency: reduce) {
    .sp-consent-bar {
        background: var(--bg-surface);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sp-consent-bar {
        transition: none;
    }
}

.sp-consent-bar-inner {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sp-consent-bar-text {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.sp-consent-icon {
    flex: none;
    width: 32px;
    height: 32px;
    margin-top: 0;
}

.sp-consent-bar-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.sp-consent-msg {
    margin: 0;
    font-size: .96rem;
    font-weight: 550;
    line-height: 1.5;
    color: var(--text-primary);
}

.sp-consent-consequence {
    margin: 0;
    font-size: .85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.sp-consent-consequence a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

/* Empilé par défaut (mobile) ; en ligne dès qu'il y a la place (voir la
   media query plus bas) — la carte est de nouveau assez large pour ça,
   et une ligne unique reste plus compacte en hauteur qu'une colonne. */
.sp-consent-bar-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.sp-consent-actions-main {
    display: flex;
    gap: 10px;
}

.sp-consent-btn {
    flex: 1 1 0;
    padding: 12px 20px;
    font-size: .9rem;
    white-space: nowrap;
}

/* Discret par construction : ni fond, ni bordure, un simple lien souligné —
   c'est « Personnaliser » qui prend cette place, jamais « Tout refuser » :
   le refus doit rester aussi facile d'accès que l'acceptation. */
.sp-consent-link {
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: none;
    border: none;
    padding: 11px 6px;
    margin: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
    text-align: center;
}

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

@media (min-width: 640px) {
    .sp-consent-bar-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
    }

    .sp-consent-actions-main {
        flex: none;
    }

    .sp-consent-btn {
        flex: none;
    }

    .sp-consent-link {
        text-align: left;
    }
}

/* --- 2. DIALOGUE DE PRÉFÉRENCES ------------------------------------------ */
.sp-consent-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--sp-consent-scrim);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .2s ease;
}

.sp-consent-overlay[hidden] {
    display: none;
}

.sp-consent-overlay.is-open {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .sp-consent-overlay {
        transition: none;
    }
}

/* Contenu dense (texte, interrupteurs) : un fond plein, pas du verre, pour
   rester lisible en plein soleil — le verre reste réservé au bandeau. */
.sp-consent-dialog {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 28px;
    transform: translateY(8px);
    transition: transform .2s ease;
}

.sp-consent-overlay.is-open .sp-consent-dialog {
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .sp-consent-dialog {
        transition: none;
    }
}

.sp-consent-close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    cursor: pointer;
}

.sp-consent-close svg {
    width: 16px;
    height: 16px;
}

.sp-consent-close:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.sp-consent-dialog h2 {
    margin: 0 40px 12px 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.sp-consent-intro {
    margin: 0 0 20px;
    font-size: .92rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.sp-consent-categorie {
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
}

.sp-consent-categorie:last-of-type {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 22px;
}

.sp-consent-cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.sp-consent-cat-titre {
    font-weight: 650;
    font-size: .96rem;
    color: var(--text-primary);
}

.sp-consent-cat-desc {
    margin: 6px 0 0;
    font-size: .85rem;
    line-height: 1.55;
    color: var(--text-tertiary);
}

.sp-consent-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sp-consent-dialog-actions .btn {
    flex: 1 1 auto;
    padding: 12px 16px;
    font-size: .88rem;
}

/* --- 3. INTERRUPTEUR ------------------------------------------------------ */
.sp-consent-switch {
    position: relative;
    display: inline-flex;
    flex: none;
    width: 44px;
    height: 26px;
    cursor: pointer;
}

.sp-consent-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.sp-consent-switch-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--border-strong);
    transition: background .18s ease;
}

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

.sp-consent-switch input:checked+.sp-consent-switch-track {
    background: var(--accent);
}

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

.sp-consent-switch input:focus-visible+.sp-consent-switch-track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sp-consent-switch.is-locked {
    cursor: default;
    opacity: .7;
}

.sp-consent-switch.is-locked input {
    cursor: default;
}

@media (prefers-reduced-motion: reduce) {

    .sp-consent-switch-track,
    .sp-consent-switch-track::before {
        transition: none;
    }
}

/* --- 4. LIEN « GÉRER LES COOKIES » DANS LES PIEDS DE PAGE ---------------- */
/* Un <button> plutôt qu'un <a> (n'ouvre rien, ne navigue nulle part) mais
   habillé pour se fondre exactement parmi les liens légaux voisins. */
.sp-consent-footer-link {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-decoration: none;
}

.sp-consent-footer-link:hover {
    text-decoration: underline;
}
