/* ==========================================================================
   FurtoVanCamper — Mappa interattiva (Leaflet + OpenStreetMap/Nominatim)
   Riusa le variabili colore/radius già definite in index.html (:root)
   ========================================================================== */

#fvc-map-wrapper {
  position: relative;
  /* Crea un proprio stacking context: senza z-index qui, i controlli interni
     (search box, coordinate, controlli Leaflet — tutti a z-index:1000)
     sfondano sopra elementi fixed della webapp come il menu laterale (z-index:70). */
  z-index: 0;
  width: 100%;
  height: 500px;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}

#fvc-map {
  width: 100%;
  height: 100%;
  background: var(--bg3);
}

/* Barra di ricerca sovrapposta alla mappa */
#fvc-search-box {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 1000;
  max-width: 420px;
  font-family: "IBM Plex Sans", sans-serif;
}

#fvc-search-input {
  width: 100%;
  padding: 11px 13px;
  font-size: 14px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  outline: none;
  background: var(--bg2);
}
#fvc-search-input::placeholder { color: var(--muted); }
#fvc-search-input:focus { border-color: var(--blue); }

/* Elenco suggerimenti (autocompletamento) */
#fvc-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  overflow: hidden;
  display: none;
}
#fvc-results li {
  padding: 10px 13px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
#fvc-results li:last-child { border-bottom: none; }
#fvc-results li:hover,
#fvc-results li.active { background: var(--bg3); }

#fvc-results .hint {
  padding: 10px 13px;
  font-size: 12px;
  color: var(--muted);
  cursor: default;
}

/* Riquadro con le coordinate selezionate */
#fvc-coords {
  position: absolute;
  bottom: 14px;
  left: 10px;
  z-index: 1000;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  padding: 9px 13px;
  font-size: 12px;
  color: var(--text);
  max-width: 360px;
  display: none;
}
#fvc-coords b { color: var(--amber); }
#fvc-coords .addr { color: var(--muted); margin-top: 4px; }

/* Attribuzione OpenStreetMap (leggibile anche su tema scuro) */
#fvc-map-wrapper .leaflet-control-attribution {
  background: rgba(20, 31, 54, .85) !important;
  color: var(--muted) !important;
  font-size: 10px !important;
}
#fvc-map-wrapper .leaflet-control-attribution a { color: var(--blue2) !important; }

@media (max-width: 640px) {
  #fvc-map-wrapper { height: 380px; }
}

/* Punti segnalazioni sulla mappa — effetto radar (anello che si espande e sfuma) */
.fvc-dot-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fvc-dot-core {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #13151a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);
  z-index: 1;
}
.fvc-dot-ring {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  opacity: .6;
  animation: fvcRadarPing 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes fvcRadarPing {
  0% { transform: scale(1); opacity: .55; }
  100% { transform: scale(2.8); opacity: 0; }
}

/* Anteprima al passaggio del mouse sui puntini della mappa segnalazioni */
.leaflet-tooltip.fvc-tip {
  background: var(--bg2, #141f36);
  color: var(--text, #f2f5fa);
  border: 1px solid var(--border, #33456a);
  border-radius: 6px;
  padding: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
  white-space: normal;
  width: 230px;
}
.leaflet-tooltip-top.fvc-tip::before { border-top-color: var(--border, #33456a); }
.leaflet-tooltip-bottom.fvc-tip::before { border-bottom-color: var(--border, #33456a); }
.leaflet-tooltip-left.fvc-tip::before { border-left-color: var(--border, #33456a); }
.leaflet-tooltip-right.fvc-tip::before { border-right-color: var(--border, #33456a); }
.fvc-tip-body { display: flex; gap: 8px; align-items: flex-start; }
.fvc-tip-img, .fvc-tip-ph {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: 4px;
  object-fit: cover; background: var(--bg3, #1c2842);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.fvc-tip-text { min-width: 0; flex: 1; }
.fvc-tip-title { font-size: 13px; font-weight: 600; line-height: 1.25; margin-bottom: 2px; overflow-wrap: anywhere; }
.fvc-tip-meta { font-size: 11px; color: var(--muted, #6b7c9b); line-height: 1.35; }
.fvc-tip-tags { margin: 3px 0; display: flex; flex-wrap: wrap; gap: 4px; }
.fvc-tip-tag { font-size: 10px; padding: 1px 6px; border: 1px solid var(--border, #33456a); border-radius: 10px; }

/* Punto di ritrovamento collegato al furto da una linea rossa tratteggiata */
.fvc-found-dot { background: transparent; border: 0; }
.fvc-found-core {
  width: 20px; height: 20px; margin: 0; border-radius: 50%; box-sizing: border-box;
  background: #fff; color: #2e9e5b; border: 2px solid #2e9e5b;
  font: 700 13px/16px sans-serif; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.fvc-found-core::before { content: "✓"; }

/* ==========================================================================
   Stile scuro delle mappe, nei colori del sito.
   È la stessa mappa OpenStreetMap con un filtro sui riquadri: i puntini e i controlli
   non sono toccati dal filtro. Nessuna chiave, nessun servizio in più.
   ========================================================================== */
.fvc-dark-tiles { filter: invert(1) hue-rotate(205deg) brightness(.82) contrast(.92) saturate(.55); }
.leaflet-container { background: var(--bg2, #141f36); }
.leaflet-container .leaflet-control-attribution {
  background: rgba(11, 18, 32, .78);
  color: var(--muted, #6b7c9b);
}
.leaflet-container .leaflet-control-attribution a { color: var(--blue2, #2f8fdb); }
.leaflet-touch .leaflet-bar, .leaflet-bar { border: 1px solid var(--border, #33456a); box-shadow: none; }
.leaflet-bar a, .leaflet-bar a:hover {
  background-color: var(--bg2, #141f36);
  color: var(--text, #f2f5fa);
  border-bottom-color: var(--border, #33456a);
}
.leaflet-bar a:hover { background-color: var(--bg3, #1c2842); }
.leaflet-bar a.leaflet-disabled { background-color: var(--bg, #0b1220); color: var(--muted, #6b7c9b); }

/* Suggerimento "due dita" sulle mappe touch */
.fvc-gesture-hint {
  position: absolute; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 16px; text-align: center; font-size: 14px; font-weight: 600; color: #fff; pointer-events: none;
  background: rgba(11, 14, 20, .55); opacity: 0; transition: opacity .2s;
}
.fvc-gesture-hint.show { opacity: 1; }
