/*
 * Sunu Sanar — base styles (socle minimal neuf)
 * Mobile-first. UGB colour: #1a6b3c.
 */

* { box-sizing: border-box; }

:root {
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
}

html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1a1a1a;
  -webkit-text-size-adjust: 100%;
}

/* --- Accessibilité : skip-link et focus visibles --- */

.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  background: #1a6b3c;
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  z-index: 3000;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 12px;
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Focus rings visibles uniquement au clavier (pas en clic souris). */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid #1a6b3c;
  outline-offset: 2px;
  border-radius: 6px;
}
/* Sur fond vert UGB, l'outline vert n'est pas lisible — on bascule en blanc. */
#topbar :focus-visible,
.panel-header :focus-visible,
#route-banner :focus-visible {
  outline-color: #ffffff;
}

body {
  display: flex;
  flex-direction: column;
}

#offline-banner {
  background: #f59e0b;
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  text-align: center;
  z-index: 1100;
}
#offline-banner[hidden] { display: none; }

#demo-banner {
  background: #7c3aed;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  text-align: center;
  z-index: 1100;
}
#demo-banner[hidden] { display: none; }

#topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) calc(14px + var(--safe-right)) 10px calc(14px + var(--safe-left));
  background: #1a6b3c;
  color: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

#topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

#status {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.85;
}

/* --- Search bar --- */

.sunu-search {
  position: relative;
  padding: 8px 12px;
  background: #ffffff;
  border-bottom: 1px solid #e2e2e2;
  z-index: 999;
}

#search-input {
  width: 100%;
  height: 40px;
  padding: 0 96px 0 14px;
  border: 1px solid #d0d0d0;
  border-radius: 22px;
  font-size: 15px;
  font-family: inherit;
  background: #f5f5f5;
  transition: border-color 0.15s, background 0.15s;
}
#search-input:focus {
  outline: none;
  border-color: #1a6b3c;
  background: #ffffff;
}
#search-input::-webkit-search-cancel-button { display: none; }

#search-clear {
  display: none;
  position: absolute;
  right: 64px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  background: #d0d0d0;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
}
#search-clear:hover { background: #999; }

#search-nearby {
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: #ffffff;
  color: #1a6b3c;
  font-size: 18px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}
#search-nearby:hover { background: #eef6f1; }
#search-nearby[data-state="loading"] {
  animation: locatePulse 1s ease-in-out infinite;
}
#search-nearby[data-state="active"] {
  background: #1a6b3c;
  color: #ffffff;
}

#search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  max-height: 60vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.sunu-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.sunu-result:last-child { border-bottom: none; }
.sunu-result:hover,
.sunu-result.active { background: #eef6f1; }

.sunu-result-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  font-size: 16px;
}

.sunu-result-text { min-width: 0; }
.sunu-result-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sunu-result-name mark {
  background: #fff3a8;
  color: #1a1a1a;
  border-radius: 3px;
  padding: 0 1px;
}
.sunu-result-cat {
  font-size: 12px;
  color: #666;
}
.sunu-result-empty {
  padding: 14px;
  color: #888;
  font-size: 14px;
  text-align: center;
}

.sunu-result-header {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #1a6b3c;
  background: #f5fafb;
  border-bottom: 1px solid #e2e2e2;
}

.sunu-result-dist {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1a6b3c;
  background: #e8f4ec;
  border-radius: 12px;
}

/* --- Route active banner --- */

#route-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #1a6b3c;
  color: #ffffff;
  z-index: 990;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
#route-banner[hidden] { display: none; }

.route-banner-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 1.2;
  min-width: 0;
}
.route-banner-info strong {
  font-size: 15px;
  font-weight: 700;
}
.route-banner-icon { font-size: 18px; }

#route-banner-clear {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 18px;
  cursor: pointer;
  font-family: inherit;
}
#route-banner-clear:hover { background: rgba(255, 255, 255, 0.3); }

/* --- Quick-shortcuts (4 catégories clés) --- */

.sunu-shortcuts {
  display: flex;
  gap: 8px;
  padding: 8px 12px 10px;
  overflow-x: auto;
  background: #ffffff;
  border-bottom: 1px solid #e2e2e2;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sunu-shortcuts::-webkit-scrollbar { display: none; }

.sunu-shortcuts button {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid #d8e2dc;
  border-radius: 20px;
  background: #f5f8f6;
  color: #1a6b3c;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  -webkit-tap-highlight-color: transparent;
}
.sunu-shortcuts button:hover { background: #eef6f1; }
.sunu-shortcuts button:active { transform: scale(0.96); }
.sunu-shortcuts button[data-empty="true"] {
  opacity: 0.55;
  border-style: dashed;
}

/* --- Map area --- */

#map {
  flex: 1;
  width: 100%;
  background: #e8e4dc;
  position: relative;
}

/* Spinner centré pendant le boot (body.is-loading appliqué via index.html,
   retiré par app.js après le premier rendu). */
body.is-loading #map::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -22px 0 0 -22px;
  width: 44px;
  height: 44px;
  border: 4px solid rgba(26, 107, 60, 0.2);
  border-top-color: #1a6b3c;
  border-radius: 50%;
  animation: mapSpin 0.9s linear infinite;
  z-index: 200;
  pointer-events: none;
}
@keyframes mapSpin { to { transform: rotate(360deg); } }

/* --- Locate (GPS) button --- */

#locate-btn {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  right: calc(16px + var(--safe-right));
  width: 52px;
  height: 52px;
  border-radius: 26px;
  background: #ffffff;
  border: 2px solid #1a6b3c;
  color: #1a6b3c;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  z-index: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
#locate-btn:hover { background: #f1f7f3; }

/* Bouton flottant « 👁️ Masquer l'interface » en bas-gauche.
   Toggle body.ui-min — cache topbar / search / shortcuts pour vue propre.
   Reste accessible pour rallumer. */
#ui-min-btn {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: calc(16px + var(--safe-left));
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #1a6b3c;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  z-index: 500;
  -webkit-tap-highlight-color: transparent;
  opacity: 0.85;
}
#ui-min-btn:hover { opacity: 1; background: #fff; }
#ui-min-btn[aria-pressed="true"] {
  background: #1a6b3c;
  color: #fff;
  border-color: #1a6b3c;
}

/* Mode UI minimaliste : cache barre/recherche/raccourcis/bandeau pour
   contemplation ou screenshot. Carte + locate + 👁️ uniquement. */
body.ui-min #topbar,
body.ui-min .sunu-search,
body.ui-min .sunu-shortcuts,
body.ui-min #route-banner,
body.ui-min #place-panel,
body.ui-min #offline-banner,
body.ui-min #demo-banner { display: none !important; }

/* Mode entretien : affiche l'identifiant du lieu sur chaque marker.
   Aide à corriger un POI mal nommé / mal placé sans ouvrir la fiche. */
body.mode-maint .place-pin::before {
  content: attr(data-id);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  background: rgba(15, 20, 25, 0.85);
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
}
#locate-btn[data-state="loading"] {
  animation: locatePulse 1s ease-in-out infinite;
}
#locate-btn[data-state="active"] {
  background: #1a6b3c;
  color: #ffffff;
}
#locate-btn[data-state="error"] {
  border-color: #c0392b;
  color: #c0392b;
}
@keyframes locatePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(0.92); }
}

/* GPS user dot + accuracy circle */
.gps-dot {
  width: 16px;
  height: 16px;
  background: #2196f3;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(33, 150, 243, 0.4);
  position: relative;
}
.gps-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(33, 150, 243, 0.5);
  animation: gpsHalo 2s ease-out infinite;
}
/* Flèche heading (apparait quand l'utilisateur se déplace réellement). */
.gps-dot::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-bottom: 2px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 10px solid #2196f3;
  transform-origin: 50% calc(100% + 9px);
  transform: translateX(-50%) rotate(var(--heading, 0deg));
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
  opacity: 0;
  transition: opacity 0.25s, transform 0.3s;
}
.gps-dot.has-heading::before { opacity: 1; }
@keyframes gpsHalo {
  0%   { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Position GPS vieille (> 60s sans nouveau fix) : dot orange, halo coupé,
   flèche heading colorée orange aussi. Signal honnête à l'utilisateur que
   sa position affichée n'est plus garantie à jour. */
.gps-dot.stale {
  background: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.45);
}
.gps-dot.stale::after { animation: none; opacity: 0; }
.gps-dot.stale::before { border-bottom-color: #f59e0b; }

/* Petit liseré orange autour du bouton locate quand position stale. */
#locate-btn[data-stale="1"] {
  box-shadow: 0 0 0 2px #f59e0b, 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Pastille qualitative de précision GPS en haut-droite du bouton locate.
   🟢 good <20m · 🟡 med 20-50m · 🔴 bad >50m. Lecture honnête immédiate. */
#locate-btn[data-acc] {
  position: relative;
}
#locate-btn[data-acc]::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}
#locate-btn[data-acc="good"]::after { background: #22c55e; }
#locate-btn[data-acc="med"]::after  { background: #f59e0b; }
#locate-btn[data-acc="bad"]::after  { background: #ef4444; }

/* Route mid-segment distance + duration bubble (clickable to clear). */
.route-label {
  background: #1a6b3c;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.route-label:hover { background: #155a32; }

/* Permanent labels next to markers, only visible at high zoom
   (controlled by body.show-labels class toggled by map zoomend). */
.leaflet-tooltip.place-label {
  display: none;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #1a6b3c;
  color: #1a3a2a;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}
.leaflet-tooltip.place-label::before { display: none; }
body.show-labels .leaflet-tooltip.place-label { display: block; }

/* Tooltip mainteneur sur chemin (tap / hover sur LineString) : compact, mono.
   Affiche `pa_id · type/surface ⚠️ ISOLÉ` pour identifier rapidement quel
   tronçon corriger dans QGIS. */
.leaflet-tooltip.path-tooltip {
  background: rgba(15, 20, 25, 0.92);
  color: #f5f5f5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 3px 7px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
.leaflet-tooltip.path-tooltip::before { display: none; }

/* Place pin (emoji marker) */
.place-pin {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: #ffffff;
  border: 2px solid #1a6b3c;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s;
  position: relative;  /* ancre les badges enfants (fav star, maint id) */
}
.place-pin.pulsing {
  animation: placePulse 0.7s ease-out 2;
}
/* Flash visuel court au tap — feedback immédiat sur mobile. */
.place-pin.tap-flash {
  animation: placeTapFlash 0.22s ease-out;
}
@keyframes placeTapFlash {
  0%   { transform: scale(1);    filter: brightness(1); }
  40%  { transform: scale(1.25); filter: brightness(1.4); }
  100% { transform: scale(1);    filter: brightness(1); }
}

/* Étoile dorée en haut-droite des markers favoris. */
.place-pin.has-fav { position: relative; }
.place-pin.has-fav::after {
  content: "★";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  background: #f59e0b;
  color: #fff;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}
@keyframes placePulse {
  0%   { transform: scale(1);   box-shadow: 0 0 0 0 rgba(26, 107, 60, 0.55); }
  60%  { transform: scale(1.35); box-shadow: 0 0 0 14px rgba(26, 107, 60, 0); }
  100% { transform: scale(1);   box-shadow: 0 0 0 0 rgba(26, 107, 60, 0); }
}

/* Leaflet popup polish */
.leaflet-popup-content {
  margin: 8px 10px;
  font-size: 13px;
  line-height: 1.35;
}
.leaflet-popup-content strong { font-size: 14px; }
.leaflet-popup-content small { color: #666; }

/* --- Place detail panel (bottom sheet mobile / right panel desktop) --- */

#place-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 70vh;
  background: #ffffff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  transform: translateY(105%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  z-index: 600;
  overflow: hidden;
}
#place-panel.open { transform: translateY(0); }

.panel-handle {
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.panel-handle::before {
  content: "";
  width: 40px;
  height: 4px;
  background: #d0d0d0;
  border-radius: 2px;
}
.panel-handle:active { cursor: grabbing; }
.panel-handle:active::before { background: #1a6b3c; }

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: #ffffff;
}
.panel-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.panel-title { min-width: 0; flex: 1; }
.panel-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-cat {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 2px;
}
#panel-close {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
#panel-close:hover { background: rgba(255, 255, 255, 0.35); }

/* État loading générique pour les boutons async (clipboard, share…). */
.btn-loading {
  pointer-events: none;
  opacity: 0.55;
  cursor: progress;
  animation: btnLoadingPulse 0.9s ease-in-out infinite;
}
@keyframes btnLoadingPulse {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.85; }
}

/* Pulse du drag-handle à la 1re ouverture du panel (hint geste fermer). */
.panel-handle.hint-pulse {
  animation: handleHint 1.2s ease-in-out 2;
}
@keyframes handleHint {
  0%, 100% { transform: translateY(0);   opacity: 0.6; }
  50%      { transform: translateY(4px); opacity: 1.0; }
}

/* Flèches ← → pour parcourir alphabétiquement les places depuis la fiche.
   Petites, discrètes, à côté du bouton fermer. */
.panel-nav-arrows {
  display: flex;
  gap: 4px;
  margin-right: 6px;
}
.panel-nav-arrows button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.panel-nav-arrows button:hover { background: rgba(255, 255, 255, 0.32); }

.panel-body {
  padding: 14px 16px 4px;
  overflow-y: auto;
}
.panel-desc { margin: 0 0 10px; color: #333; font-size: 14px; line-height: 1.45; }
.panel-meta { margin: 6px 0; font-size: 13px; color: #555; }
.panel-wolof { font-style: italic; color: #1a6b3c; }
.panel-maps a {
  color: #1a6b3c;
  font-weight: 600;
  text-decoration: none;
}
.panel-maps a:hover { text-decoration: underline; }

/* Lien « ✉️ Signaler une correction » discret en bas de la fiche.
   Encourage les retours utilisateurs sans interrompre. */
.panel-fix {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
  font-size: 12px;
  text-align: center;
}
.panel-fix a {
  color: #777;
  text-decoration: none;
}
.panel-fix a:hover { color: #1a6b3c; text-decoration: underline; }

/* Bloc "Près d'ici" dans la fiche : top 3 voisins < 200m, cliquables.
   Aide à explorer le campus en sautant de lieu en lieu sans repasser
   par la recherche. */
.panel-nearby {
  margin: 14px 0 4px;
  padding-top: 12px;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
}
.panel-nearby-title {
  font-size: 12px;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.nearby-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fafafa;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-align: left;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.06);
}
.nearby-item:hover, .nearby-item:focus-visible {
  background: #f1f5f3;
  border-color: #1a6b3c;
  outline: none;
}
.nearby-ico {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; flex-shrink: 0;
}
.nearby-name { flex: 1; font-size: 13px; color: #222; }
.nearby-dist { font-size: 12px; color: #777; font-variant-numeric: tabular-nums; }

.panel-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid #f0f0f0;
}
.panel-actions button {
  flex: 1;
  padding: 12px 14px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.panel-actions .cta {
  flex: 2;
  background: #1a6b3c;
  color: #ffffff;
}
.panel-actions .cta:hover { background: #155a32; }
.panel-actions .ghost {
  background: #ffffff;
  color: #1a6b3c;
  border: 1.5px solid #1a6b3c;
}
.panel-actions .ghost:hover { background: #f1f7f3; }
.panel-actions .icon-only {
  flex: 0 0 48px;
  padding: 12px 0;
  font-size: 17px;
}
.panel-actions .ghost[aria-pressed="true"] {
  background: #fff8e6;
  border-color: #f59e0b;
  color: #b45309;
}

@media (min-width: 720px) {
  #place-panel {
    left: auto;
    right: 16px;
    bottom: 16px;
    top: auto;
    width: 360px;
    max-height: calc(100vh - 120px);
    border-radius: 16px;
    transform: translateY(0) translateX(110%);
  }
  #place-panel.open { transform: translateY(0) translateX(0); }
  #place-panel .panel-handle { display: none; }
}

/* --- Topbar info button --- */

#info-btn,
#dir-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
#info-btn:hover,
#dir-btn:hover { background: rgba(255, 255, 255, 0.3); }
#dir-btn { font-size: 18px; }

/* --- Generic overlay (info / about) --- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 50, 35, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2000;
  animation: fadeIn 0.18s ease-out;
}
.overlay[hidden] { display: none; }

.overlay-card {
  position: relative;
  background: #ffffff;
  border-radius: 18px;
  padding: 24px 22px 18px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.overlay-card h2 {
  margin: 0 0 6px;
  color: #1a6b3c;
  font-size: 20px;
  font-weight: 700;
}
.overlay-sub {
  margin: 0 0 14px;
  color: #555;
  font-size: 13px;
  line-height: 1.45;
}
.overlay-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 16px;
  background: #f2f2f2;
  color: #444;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.overlay-close:hover { background: #e6e6e6; }

.overlay-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 12px;
  row-gap: 4px;
  margin: 0 0 12px;
  font-size: 13px;
}
.overlay-meta dt { color: #777; }
.overlay-meta dd { margin: 0; color: #1a1a1a; font-weight: 600; }

.overlay-meta-block {
  font-size: 13px;
  color: #444;
  line-height: 1.5;
  margin: 8px 0;
}
.overlay-meta-block a { color: #1a6b3c; text-decoration: none; }
.overlay-meta-block a:hover { text-decoration: underline; }
.overlay-credit {
  font-size: 12px;
  color: #777;
  padding-top: 8px;
  border-top: 1px dashed #e2e2e2;
  margin-top: 8px;
}

.panel-meta a {
  color: #1a6b3c;
  font-weight: 600;
  text-decoration: none;
}
.panel-meta a:hover { text-decoration: underline; }

.info-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}
.info-action {
  background: #f7faf8;
  color: #1a6b3c;
  border: 1px solid #d8e2dc;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.info-action:hover { background: #eaf3ee; }
.info-action.info-danger {
  border-color: #f5b5b5;
  color: #b91c1c;
  background: #fef5f5;
  margin-top: 4px;
}
.info-action.info-danger:hover { background: #fde8e8; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 8px 0 12px;
}
.stats-grid > div {
  text-align: center;
  padding: 8px 4px;
  background: #f5f8f6;
  border-radius: 10px;
}
.stats-grid span {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #1a6b3c;
  line-height: 1.1;
}
.stats-grid small {
  font-size: 10px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Barre de progression « X/30 lieux · 37% » dans info modal. Donne à
   l'utilisateur (et au mainteneur) une lecture rapide de l'avancée. */
.trace-bar {
  display: inline-block;
  width: 80px;
  height: 6px;
  background: rgba(26, 107, 60, 0.15);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 8px;
}
.trace-bar > span {
  display: block;
  height: 100%;
  background: #1a6b3c;
  transition: width 0.3s ease;
}
.trace-ratio {
  font-size: 12px;
  color: #555;
  vertical-align: middle;
}

/* Ligne « 🔥 Série : X jours d'affilée » (streak). */
.info-streak {
  margin: 4px 0 8px;
  font-size: 13px;
  color: #c2410c;
  text-align: center;
  font-weight: 600;
}

/* Ligne « 🚶 X km parcourus · Y min à pied (cumul) » sous la grille. */
.info-cumul {
  margin: 4px 0 8px;
  font-size: 13px;
  color: #1a6b3c;
  text-align: center;
  font-weight: 500;
}

/* Bouton 🔗 partage itinéraire dans le bandeau route. */
#route-banner-share,
#route-banner-recalc,
#route-banner-fit {
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  font-size: 14px;
  cursor: pointer;
  margin-right: 4px;
}
#route-banner-share:hover,
#route-banner-recalc:hover,
#route-banner-fit:hover { background: rgba(255, 255, 255, 0.32); }

/* Ligne « 🏆 Ton lieu favori : <nom> (X ouvertures) » sous la grille. */
.info-top-place {
  margin: 4px 0 12px;
  font-size: 13px;
  color: #1a6b3c;
  text-align: center;
  font-weight: 500;
}
.info-top-cats {
  margin: -4px 0 12px;
  font-size: 12px;
  color: #555;
  text-align: center;
  line-height: 1.4;
}
.info-top-hour {
  margin: -4px 0 12px;
  font-size: 12px;
  color: #555;
  text-align: center;
}

/* Lien vers annuaire dans empty state de la recherche. */
.sunu-empty-link {
  display: inline-block;
  margin-top: 6px;
  color: #1a6b3c;
  font-weight: 600;
  text-decoration: none;
}
.sunu-empty-link:hover { text-decoration: underline; }

/* Tip raccourcis dans l'overlay onboarding — visible desktop seulement. */
.onboarding-shortcuts {
  margin: 10px 0 0;
  font-size: 12px;
  color: #555;
  text-align: center;
}
.onboarding-shortcuts kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fafafa;
  font: 600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #222;
}

/* Tip raccourcis clavier (visible seulement sur desktop via JS). */
.info-shortcuts {
  margin: 4px 0 12px;
  font-size: 12px;
  color: #777;
  text-align: center;
}
.info-shortcuts kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fafafa;
  font: 600 11px ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #222;
}

.categories-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 12px;
}
.categories-legend .cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: #f5f8f6;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  font-family: inherit;
}
.categories-legend .cat-chip:hover { border-color: #1a6b3c; }
.categories-legend .cat-chip[aria-pressed="true"] {
  background: #1a6b3c;
  color: #fff;
  border-color: #1a6b3c;
}
.categories-legend .cat-chip[aria-pressed="true"] .cat-count {
  color: rgba(255, 255, 255, 0.85);
}
.categories-legend .cat-chip .cat-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
}
.categories-legend .cat-chip .cat-count {
  color: #555;
  font-weight: 700;
}

.basemap-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f0f2f0;
  border-radius: 24px;
  margin-bottom: 4px;
}
.basemap-toggle button {
  flex: 1;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.basemap-toggle button[aria-checked="true"] {
  background: #ffffff;
  color: #1a6b3c;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.basemap-toggle button:hover:not([aria-checked="true"]) {
  background: rgba(255, 255, 255, 0.5);
}

/* --- Annuaire (directory) --- */

.directory-card {
  max-width: 460px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.directory-list {
  overflow-y: auto;
  margin: 4px -22px -18px;
  padding: 0 22px 18px;
}

/* Filtre interne dans la modal annuaire — scale au-delà de ~15 lieux. */
.dir-filter {
  width: 100%;
  margin: 10px 0 4px;
  padding: 9px 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  font-size: 14px;
  background: #fafafa;
  -webkit-appearance: none;
  appearance: none;
}
.dir-filter:focus {
  outline: 2px solid #1a6b3c;
  outline-offset: 1px;
  background: #fff;
}
.dir-empty {
  padding: 16px 6px;
  color: #777;
  font-size: 13px;
  text-align: center;
}

/* Chips de catégories au-dessus du filtre texte. Toggle pressed = filtre. */
.dir-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}
.dir-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px 5px 5px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fafafa;
  border-radius: 14px;
  font: 500 12px inherit;
  color: #333;
  cursor: pointer;
}
.dir-cat-chip:hover { background: #f0f4f1; }
.dir-cat-chip[aria-pressed="true"] {
  background: #1a6b3c;
  color: #fff;
  border-color: #1a6b3c;
}
.dir-cat-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%; color: #fff; font-size: 11px;
}
.dir-cat-count {
  font-size: 10px;
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 6px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.dir-cat-chip[aria-pressed="true"] .dir-cat-count {
  background: rgba(255, 255, 255, 0.22);
}

/* Astuce favoris (carte douce en haut de l'annuaire). */
.dir-tip {
  margin: 8px 0;
  padding: 10px 12px;
  background: #fff8e6;
  border: 1px solid #f3d97a;
  border-radius: 10px;
  font-size: 13px;
  color: #6b4d00;
}
.dir-tip em { font-style: normal; }

.dir-section {
  margin: 14px 0 0;
}
.dir-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #1a6b3c;
}
.dir-section-header .dir-section-count {
  background: #e8f4ec;
  color: #1a6b3c;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}

.dir-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7faf8;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.12s, transform 0.05s;
  -webkit-tap-highlight-color: transparent;
}
.dir-item:hover { background: #eaf3ee; }
.dir-item:active { transform: scale(0.99); }

.dir-item-icon {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  font-size: 14px;
}
.dir-item-text {
  min-width: 0;
  flex: 1;
}
.dir-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dir-item-sub {
  font-size: 12px;
  color: #777;
}

/* Badge distance haversine (m / km) à droite du texte. */
.dir-item-dist {
  font-size: 11px;
  color: #555;
  font-variant-numeric: tabular-nums;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Bouton 🧭 inline dans annuaire — itinéraire direct sans long-press. */
.dir-go-btn {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 15px;
  background: #f5f8f6;
  color: #1a6b3c;
  font-size: 14px;
  cursor: pointer;
  margin-right: 4px;
}
.dir-go-btn:hover { background: #1a6b3c; color: #fff; border-color: #1a6b3c; }

/* Badge 'Filtre carte : N cat.' dans le topbar quand un filtre est actif. */
.cat-filter-badge {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.cat-filter-badge:hover { background: rgba(255, 255, 255, 0.32); }

/* Étoile favoris inline dans annuaire — toggle sans ouvrir la fiche. */
.dir-fav-btn {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: rgba(0, 0, 0, 0.35);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.dir-fav-btn:hover { background: rgba(0, 0, 0, 0.06); color: #f59e0b; }
.dir-fav-btn[aria-pressed="true"] { color: #f59e0b; }

/* Barre toolbar (tri) au-dessus du filtre texte. */
.dir-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 0;
}
.dir-sort {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 2px;
}
.dir-sort button {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font: 600 12px inherit;
  color: #555;
  border-radius: 6px;
  cursor: pointer;
}
.dir-sort button[aria-checked="true"] {
  background: #1a6b3c;
  color: #fff;
}

/* Toolbar annuaire : tri à gauche, 'Tout afficher' à droite. */
.dir-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dir-reset {
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fafafa;
  padding: 4px 10px;
  border-radius: 6px;
  font: 600 12px inherit;
  color: #1a6b3c;
  cursor: pointer;
}
.dir-reset:hover { background: #f1f5f3; border-color: #1a6b3c; }
.dir-empty {
  padding: 20px;
  text-align: center;
  color: #888;
  font-size: 14px;
}

/* --- Onboarding overlay (1ère visite) --- */

.onboarding {
  position: fixed;
  inset: 0;
  background: rgba(20, 50, 35, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2000;
  animation: fadeIn 0.18s ease-out;
}
.onboarding[hidden] { display: none; }

.onboarding-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 22px 22px 18px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.onboarding-card h2 {
  margin: 0 0 4px;
  color: #1a6b3c;
  font-size: 20px;
  font-weight: 700;
}
.onboarding-sub {
  margin: 0 0 14px;
  color: #666;
  font-size: 13px;
}
.onboarding-tips {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}
.onboarding-tips li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 0;
  font-size: 14px;
  color: #222;
  line-height: 1.4;
}
.onboarding-tips li span {
  flex: 0 0 26px;
  font-size: 18px;
  text-align: center;
}
.onboarding-tips strong {
  color: #1a6b3c;
}
.onboarding-cta {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 24px;
  background: #1a6b3c;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.onboarding-cta:hover { background: #155a32; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* --- Toast --- */

.sunu-toast {
  position: fixed;
  bottom: calc(96px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(20, 20, 20, 0.92);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 22px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 1500;
  pointer-events: none;
}
.sunu-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.sunu-toast-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  pointer-events: auto;
}
.sunu-toast-btn {
  background: #1a6b3c;
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
.sunu-toast-btn:hover { background: #155a32; }

/* =========================================================================
 * Dark mode auto — suit le réglage OS de l'utilisateur (prefers-color-scheme).
 * Le fond satellite reste inchangé ; on assombrit les surfaces de chrome
 * (topbar children, search bar, panneaux, modals, annuaire).
 * ========================================================================= */

@media (prefers-color-scheme: dark) {
  html, body { color: #e6e6e6; }
  body { background: #0d1117; }
  #map { background: #0d1117; }

  /* --- Search bar --- */
  .sunu-search { background: #161b22; border-bottom-color: #2a3038; }
  #search-input {
    background: #1f262e;
    border-color: #2a3038;
    color: #e6e6e6;
  }
  #search-input::placeholder { color: #8a939e; }
  #search-input:focus { background: #0d1117; border-color: #2eb073; }
  #search-clear { background: #4a4f56; }
  #search-clear:hover { background: #6a7079; }
  #search-nearby { background: #1f262e; color: #2eb073; }
  #search-nearby:hover { background: #2a3038; }
  #search-nearby[data-state="active"] { background: #2eb073; color: #ffffff; }

  /* --- Search results --- */
  #search-results { background: #161b22; border-color: #2a3038; }
  .sunu-result { border-bottom-color: #232830; }
  .sunu-result:hover,
  .sunu-result.active { background: #1f262e; }
  .sunu-result-name { color: #e6e6e6; }
  .sunu-result-cat { color: #9ba0a8; }
  .sunu-result-empty { color: #9ba0a8; }
  .sunu-result-header {
    background: #1f262e;
    color: #2eb073;
    border-bottom-color: #2a3038;
  }
  .sunu-result-name mark { background: #5f4b00; color: #f3e9b0; }
  .sunu-result-dist { background: #163a26; color: #cce0d3; }

  /* --- Quick shortcuts --- */
  .sunu-shortcuts { background: #161b22; border-bottom-color: #2a3038; }
  .sunu-shortcuts button {
    background: #1f262e;
    border-color: #2a3038;
    color: #cce0d3;
  }
  .sunu-shortcuts button:hover { background: #2a3038; }

  /* --- Place panel (fiche) --- */
  #place-panel { background: #161b22; }
  .panel-desc { color: #d0d0d0; }
  .panel-meta { color: #aab1bb; }
  .panel-meta strong { color: #e6e6e6; }
  .panel-wolof { color: #2eb073; }
  .panel-actions { border-top-color: #2a3038; }
  .panel-actions .ghost {
    background: #1f262e;
    color: #2eb073;
    border-color: #2eb073;
  }
  .panel-actions .ghost:hover { background: #2a3038; }
  .panel-actions .ghost[aria-pressed="true"] {
    background: #3a2e10;
    border-color: #f59e0b;
    color: #fbbf24;
  }
  .panel-handle::before { background: #4a4f56; }
  .panel-handle:active::before { background: #2eb073; }

  /* --- Generic overlay (info / about / annuaire) --- */
  .overlay-card,
  .onboarding-card { background: #161b22; color: #e6e6e6; }
  .overlay-card h2,
  .onboarding-card h2 { color: #2eb073; }
  .overlay-sub,
  .onboarding-sub { color: #9ba0a8; }
  .overlay-meta dt { color: #9ba0a8; }
  .overlay-meta dd { color: #e6e6e6; }
  .overlay-meta-block { color: #d0d0d0; }
  .overlay-meta-block a { color: #2eb073; }
  .overlay-close { background: #1f262e; color: #d0d0d0; }
  .overlay-close:hover { background: #2a3038; }

  /* --- Annuaire --- */
  .directory-list { color: #e6e6e6; }
  .dir-item { background: #1f262e; }
  .dir-item:hover { background: #2a3038; }
  .dir-item-name { color: #e6e6e6; }
  .dir-item-sub { color: #aab1bb; }
  .dir-section-header { color: #2eb073; }
  .dir-section-header .dir-section-count { background: #163a26; color: #cce0d3; }
  .dir-empty { color: #9ba0a8; }

  /* --- Onboarding --- */
  .onboarding-tips li { color: #d0d0d0; }
  .onboarding-tips strong { color: #2eb073; }

  /* --- Map decorations --- */
  .leaflet-tooltip.place-label {
    background: rgba(15, 20, 25, 0.92);
    border-color: #2eb073;
    color: #cce0d3;
  }
  .leaflet-popup-content-wrapper,
  .leaflet-popup-tip {
    background: #161b22;
    color: #e6e6e6;
  }
  .leaflet-popup-content small { color: #aab1bb; }
  .leaflet-popup-content strong { color: #e6e6e6; }
  .leaflet-control-scale-line {
    background: rgba(22, 27, 34, 0.85);
    border-color: #e6e6e6;
    color: #e6e6e6;
  }

  /* --- Place pin --- */
  .place-pin {
    background: #161b22;
    color: #e6e6e6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  }

  /* --- Topbar buttons (info, dir) --- */
  #info-btn, #dir-btn { background: rgba(255, 255, 255, 0.1); }
  #info-btn:hover, #dir-btn:hover { background: rgba(255, 255, 255, 0.2); }
}

/* === Print stylesheet ============================================
   Permet d'imprimer un plan du campus pour distribution papier
   (bureau d'accueil primo-arrivants, affichage rentrée, etc.).
   Cache toute l'UI interactive et laisse la carte occuper la page,
   avec un titre en haut. Format A4 paysage recommandé pour le campus.
   ================================================================ */
@media print {
  /* Cache toute l'UI interactive : barre, recherche, raccourcis, panel,
     boutons flottants, overlays, bannières — on garde uniquement la carte. */
  #topbar, .sunu-search, .sunu-shortcuts, #route-banner, #locate-btn,
  #place-panel, #directory, #info-overlay, .onboarding,
  #offline-banner, #demo-banner, .skip-link,
  .leaflet-control-zoom, .leaflet-control-attribution {
    display: none !important;
  }

  body, html { background: #fff !important; color: #000 !important; }

  /* La carte prend toute la page imprimée. Marges réglées par le navigateur. */
  #map {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    height: 88vh !important;
    border: 1px solid #000;
    box-shadow: none !important;
  }

  /* Titre et URL pour que le plan papier reste identifiable une fois imprimé. */
  body::before {
    content: "Sunu Sanar — Plan du campus UGB · sanarmarket.sn/sunu-sanar/";
    display: block;
    padding: 8px 0 12px;
    font: 700 12pt system-ui, sans-serif;
    color: #1a6b3c;
    text-align: center;
  }
  body::after {
    content: "Imprimé depuis Sunu Sanar — un projet d'Ibrahima · ibou1003@icloud.com";
    display: block;
    margin-top: 8px;
    font: 9pt system-ui, sans-serif;
    color: #555;
    text-align: center;
  }

  /* Couleurs vives des markers conservées par défaut, mais on désactive les
     ombres et animations pour un rendu plus propre à l'impression. */
  .place-pin, .leaflet-marker-icon { animation: none !important; box-shadow: none !important; }
}

/* Mode embarqué (WebView native) : masque le bandeau redondant avec le titre natif. */
html.embed #topbar { display: none; }
