:root {
  --tunnel-primaire: #1a3c6e;
  --tunnel-primaire-clair: #2d5aa0;
  --tunnel-accent: #e8952f;
  --tunnel-fond: #f5f7fa;
  --tunnel-texte: #2c2c2c;
  --tunnel-texte-clair: #6b7280;
  --tunnel-bordure: #e2e5ea;
  --tunnel-succes: #2e9e5b;
  --tunnel-rayon: 14px;
  --tunnel-ombre: 0 8px 24px rgba(26, 60, 110, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--tunnel-fond);
  color: var(--tunnel-texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
}

.tunnel-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 0;
}

.tunnel-etape-label {
  font-weight: 700;
  color: var(--tunnel-primaire);
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.tunnel-progress {
  height: 6px;
  background: #dfe4ec;
  border-radius: 3px;
  overflow: hidden;
}

.tunnel-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--tunnel-primaire), var(--tunnel-primaire-clair));
  transition: width 0.4s ease;
}

/* Layout 2 colonnes : formulaire + carte persistante.
   Mobile : carte au-dessus (column-reverse inverse l'ordre visuel
   sans toucher au DOM), formulaire en dessous. */
.tunnel-layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  display: flex;
  flex-direction: column-reverse;
  gap: 24px;
}

.tunnel-colonne-form {
  flex: 1 1 auto;
  min-width: 0;
}

.tunnel-colonne-carte {
  flex: 1 1 auto;
  min-width: 0;
}

.tunnel-step {
  display: none;
  animation: tunnel-fade-in 0.35s ease;
}

.tunnel-step.active {
  display: block;
}

@keyframes tunnel-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.tunnel-titre {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--tunnel-primaire);
  margin-bottom: 6px;
}

.tunnel-soustitre {
  color: var(--tunnel-texte-clair);
  margin-bottom: 24px;
}

.tunnel-facultatif {
  color: var(--tunnel-texte-clair);
  font-weight: 400;
  font-size: 1rem;
}

/* Navigation bas de sous-étape : "Retour" à gauche, action principale à droite */
.tunnel-etape-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--tunnel-bordure);
}

.tunnel-etape-nav .tunnel-btn {
  width: auto;
  min-width: 160px;
}

.tunnel-retour {
  background: none;
  border: none;
  color: var(--tunnel-texte-clair);
  font-weight: 600;
  cursor: pointer;
  padding: 10px 4px;
}

.tunnel-retour:hover {
  color: var(--tunnel-primaire);
}

.tunnel-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  cursor: pointer;
}

.tunnel-checkbox input {
  width: 18px;
  height: 18px;
}

/* Sélecteurs visuels (type de bien, état général) */
.tunnel-choix-grille {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.tunnel-choix-grille-3 {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 480px) {
  .tunnel-choix-grille-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tunnel-choix {
  border: 2px solid var(--tunnel-bordure);
  border-radius: var(--tunnel-rayon);
  background: #fff;
  padding: 18px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.tunnel-choix:hover {
  border-color: var(--tunnel-primaire-clair);
  transform: translateY(-2px);
}

.tunnel-choix.selected {
  border-color: var(--tunnel-primaire);
  background: #eef3fb;
}

.tunnel-choix .icone {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 6px;
}

.tunnel-choix .label {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Champs de formulaire */
.tunnel-champ {
  margin-bottom: 18px;
}

.tunnel-champ label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.tunnel-champ input,
.tunnel-champ select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--tunnel-bordure);
  border-radius: 10px;
  font-size: 1rem;
}

.tunnel-champ input:focus,
.tunnel-champ select:focus {
  outline: none;
  border-color: var(--tunnel-primaire-clair);
}

.tunnel-champ-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Autocomplétion adresse */
.tunnel-autocomplete {
  position: relative;
}

.tunnel-suggestions {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--tunnel-bordure);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: var(--tunnel-ombre);
  max-height: 220px;
  overflow-y: auto;
}

.tunnel-suggestions button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.92rem;
}

.tunnel-suggestions button:hover {
  background: var(--tunnel-fond);
}

#tunnelCarte {
  position: relative;
  z-index: 0;
  height: 260px;
  border-radius: var(--tunnel-rayon);
  border: 1px solid var(--tunnel-bordure);
  background: #e9edf3;
}

.tunnel-carte-placeholder {
  height: 260px;
  border-radius: var(--tunnel-rayon);
  border: 1px solid var(--tunnel-bordure);
  background: #e9edf3;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: var(--tunnel-texte-clair);
}

/* Leaflet met ses panneaux/contrôles à z-index jusqu'à 1000 par défaut,
   ce qui passe au-dessus du menu du site (sticky/fixed) au scroll.
   On les recale bien en dessous, en gardant leur ordre interne. */
#tunnelCarte .leaflet-pane { z-index: 1; }
#tunnelCarte .leaflet-tile-pane { z-index: 1; }
#tunnelCarte .leaflet-overlay-pane { z-index: 2; }
#tunnelCarte .leaflet-shadow-pane { z-index: 3; }
#tunnelCarte .leaflet-marker-pane { z-index: 4; }
#tunnelCarte .leaflet-tooltip-pane { z-index: 5; }
#tunnelCarte .leaflet-popup-pane { z-index: 6; }
#tunnelCarte .leaflet-control { z-index: 7; }
#tunnelCarte .leaflet-top,
#tunnelCarte .leaflet-bottom { z-index: 8; }

/* Bloc DVF secteur */
.tunnel-bloc-secteur {
  background: #fff;
  border-radius: var(--tunnel-rayon);
  box-shadow: var(--tunnel-ombre);
  padding: 18px;
  margin-bottom: 20px;
}

.tunnel-bloc-secteur .chiffre {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--tunnel-primaire);
}

/* Étape 3 : résultat */
.tunnel-resultat {
  background: linear-gradient(135deg, var(--tunnel-primaire), var(--tunnel-primaire-clair));
  color: #fff;
  border-radius: var(--tunnel-rayon);
  padding: 28px 20px;
  text-align: center;
  margin-bottom: 20px;
}

.tunnel-resultat .fourchette {
  font-size: 2rem;
  font-weight: 800;
  margin: 8px 0;
}

.tunnel-resultat .details {
  font-size: 0.9rem;
  opacity: 0.9;
}

.tunnel-choix-parcours {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

/* Fiche agent */
.tunnel-fiche-agent {
  background: #fff;
  border-radius: var(--tunnel-rayon);
  box-shadow: var(--tunnel-ombre);
  padding: 20px;
  text-align: center;
}

.tunnel-fiche-agent img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
}

.tunnel-fiche-agent .nom {
  font-weight: 700;
  font-size: 1.1rem;
}

.tunnel-fiche-agent .certifications {
  color: var(--tunnel-texte-clair);
  font-size: 0.85rem;
  margin: 4px 0 10px;
}

.tunnel-fiche-agent .actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.tunnel-fiche-agent .actions .btn {
  flex: 1;
}

/* Boutons */
.tunnel-btn {
  display: inline-block;
  width: 100%;
  padding: 14px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.tunnel-btn-primaire {
  background: var(--tunnel-accent);
  color: #fff;
}

.tunnel-btn-primaire:hover {
  background: #d1811f;
  color: #fff;
}

.tunnel-btn-secondaire {
  background: #fff;
  color: var(--tunnel-primaire);
  border-color: var(--tunnel-primaire);
}

.tunnel-btn-secondaire:hover {
  background: var(--tunnel-fond);
}

.tunnel-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tunnel-erreur {
  color: #c0392b;
  font-size: 0.85rem;
  margin-top: 6px;
  display: none;
}

.tunnel-erreur.visible {
  display: block;
}

.tunnel-confirmation {
  text-align: center;
  padding: 40px 20px;
}

.tunnel-confirmation .icone {
  font-size: 3rem;
  color: var(--tunnel-succes);
  margin-bottom: 16px;
}

@media (min-width: 576px) {
  .tunnel-choix-parcours {
    flex-direction: row;
  }

  .tunnel-choix-parcours .tunnel-btn {
    width: auto;
    flex: 1;
  }
}

@media (min-width: 992px) {
  .tunnel-layout {
    flex-direction: row;
    align-items: flex-start;
  }

  .tunnel-colonne-form {
    flex: 0 0 44%;
    max-width: 44%;
  }

  .tunnel-colonne-carte {
    flex: 1 1 56%;
  }

  #tunnelCarte,
  .tunnel-carte-placeholder {
    height: calc(100vh - 220px);
    min-height: 420px;
  }

  .tunnel-btn {
    width: auto;
  }
}
