:root {
  /* Palette presa dal sito/marketing (template.html): lime come colore
     d'accento per riempimenti (bottoni, marker, progress bar), ink come
     colore del testo — mai lime su testo/link, contrasto troppo basso. */
  --brand: #b8e63f;
  --brand-dark: #86ad19;
  --brand-light: #eef7d1;
  --brand-rgb: 184, 230, 63;
  --on-brand: #171914; /* testo/icone sopra un riempimento --brand: sempre scuro, in entrambi i temi */
  --ink: #171914;
  --muted: #686b63;
  --surface: #ffffff;
  --surface-alt: #f4f3ee;
  --border: #dedfd7;

  /* Ridefinisce le variabili di Bootstrap 5.3: bg-primary/text-primary/border-primary
     e i checkbox le leggono da qui, senza bisogno di ricompilare i Sass di Bootstrap. */
  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  /* Link: colore ink (leggibile come testo), non brand — il lime va bene per
     riempimenti ma è un colore di testo a basso contrasto. */
  --bs-link-color: var(--ink);
  --bs-link-color-rgb: 23, 25, 20;
  --bs-link-hover-color: var(--brand-dark);
  --bs-link-hover-color-rgb: 134, 173, 25;
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-color: var(--on-brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-hover-color: var(--on-brand);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-active-color: var(--on-brand);
  --bs-btn-focus-shadow-rgb: var(--brand-rgb);
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
  --bs-btn-disabled-color: var(--on-brand);
}

.btn-outline-primary {
  --bs-btn-color: var(--brand-dark);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-hover-color: var(--on-brand);
  --bs-btn-active-bg: var(--brand);
  --bs-btn-active-border-color: var(--brand);
  --bs-btn-active-color: var(--on-brand);
  --bs-btn-focus-shadow-rgb: var(--brand-rgb);
  --bs-btn-disabled-color: var(--brand-dark);
  --bs-btn-disabled-border-color: var(--brand);
}

.form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}
.form-check-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.25rem rgba(var(--brand-rgb), 0.25);
}

.badge-chip {
  background: var(--surface-alt);
  color: var(--ink);
  border: 1px solid var(--border);
  font-weight: 500;
}

:root[data-bs-theme="dark"] {
  --brand: #b8e63f;
  --brand-dark: #cdf06a; /* più chiaro, non più scuro: su sfondo scuro serve l'opposto per l'hover */
  --brand-light: #23301a;
  --brand-rgb: 184, 230, 63;
  --ink: #f1f2ec;
  --muted: #a5a89c;
  --surface: #1c1d18;
  --surface-alt: #242519;
  --border: #34362c;
  --bs-link-color: var(--ink);
  --bs-link-color-rgb: 241, 242, 236;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--surface-alt);
}

.close-icon-btn {
  color: var(--ink);
}
.close-icon-btn:hover {
  color: var(--muted);
}
#map {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

/* Barra inferiore flottante compatta */
.bottom-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  height: 64px;
  width: auto;
  padding: 0 12px;
  display: flex;
  z-index: 1050;
  border-radius: 32px;
  box-shadow: 0 8px 28px rgba(31, 39, 51, 0.12);
  background: var(--surface);
  border: 1px solid var(--border);
}

/* Contenitore dei pulsanti nella barra */
.bottom-bar .d-flex {
  gap: 12px;
}

/* Ogni pulsante + caption */
.bottom-bar .nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
}

/* Icone pulsanti: ink, non brand — il lime è troppo chiaro per leggersi bene
   come colore di icona/testo, resta riservato ai riempimenti. */
.bottom-bar .btn {
  font-size: 2rem;
  color: var(--ink);
  padding-bottom: 0;
  padding-top: 0.25rem;
  transition: color 0.15s;
}
.bottom-bar .btn:hover {
  color: var(--brand-dark);
}

/* Caption sotto l'icona: nowrap perché in alcune lingue (es. tedesco
   "In meiner Nähe") il testo è più lungo dell'inglese e andrebbe a capo. */
.bottom-bar .caption {
  font-size: 0.78rem;
  line-height: 1;
  color: var(--muted);
  margin-top: -2px;
  margin-bottom: 2px;
  font-weight: 600;
  letter-spacing: 0.01em;
  pointer-events: none;
  padding: 0 4px;
  white-space: nowrap;
  margin-bottom: 10px;
}

/* Icona filtri flottante */
.filter-fab {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1060;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(var(--brand-rgb), 0.35);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  padding: 0;
}

/* Responsive */
@media (max-width: 500px) {
  .bottom-bar { height: 56px; padding: 0 6px; }
  .bottom-bar .d-flex { gap: 6px; }
  .bottom-bar .btn { font-size: 1.5rem; }
  .bottom-bar .nav-btn { min-width: 36px; }
  .bottom-bar .caption { font-size: 0.66rem; padding: 0 2px; }
  .filter-fab { width: 48px; height: 48px; font-size: 1.3rem; top: 12px; right: 12px; }
}

/* Pannello preferiti che si alza dal basso */
.favorites-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -85%; /* Nascosto */
  height: 80vh;
  max-height: 80vh;
  background: var(--surface);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -8px 32px rgba(31, 39, 51, 0.16);
  z-index: 2000;
  transition: bottom 0.35s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
}

.favorites-panel.open {
  bottom: 0;
}

.favorites-header {
  border-bottom: 1px solid var(--border);
}

.favorites-list {
  overflow-y: auto;
  flex: 1 1 auto;
  margin-top: 10px;
}

/* Responsive */
@media (max-width: 600px) {
  .favorites-panel {
    height: 80vh;
    max-height: 80vh;
  }
}

/* Da desktop il pannello a tutta larghezza risulta troppo esteso: un
   max-width centrato (margin auto già impostato più sotto) gli dà respiro
   lasciando visibile la mappa ai lati. */
@media (min-width: 768px) {
  .favorites-panel,
  .menu-panel {
    max-width: 640px;
  }
}

/* Overlay semi trasparente per il pannello preferiti */
.favorites-overlay {
  display: none;
  position: fixed;
  z-index: 1999;
  left: 0; right: 0; top: 0; bottom: 0;
  background: rgba(0,0,0,0.22);
  transition: background 0.25s;
}
.favorites-overlay.open {
  display: block;
}
.favorites-panel {
  margin-left: auto;
  margin-right: auto;
  left: 0; right: 0;
}

/* Overlay e sidebar per filtri */
.filters-overlay {
  display: none;
  position: fixed;
  z-index: 2999;
  left: 0; right: 0; top: 0; bottom: 0;
  background: rgba(0,0,0,0.22);
  transition: background 0.25s;
}
.filters-overlay.open {
  display: block;
}
.filters-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 330px;
  max-width: 95vw;
  height: 100vh;
  background: var(--surface);
  box-shadow: -8px 0 32px rgba(31, 39, 51, 0.16);
  border-top-left-radius: 18px;
  border-bottom-left-radius: 18px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.filters-sidebar.open {
  transform: translateX(0);
}
.filters-header {
  border-bottom: 1px solid var(--border);
}

@media (max-width: 500px) {
  .filters-sidebar {
    width: 90vw;
    max-width: 95vw;
    border-radius: 0;
  }
}

/* Overlay e pannello menu */
.menu-overlay {
  display: none;
  position: fixed;
  z-index: 2099;
  left: 0; right: 0; top: 0; bottom: 0;
  background: rgba(0,0,0,0.22);
  transition: background 0.25s;
}
.menu-overlay.open {
  display: block;
}
.menu-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: -85%;
  height: 80vh;
  max-height: 80vh;
  background: var(--surface);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -8px 32px rgba(31, 39, 51, 0.16);
  z-index: 2100;
  transition: bottom 0.35s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  margin-left: auto;
  margin-right: auto;
  left: 0; right: 0;
}
.menu-panel.open {
  bottom: 0;
}
.menu-header {
  border-bottom: 1px solid var(--border);
}
.menu-content {
  width: 100%;
  height: 100%;
  overflow-y: auto;
}
.menu-content.d-none {
  display: none !important;
}
.menu-link {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.menu-link:hover {
  background: var(--surface-alt);
}
.menu-link i {
  color: var(--ink);
}

/* Overlay punto di ricarica */
#pointOverlay {
  display: none;
  position: fixed;
  z-index: 2100;
  left: 0; right: 0; top: 0; bottom: 0;
  background: rgba(0,0,0,0.22);
}
#pointOverlay.open {
  display: block;
}
/* Modale centrata */
#pointPanel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(31, 39, 51, 0.24);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow-y: auto;
  animation: popin 0.22s cubic-bezier(0.4,0,0.2,1);
}
@keyframes popin {
  from { opacity: 0; transform: translate(-50%, -40%) scale(0.96);}
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1);}
}
#pointReviews .review {
  border-left: 3px solid var(--brand);
  margin-bottom: 0.5rem;
  padding-left: 0.5rem;
  font-size: 0.95em;
}

/* Marker "you are here": un pallino pulsante, volutamente diverso dai pin dei
   punti di ricarica per non essere scambiato per uno di essi. */
.user-location-marker {
  position: relative;
  width: 20px;
  height: 20px;
}
.user-location-marker .pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  background: rgba(var(--brand-rgb), 0.35);
  border-radius: 50%;
  animation: user-location-pulse 2s ease-out infinite;
}
.user-location-marker .dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  background: var(--brand);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(31, 39, 51, 0.4);
}
@keyframes user-location-pulse {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}

.point-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--brand);
  color: var(--on-brand);
  border-radius: 50%;
  font-size: 1.05rem;
  margin-right: 8px;
  vertical-align: middle;
}

.progress-bar {
  background-color: var(--brand);
}

.osm-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}
.osm-link:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.search-suggestions {
  display: none;
  position: absolute;
  left: 1rem;
  right: 1rem;
  z-index: 20;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(31, 39, 51, 0.15);
  max-height: 240px;
  overflow-y: auto;
}
.search-suggestions.open {
  display: block;
}
.suggestion-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  border-top: 1px solid var(--border);
  background: none;
  color: var(--ink);
  font-size: 0.9rem;
  cursor: pointer;
}
.suggestion-item:first-child {
  border-top: none;
}
.suggestion-item:hover,
.suggestion-item:focus {
  background: var(--surface-alt);
}

.favorite-item {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.favorite-item:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 12px rgba(var(--brand-rgb), 0.12);
}

@media (max-width: 500px) {
#pointPanel {
    width: 90%;
}}