:root {
  --bg: #f5f7fb;
  --primary: #f4a623;
  --primary-dark: #d88900;
  --text: #222;
  --text-light: #fff;
  --muted: #555;
  --border: #d0d7e2;
  --card-bg: #ffffff;
  --danger: #d32f2f;
  --success: #1b5e20;
  --focus-ring: 3px solid #000;
  --radius: 6px;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Accessibilité : Skip Link */
.skip-link {
  position: absolute;
  top: -9999px;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 9999;
  text-decoration: none;
  font-weight: bold;
}
.skip-link:focus { top: 0; }

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* --- HEADER --- */
.site-header {
  background: var(--primary);
  color: var(--text-light);
  padding: 1rem;
}

.header-main {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

.subtitle {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.95;
}

/* Lien discret header */
.link-like-header {
  margin-top: 0.5rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid #fff;
  color: #fff; 
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  font-weight: 600;
}
.link-like-header:hover {
  background: rgba(255,255,255,0.1);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  position: relative; /* Important pour le contexte */
}

/* --- MENU DÉROULANT (Fix Mobile) --- */
.dropdown-menu {
  position: relative;
  display: inline-block;
}

.dropdown-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.dropdown-btn:hover, .dropdown-btn:focus {
  background: rgba(255, 255, 255, 0.35);
  border-color: #fff;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  right: 0; 
  left: auto;
  background-color: #fff;
  min-width: 250px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-radius: 6px;
  z-index: 2000;
  overflow: hidden;
  margin-top: 0.5rem;
  border: 1px solid #ddd;
}

/* Style commun boutons et liens du menu */
.dropdown-content button,
.dropdown-content a {
  color: #333;
  padding: 0.8rem 1rem;
  text-decoration: none;
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.95rem;
  border-radius: 0;
  font-weight: normal;
  font-family: inherit;
  cursor: pointer;
  box-sizing: border-box;
}

.dropdown-content button:last-child,
.dropdown-content a:last-child { 
  border-bottom: none; 
}

.dropdown-content button:hover,
.dropdown-content a:hover {
  background-color: #f5f7fb;
  color: var(--primary-dark);
}

/* Menu ouvert */
.dropdown-menu:hover .dropdown-content {
  display: block;
}

/* --- Langues --- */
.lang-container {
  display: flex;
  align-items: center;
}
.lang-dropdown {
  appearance: none;
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.lang-dropdown:hover, .lang-dropdown:focus {
  background-color: rgba(255, 255, 255, 0.3);
  outline: none;
  border-color: #fff;
}
.lang-dropdown option {
  background-color: #fff;
  color: #333;
}

/* --- Bouton Erreur --- */
.error-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  background: #fff;
  color: var(--danger);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  white-space: nowrap;
}
.badge {
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  min-width: 1.2em;
  text-align: center;
}

/* --- Layout Principal --- */
.container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card h2 { margin-top: 0; font-size: 1.3rem; }

/* --- Contenu Interactif --- */
#answers-summary {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: #f0f4f8;
  border-left: 4px solid #3f51b5;
  border-radius: 4px;
}
.summary-item { margin-bottom: 0.5rem; font-size: 0.95rem; color: #333; }
.summary-label { font-weight: bold; }
.summary-value { font-style: italic; }

.form-group { margin-bottom: 1.5rem; border: none; padding: 0; margin: 0 0 1.5rem 0;}
legend {
  font-weight: 700;
  font-size: 1.1rem;
  /* Retirer la marge en bas de la légende pour la coller à l'aide */
  margin-bottom: 0; 
  display: block;
  line-height: 1.4;
}

/* --- NOUVEAU: Style du HelpText affiché sous la question --- */
.help-box {
    background: #fffdf7; 
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 0.8rem;
    margin-top: 0.8rem; /* Espace entre la question et l'aide */
    margin-bottom: 1.5rem; /* Espace avant les options */
    font-size: 0.9rem;
    line-height: 1.4;
    color: #444;
}
.help-box p {
    margin: 0 0 0.5rem 0;
}
.help-box p:last-child {
    margin-bottom: 0;
}
.help-box a {
    color: var(--primary-dark);
    text-decoration: underline;
    font-weight: 600;
    display: inline-block;
}

/* Retirer le style de l'icône, car elle est supprimée de UI.js */
.info-icon { display: none; }
/* Retirer le conteneur du positionnement, car il n'est plus utile */
.question-container {
    position: initial; 
    margin-bottom: 0;
}
/* --- FIN NOUVEAU: Style du HelpText --- */

.radio-group { display: flex; flex-direction: column; gap: 0.8rem; }

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.8rem;
  border: 1px solid #eee;
  border-radius: 4px;
  background: #fdfdfd;
}
.radio-option:hover { background: #f4f4f4; }
.radio-option:focus-within { border-color: var(--primary); background: #fffaf0; }

input[type="radio"] {
  margin-top: 0.25rem;
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
label { cursor: pointer; width: 100%; }

/* --- Boutons --- */
.buttons {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  border-top: 1px solid #eee;
  padding-top: 1rem;
  flex-wrap: wrap; 
}
button.secondary {
  background: #e0e0e0;
  color: #333;
  border: none;
  padding: 0.8rem 1.2rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  flex: 1; 
}
button.secondary:hover:not(:disabled) { background: #d0d0d0; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  font-weight: bold;
  cursor: pointer;
  width: 100%; 
}
@media(min-width: 600px) {
    .btn-primary { width: auto; }
}

/* --- Résultats --- */
.result {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 6px;
  animation: fadeIn 0.3s ease;
}
.result--ok { background: #e8f5e9; border: 1px solid #c8e6c9; color: #1b5e20; }
.result--ko { background: #ffebee; border: 1px solid #ffcdd2; color: #b71c1c; }
.result--alert { background: #fffbe5; border: 1px solid #ffeb3b; color: #795548; }
.result-title { margin-top: 0; }

/* --- Form Contact --- */
.link-standard { color: #0056b3; text-decoration: underline; }
input[type="email"], textarea {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-top: 0.3rem;
  font-size: 1rem;
}

/* --- Modales --- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.overlay-content {
  background: #fff;
  padding: 1.5rem;
  max-width: 600px;
  width: 100%;
  border-radius: 8px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.large-modal { max-width: 800px; }

.close-modal-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 2rem;
  color: #666;
  cursor: pointer;
  padding: 0.2rem 0.6rem;
  line-height: 1;
  z-index: 10;
}
.close-modal-btn:hover { color: #000; }

.scrollable-content {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
  min-width: 400px;
}
.info-table th, .info-table td {
  border: 1px solid #ddd;
  padding: 0.6rem;
  text-align: left;
}
.info-table th { background-color: #f0f4f8; font-weight: bold; }

.subcategory-card {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fff;
}
.subcategory-card h3 {
  margin-top: 0;
  color: var(--primary-dark);
  border-bottom: 2px solid #eee;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}
.subcategory-card ul { padding-left: 1.2rem; margin-bottom: 0; }


/* --- Footer & Support --- */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 2rem 1rem;
  background-color: #f0f2f5;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer-actions {
  margin-bottom: 1rem;
}

.support-btn {
  display: inline-block;
  background-color: #fff;
  color: #333;
  border: 1px solid #ccc;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  transition: all 0.2s ease;
}

.support-btn:hover {
  background-color: #ffe0b2;
  border-color: var(--primary);
  color: #d88900;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.link-like-footer {
  margin-top: 0.5rem;
  background: none;
  border: none;
  color: #666;
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
}
.link-like-footer:hover { color: #000; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 700px) {
  .header-main {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .header-right {
    width: 100%;
    justify-content: space-between;
    margin-top: 0.8rem;
    flex-wrap: wrap;
  }

  .dropdown-content {
    right: auto;
    left: 0;
    min-width: 250px;
  }

  .site-header h1 { font-size: 1.3rem; }
  .card { padding: 1rem; }
  
  #error-btn-label { display: none; }
  .error-btn::after { content: "Erreur ?"; font-size: 0.8rem; }
  
  .buttons { flex-direction: column; }
  button.secondary { width: 100%; }
}

@media (max-width: 380px) {
    .dropdown-content {
        position: fixed;
        top: auto;
        left: 1rem;
        right: 1rem;
        width: auto;
        min-width: 0;
        z-index: 3000;
        box-shadow: 0 0 20px rgba(0,0,0,0.2);
    }
}

/* NOUVEAUX STYLES POUR LA SECTION DE LOCALISATION */

#location-check {
    padding: 1.5rem;
    margin-top: 1.5rem;
}

#geo-status {
    color: #444;
    font-size: 0.85rem;
    padding-top: 5px;
}

.location-postcode {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.location-postcode .postcode-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#postcode-label {
  min-width: 110px;
}

.postcode-input {
  width: 160px;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
}

.postcode-meta {
  color: var(--text);
}

#commune-name {
  font-weight: 700;
}

.postcode-hint {
  color: var(--muted);
}

@media (max-width: 480px) {
  .location-postcode .postcode-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  #postcode-label {
    min-width: 0;
  }
  .postcode-input {
    width: 100%;
  }
}

.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Carte Géoportail intégrée */
.location-map {
  position: relative;
  margin-top: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-bg);
}

.location-map #geoportail-map {
  width: 100%;
  height: 420px;
}

/* Repère du point exact (centre de la carte) */
.location-map .map-center-marker {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border: none;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
  z-index: 500;
  opacity: 0.75;
}

.location-map .map-center-marker::before,
.location-map .map-center-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: var(--muted);
  transform: translate(-50%, -50%);
}

.location-map .map-center-marker::before {
  width: 18px;
  height: 2px;
}

.location-map .map-center-marker::after {
  width: 2px;
  height: 18px;
}

/* Leaflet : boutons de zoom plus pratiques (mobile) */
.location-map .leaflet-control-zoom {
  border: none;
}

.location-map .leaflet-control-zoom a {
  width: 44px;
  height: 44px;
  line-height: 44px;
  font-size: 22px;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  opacity: 0.75;
  box-shadow: var(--shadow);
}

.location-map .leaflet-control-zoom a:active,
.location-map .leaflet-control-zoom a:focus,
.location-map .leaflet-control-zoom a:hover {
  opacity: 0.95;
}

@media (max-width: 600px) {
  .location-map .leaflet-control-zoom a {
    width: 52px;
    height: 52px;
    line-height: 52px;
    font-size: 26px;
    opacity: 0.7;
  }
}

.location-restrictions {
  margin-top: 15px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
}

.location-restrictions ul {
  margin: 10px 0 0 18px;
  padding: 0;
}

.location-restrictions li {
  margin: 4px 0;
}

.restrictions-legend {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
}

.restrictions-legend .legend-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.restrictions-legend .legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.restrictions-legend .legend-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.restrictions-legend .legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

/* Couleurs de la légende (basées sur les tokens existants) */
/*
  Couleurs en HEX (ajustables) pour coller à la légende officielle.
  Elles n'affectent QUE la légende (pas le thème global).
*/
.restrictions-legend .legend-swatch--nofly { background: #E31A1C; } /* rouge */
.restrictions-legend .legend-swatch--h30 { background: #fa8a91; }  /* brun/orange */
.restrictions-legend .legend-swatch--h50 { background: #ffaa45; }  /* orange */
.restrictions-legend .legend-swatch--h60 { background: #fed650; }  /* jaune */
.restrictions-legend .legend-swatch--h100 { background: #fbf16b; } /* jaune */
.restrictions-legend .legend-swatch--h120 { background: #ffffff00; } /* transparent */

.restrictions-legend .legend-note {
  margin-top: 8px;
  color: var(--muted);
}
/* FIN NOUVEAUX STYLES */