/* ============================================================
   SAMA · comparateur-lamal / comparateur.css
   Réutilise les tokens de ../css/style.css (palette, polices).
   ============================================================ */

body.comparateur-page {
  background: var(--dark-bg);
  min-height: 100svh;
  position: relative;
  /* ../css/style.css cache le curseur natif (body { cursor: none }) pour
     dessiner un curseur personnalisé via main.js — script qu'on ne charge
     pas ici. Sans ça, le curseur disparaît partout hors des boutons/champs
     qui forcent leur propre cursor. Le sélecteur de classe l'emporte sur
     le sélecteur d'élément d'origine. */
  cursor: auto;
}

/* ── Photo de fond (desktop uniquement) ──────────────────────
   Masquée par défaut (mobile) : display:none dans une règle hors media
   query fait que le navigateur ne télécharge même pas l'image sur petit
   écran. La media query qui l'active (≥900px) est en fin de fichier. */
.bg-photo { display: none; }

/* ── Photo de fond (mobile uniquement) ───────────────────────
   Visible par défaut (<900px) ; masquée en fin de fichier dès 900px,
   où .bg-photo (desktop) prend le relais — jamais les deux ensemble. */
.bg-photo-mobile {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(180deg, rgba(8, 10, 10, 0.6) 0%, rgba(8, 10, 10, 0.25) 30%, rgba(8, 10, 10, 0.25) 70%, rgba(8, 10, 10, 0.65) 100%),
    url('../../assets/images/comparateur-bg-mobile.jpg');
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

/* Tout le contenu passe au-dessus de la photo mobile */
.compliance-banner,
.progress-rail,
.comparateur-header,
#wizard,
.comparateur-footer {
  position: relative;
  z-index: 1;
}

/* ── Bandeau conformité ─────────────────────────────────────── */
.compliance-banner {
  background: var(--dark-bg-2);
  color: var(--dark-text-muted);
  font-size: 0.68rem;
  line-height: 1.3;
  padding: 0.4rem 0.8rem;
  text-align: center;
}
.compliance-banner a { color: var(--pale); text-decoration: underline; }
.compliance-banner strong { color: var(--dark-text); font-weight: 600; }

/* ── Barre de progression ───────────────────────────────────── */
.progress-rail {
  height: 3px;
  background: rgba(240, 250, 244, 0.15);
  position: sticky;
  top: 0;
  z-index: 20;
}
.progress-fill {
  height: 100%;
  width: 14.28%;
  background: var(--pale);
  transition: width 0.5s var(--ease-out);
}

/* ── Header ──────────────────────────────────────────────────── */
.comparateur-header {
  /* Toujours collé aux vrais bords de l'écran, comme la nav de la page
     d'accueil (#main-nav) — pas de colonne centrée, quelle que soit la
     largeur d'écran. */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1.1rem;
  width: 100%;
}
.comparateur-logo {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(1.3rem, 4.5vw, 2.1rem);
  letter-spacing: 0.04em;
}
.countdown { text-align: right; line-height: 1.25; }
.countdown-label {
  display: block;
  font-size: 0.6rem;
  color: var(--dark-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.countdown-value {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--pale);
}
/* Sous 480px, on garde seulement la date : le libellé prend une ligne
   entière qui coûte cher en hauteur sur petit écran. */
@media (max-width: 480px) {
  .countdown-label { display: none; }
}

/* ── Wizard / steps ──────────────────────────────────────────── */
#wizard {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.step {
  /* --chrome-h est mesuré en JS (bandeau + barre de progression + header)
     pour que l'étape occupe exactement l'espace restant. Le step lui-même
     ne défile JAMAIS (overflow:hidden) : c'est la carte (.step-inner,
     ci-dessous) qui absorbe un éventuel surplus de contenu en interne, pour
     que ses coins arrondis et son liseré vert restent toujours visibles à
     l'écran, jamais coupés par un scroll de toute la page. */
  height: calc(100svh - var(--chrome-h, 140px));
  overflow: hidden;
  display: flex;
  align-items: center;
}
/* `display:flex` ci-dessus l'emporterait sinon sur le display:none par
   défaut de l'attribut [hidden] (le CSS auteur passe toujours avant le
   CSS du navigateur) : sans cette règle, toutes les étapes s'affichent
   empilées au lieu d'une seule à la fois. */
.step[hidden] { display: none; }

.step-inner {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0.6rem 0;
  /* Valeur explicite identique à celle de .step (pas un pourcentage, pour
     éviter toute ambiguïté de résolution dans un conteneur flex) : garantit
     que la carte ne dépasse jamais l'espace réellement disponible. */
  max-height: calc(100svh - var(--chrome-h, 140px));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 250, 244, 0.35) transparent;
}
.step-inner::-webkit-scrollbar { width: 6px; }
.step-inner::-webkit-scrollbar-thumb {
  background: rgba(240, 250, 244, 0.35);
  border-radius: 999px;
}
.step-inner-wide { max-width: 1060px; }

/* Étape 7 : contenu potentiellement long (classement complet) — on laisse
   le haut du contenu ancré plutôt que centré, plus naturel pour une liste. */
.step.step-results { align-items: flex-start; }
.step.step-results .step-inner { padding-top: 2rem; }

.step-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.25rem 0.6rem;
  margin: 0 0 0.25rem -0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dark-text-muted);
  border-radius: 10px;
}
.step-back:hover { color: var(--dark-text); background: rgba(240, 250, 244, 0.06); }

.step-eyebrow {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pale);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.step h1 {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(1.35rem, 4.5vw, 2.2rem);
  line-height: 1.12;
  margin-bottom: 0.4rem;
}

.step-sub {
  color: var(--dark-text-muted);
  font-size: 0.88rem;
  margin-bottom: 0.7rem;
  max-width: 46ch;
}

/* ── Champs texte ────────────────────────────────────────────── */
.field-group { margin-bottom: 0.4rem; position: relative; }
.field-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  color: var(--dark-text);
}
.field-group input[type="text"],
.field-group input[type="tel"],
.field-group input[type="email"] {
  width: 100%;
  min-height: 44px;
  padding: 0.45rem 0.8rem;
  border-radius: 12px;
  border: 1.5px solid rgba(240, 250, 244, 0.2);
  background: rgba(240, 250, 244, 0.06);
  color: var(--dark-text);
  font-size: 1rem;
  font-family: var(--font-body);
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}
.field-group input:focus {
  outline: none;
  border-color: var(--pale);
  background: rgba(240, 250, 244, 0.1);
}
.field-help {
  font-size: 0.8rem;
  color: var(--dark-text-muted);
  margin-top: 0.4rem;
}
.field-error {
  color: #ffb4a8;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}
.field-success {
  color: var(--pale);
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0.75rem;
}

/* ── Autocomplete ────────────────────────────────────────────── */
.autocomplete-list {
  list-style: none;
  position: absolute;
  left: 0; right: 0; top: 100%;
  margin-top: 0.35rem;
  background: var(--dark-bg-2);
  border: 1px solid rgba(240, 250, 244, 0.15);
  border-radius: 14px;
  overflow: hidden;
  z-index: 10;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.autocomplete-list li {
  padding: 0.8rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.autocomplete-list li:hover,
.autocomplete-list li.is-active {
  background: rgba(240, 250, 244, 0.1);
}
.autocomplete-list li small { color: var(--dark-text-muted); margin-left: 0.5em; }

/* ── Chips (choix simples) ───────────────────────────────────── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.chip-row-large { flex-direction: column; }
.chip {
  min-height: 44px;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1.5px solid rgba(240, 250, 244, 0.25);
  background: rgba(240, 250, 244, 0.06);
  color: var(--dark-text);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.25;
  transition: all 0.2s var(--ease-out);
}
.chip-sm { padding: 0.5rem 0.9rem; font-size: 0.86rem; }
.chip:hover { background: rgba(240, 250, 244, 0.12); }
.chip.is-selected {
  background: var(--pale);
  color: var(--dark-bg-2);
  border-color: var(--pale);
  font-weight: 700;
}

.commune-picker { margin-bottom: 0.9rem; }
.npa-resolved {
  font-size: 0.88rem;
  color: var(--pale);
  margin-bottom: 0.9rem;
  font-weight: 600;
}

/* ── Cartes personnes (étape 2) ──────────────────────────────── */
.people-cards {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}
.person-card {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.5rem;
  border-radius: 11px;
  background: rgba(240, 250, 244, 0.06);
  border: 1.5px solid rgba(240, 250, 244, 0.15);
}
.person-card label {
  font-size: 0.72rem;
  color: var(--dark-text-muted);
  white-space: nowrap;
}
.person-card input[type="number"] {
  width: 100%;
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  border-radius: 9px;
  border: 1.5px solid rgba(240, 250, 244, 0.2);
  background: rgba(240, 250, 244, 0.08);
  color: var(--dark-text);
  font-size: 0.95rem;
}
.person-card .person-age-class {
  font-size: 0.72rem;
  color: var(--pale);
  white-space: nowrap;
  min-width: 5em;
}
.person-card .person-remove {
  min-width: 44px;
  min-height: 44px;
  font-size: 1.2rem;
  color: var(--dark-text-muted);
  border-radius: 9px;
}
.person-card .person-remove:hover { color: #ffb4a8; }

.btn-ghost {
  display: inline-block;
  min-height: 44px;
  padding: 0.3rem 0.8rem;
  color: var(--pale);
  font-weight: 600;
  font-size: 0.86rem;
  margin-bottom: 0.3rem;
}

/* ── Modèles (étape 4) ───────────────────────────────────────── */
.model-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.model-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  border: 1.5px solid rgba(240, 250, 244, 0.18);
  background: rgba(240, 250, 244, 0.05);
  text-align: left;
  min-height: 44px;
  transition: all 0.2s var(--ease-out);
}
.model-card:hover { background: rgba(240, 250, 244, 0.1); }
.model-card.is-selected {
  border-color: var(--pale);
  background: rgba(194, 232, 206, 0.12);
}
.model-icon { color: var(--pale); width: 22px; }
.model-icon svg { width: 100%; height: auto; }
.model-name { font-weight: 700; font-size: 0.88rem; }
.model-desc { font-size: 0.72rem; color: var(--dark-text-muted); line-height: 1.3; }

/* ── Franchise (étape 5) ─────────────────────────────────────── */
.visit-frequency { margin-bottom: 0.5rem; }
.franchise-slider-wrap { margin-bottom: 0.5rem; }
#franchise-slider {
  width: 100%;
  height: 44px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  margin-bottom: 0.5rem;
}
#franchise-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(240, 250, 244, 0.2);
}
#franchise-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--pale);
  margin-top: -11px;
  border: 3px solid var(--dark-bg-2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
#franchise-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(240, 250, 244, 0.2);
}
#franchise-slider::-moz-range-thumb {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--pale);
  border: 3px solid var(--dark-bg-2);
}
.franchise-value {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--dark-text);
}
.franchise-suggestion {
  font-size: 0.8rem;
  color: var(--pale);
  margin-top: 0.3rem;
}

.live-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.live-stat {
  padding: 0.45rem 0.7rem;
  border-radius: 13px;
  background: rgba(240, 250, 244, 0.06);
  border: 1.5px solid rgba(240, 250, 244, 0.12);
}
.live-stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--dark-text-muted);
  margin-bottom: 0.2rem;
}
.live-stat-value {
  display: block;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.1rem;
}

/* ── Boutons ─────────────────────────────────────────────────── */
.btn-next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.65rem 1.75rem;
  border-radius: 999px;
  background: var(--pale);
  color: var(--dark-bg-2);
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 0.4rem;
  transition: transform 0.15s var(--ease-out), opacity 0.2s var(--ease-out);
  width: 100%;
}
@media (min-width: 480px) { .btn-next { width: auto; } }
.btn-next:not(:disabled):hover { transform: translateY(-2px); }
.btn-next:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Résultats ───────────────────────────────────────────────── */
.result-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.result-hero-figure { min-width: 160px; }
.result-hero-label {
  display: block;
  font-size: 0.78rem;
  color: var(--dark-text-muted);
  margin-bottom: 0.2rem;
}
.result-hero-value {
  display: block;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(1.5rem, 5vw, 2.4rem);
}
.result-hero-value-accent { color: var(--pale); }

.lead-form {
  background: rgba(240, 250, 244, 0.05);
  border: 1.5px solid rgba(240, 250, 244, 0.15);
  border-radius: 18px;
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.4rem;
}
.lead-form-intro { margin-bottom: 0.7rem; font-weight: 600; font-size: 0.92rem; }

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.3rem 0;
  font-size: 0.74rem;
  color: var(--dark-text-muted);
  line-height: 1.3;
}
.consent-row input[type="checkbox"] {
  width: 22px; height: 22px;
  flex-shrink: 0;
  margin-top: 0.1rem;
  accent-color: var(--pale);
}
.consent-row a { color: var(--pale); text-decoration: underline; }

.ranking-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
  /* Pas de scroll : la liste est paginée (voir .ranking-pagination), un
     nombre fixe de lignes par page tient toujours dans la carte. */
}

.ranking-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.ranking-pagination .btn-ghost { margin-bottom: 0; }
.ranking-pagination .btn-ghost:disabled { opacity: 0.3; cursor: not-allowed; }
.ranking-page-label { font-size: 0.82rem; color: var(--dark-text-muted); }
.ranking-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  background: rgba(240, 250, 244, 0.05);
  border: 1.5px solid rgba(240, 250, 244, 0.1);
}
.rank-number {
  font-family: var(--font-head);
  font-weight: 900;
  color: var(--dark-text-muted);
  margin-right: 0.6rem;
  min-width: 1.5em;
}
.rank-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 8px;
  background: #fff;
  margin-right: 0.7rem;
  overflow: hidden;
}
.rank-logo img { width: 20px; height: 20px; object-fit: contain; }
.rank-logo-placeholder {
  background: rgba(240, 250, 244, 0.12);
  color: var(--dark-text-muted);
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 0.8rem;
}
.ranking-list li.is-current-insurer {
  border-color: var(--pale);
}
.rank-name { flex: 1; font-weight: 600; }
.rank-current-badge {
  font-size: 0.7rem;
  color: var(--pale);
  margin-left: 0.5rem;
  font-weight: 600;
}
.rank-price {
  font-family: var(--font-head);
  font-weight: 700;
  white-space: nowrap;
}

.upsell-panel { text-align: center; }
.upsell-panel .step-back { margin-left: auto; margin-right: auto; }
.upsell-panel h2 { font-family: var(--font-head); font-weight: 900; margin-bottom: 0.6rem; font-size: 1.4rem; }
.upsell-panel p { color: var(--dark-text-muted); margin-bottom: 1.25rem; }

/* ── Sous-écrans de l'étape 7 (résultat / classement / contact / upsell) ──
   Même principe que .step : un seul visible à la fois, jamais de scroll
   (le contenu doit tenir dans la carte). */
.result-panel[hidden] { display: none; }
.result-panel h2 {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.1rem;
  margin: 0 0 0.6rem;
}

.comparateur-footer {
  max-width: 720px;
  margin: 2rem auto 0;
  padding: 0 1.25rem;
  font-size: 0.78rem;
  color: var(--dark-text-muted);
  text-align: center;
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ── Desktop (≥900px) : photo de fond + carte en verre dépoli ──
   Placé en fin de fichier exprès : à spécificité égale, la règle
   qui vient en dernier dans le fichier l'emporte. Avant ce
   déplacement, la règle .step-inner mobile (plus bas dans le
   fichier) écrasait silencieusement ce padding même sur desktop,
   ce qui faisait déborder le bouton « Retour » hors de la carte. */
@media (min-width: 900px) {
  .bg-photo-mobile { display: none; }

  .bg-photo {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 0;
    /* Voile neutre (pas vert) sur toute la photo : assombrit les zones
       claires (neige, ciel) pour qu'elles ne jurent pas à côté de
       l'interface sombre, plus appuyé en haut pour le logo/compte à
       rebours, sans recolorer la photo elle-même. */
    background-image:
      linear-gradient(180deg, rgba(8, 10, 10, 0.55) 0%, rgba(8, 10, 10, 0.3) 25%, rgba(8, 10, 10, 0.3) 75%, rgba(8, 10, 10, 0.55) 100%),
      url('../../assets/images/comparateur-bg-desktop.jpg');
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
    background-attachment: fixed, fixed;
  }

  /* Tout le contenu passe au-dessus de la photo */
  .compliance-banner,
  .progress-rail,
  .comparateur-header,
  #wizard,
  .comparateur-footer {
    position: relative;
    z-index: 1;
  }

  /* La zone où le visiteur remplit les étapes reste une carte pleine
     couleur (comme avant la photo) : lisible, jamais brouillonne. */
  .step-inner {
    /* Le flou est sur ::before (couche séparée), jamais sur l'élément qui
       porte la bordure + border-radius : c'est cette combinaison
       (bordure + backdrop-filter + coins arrondis sur le MÊME élément)
       qui provoque la tache sombre et le clignotement dans Safari. */
    position: relative;
    z-index: 0;
    border: 1.5px solid var(--red);
    border-radius: 22px;
    padding: 2.25rem 2.5rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  }
  .step-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: rgba(8, 10, 10, 0.32);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    will-change: backdrop-filter;
  }
  .step-inner-wide { padding: 3rem; }
}

/* ── Carte mobile (<900px) : flou léger + liseré ──────────────────────
   Placé ici (fin de fichier) exprès, pour la même raison que le bloc
   desktop ci-dessus : à spécificité égale, la règle la plus bas dans le
   fichier l'emporte. Avant ce déplacement, la règle .step-inner de base
   (plus haut, padding: 0.6rem 0) écrasait silencieusement ce padding,
   et le texte touchait le liseré — même bug que celui corrigé sur
   desktop, sur mobile cette fois. */
@media (max-width: 899.98px) {
  .step-inner {
    position: relative;
    z-index: 0;
    border: 1.5px solid var(--red);
    border-radius: 20px;
    padding: 1.1rem 1.25rem;
  }
  .step-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: rgba(8, 10, 10, 0.45);
    /* Flou plus léger qu'en desktop (8px contre 14px) : rendu plus sobre,
       plus économe sur un appareil mobile. */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    will-change: backdrop-filter;
  }
}
