/* =====================================================================
   Vismar Map · Design System
   Estetica moderna ed elegante condivisa da tutte le pagine.
   ===================================================================== */

/* --- Token di design ------------------------------------------------ */
:root {
  /* Tipografia */
  --font-primary: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Superfici e sfondi */
  --bg: #f2f1ee;
  --bg-soft: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f3f2ee;
  --surface-3: #e9e8e3;

  /* Testo */
  --text: #33373b;
  --text-muted: #7d8288;
  --text-faint: #a6aab0;

  /* Bordi */
  --border: #e6e4dd;
  --border-strong: #cfcdc4;

  /* Brand / primario — oro Biotec */
  --primary: #b29237;
  --primary-600: #9c7f2e;
  --primary-700: #826a26;
  --primary-soft: #f4eeda;
  --brand-gradient: linear-gradient(135deg, #c2a349 0%, #a8872e 100%);

  /* Grigio scuro (bottoni secondari e pin) */
  --dark: #43484d;
  --dark-600: #33373b;

  /* Tipi di sede */
  --estetica: #b29237;          /* oro -> estetica */
  --estetica-soft: #f4eeda;
  --estetica-gradient: linear-gradient(135deg, #c2a349 0%, #a8872e 100%);
  --medica: #4a5056;            /* grigio scuro -> medicale */
  --medica-soft: #eaebec;
  --medica-gradient: linear-gradient(135deg, #5a6066 0%, #43484d 100%);

  /* Stati */
  --success: #10b981;
  --success-soft: #d1fae5;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --warning: #f59e0b;

  /* Raggi */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Ombre stratificate e morbide */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, 0.18);
  --shadow-glass: 0 8px 32px rgba(15, 23, 42, 0.12);

  /* Transizioni */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --- Reset di base -------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body.app {
  margin: 0;
  font-family: var(--font-primary);
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}


.leaflet-bottom {display: none !important; } /* Nasconde il watermark di Leaflet */

h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }

a { color: inherit; }

::selection { background: rgba(178, 146, 55, 0.22); }

/* Scrollbar elegante */
.scroll-thin { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.scroll-thin::-webkit-scrollbar { width: 9px; }
.scroll-thin::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
.scroll-thin::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

/* =====================================================================
   Topbar / Header
   ===================================================================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  height: 64px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  z-index: 1200;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--brand-gradient);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { font-size: 18px; font-weight: 700; line-height: 1; }
.brand-name small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 3px;
}

.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav a svg { width: 17px; height: 17px; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary-600); }

.topbar-spacer { flex: 1; }

/* =====================================================================
   Bottoni
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease),
              background 0.2s var(--ease), border-color 0.2s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 6px 18px rgba(178, 146, 55, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(178, 146, 55, 0.45); }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-ghost:hover { border-color: var(--border-strong); background: var(--bg-soft); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-block { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn-sm { padding: 8px 13px; font-size: 13px; }

/* =====================================================================
   Layout a due colonne
   ===================================================================== */
.contenitore-flex {
  display: flex;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.colonna-sinistra {
  width: 34%;
  max-width: 460px;
  min-width: 320px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.colonna-destra {
  flex: 1;
  position: relative;
  background: var(--surface-3);
  min-width: 0;
}

.map-container { width: 100%; height: 100%; }
#map { width: 100%; height: 100%; }
.vismar-map-app #map { position: relative; overflow: hidden; }
.lite-map-frame { display: block; width: 100%; height: 100%; border: 0; }
.vismar-map-app .gmap-popup[hidden] { display: none; }

/* Avviso mostrato quando manca la chiave Google Maps JavaScript API */
.map-key-missing {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 24px;
  background: var(--surface-3);
  color: var(--text-muted);
}
.map-key-missing p { margin: 0; max-width: 360px; font-size: 13.5px; }
.map-key-missing code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 12.5px; }

/* --- Intestazione colonna sinistra --------------------------------- */
.panel-head {
  padding: 22px 22px 14px;
  flex-shrink: 0;
}

/* Logo in alto nella sidebar (stile Doctor Locator) */
.panel-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.panel-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.panel-brand-mark svg { width: 19px; height: 19px; }
.panel-brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}
.panel-brand-name small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.panel-head h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}
.panel-head .count {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-600);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: var(--r-pill);
}
.panel-sub { margin-top: 4px; font-size: 13.5px; color: var(--text-muted); }

/* --- Campo di ricerca ----------------------------------------------- */
.search-box {
  position: relative;
  margin: 14px 22px 6px;
}
.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

/* --- Lista delle card ----------------------------------------------- */
#locations-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 22px 26px;
  min-height: 0;
}

/* =====================================================================
   Card sede
   ===================================================================== */
.card-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  background: var(--surface);
  overflow: hidden;
  transition: box-shadow 0.3s var(--ease), transform 0.25s var(--ease),
              background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.card-wrapper:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* Card selezionata: pannello oro pieno con testo bianco (stile mockup) */
.card-wrapper.active-card {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(178, 146, 55, 0.35);
}
.card-wrapper.active-card .card { background: transparent; }
.card-wrapper.active-card .sede-tipo,
.card-wrapper.active-card .indirizzo { color: #fff; }
.card-wrapper.active-card .sede-indirizzo,
.card-wrapper.active-card .distanza { color: rgba(255, 255, 255, 0.85); }
.card-wrapper.active-card .sede-kind,
.card-wrapper[data-type="1"].active-card .sede-kind,
.card-wrapper[data-type="2"].active-card .sede-kind { color: rgba(255, 255, 255, 0.75); }
.card-wrapper.active-card .muted-row svg { color: rgba(255, 255, 255, 0.8); }

.card {
  position: relative;
  background: var(--surface);
  padding: 16px 18px;
  cursor: pointer;
  flex-grow: 1;
  flex-shrink: 1;
  min-width: 0;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.card-row + .card-row { margin-top: 9px; }

.sede-head { display: flex; align-items: center; gap: 11px; min-width: 0; }
.sede-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.sede-icon svg { width: 20px; height: 20px; }
.card-wrapper[data-type="1"] .sede-icon { background: var(--estetica-gradient); }
.card-wrapper[data-type="2"] .sede-icon { background: var(--medica-gradient); }

.sede-meta { min-width: 0; }
.sede-tipo {
  padding-bottom: 3px !important;
  font-weight: 700;
  font-size: 15.5px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sede-kind {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card-wrapper[data-type="1"] .sede-kind { color: var(--estetica); }
.card-wrapper[data-type="2"] .sede-kind { color: var(--medica); }
.sede-indirizzo {
  padding-bottom: 3px !important;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.tag::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.tag.aperto { background: var(--success-soft); color: #047857; }
.tag.chiuso { background: var(--danger-soft); color: #b91c1c; }

.indirizzo, .distanza, .orario-chiusura {
  font-size: 13px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.indirizzo { color: var(--text); font-weight: 500; }
.distanza { font-weight: 600; color: var(--primary-600); }
.muted-row { margin-top: 11px; }
.muted-row svg { width: 15px; height: 15px; color: var(--text-faint); }

/* Pannello azioni a scomparsa (footer sotto la card) */
.card-actions {
  display: flex;
  gap: 8px;
  background: var(--surface-2);
  border-top: 1px solid transparent;
  overflow: hidden;
  max-height: 0;
  padding: 0 12px;
  transition: max-height 0.35s var(--ease), padding 0.35s var(--ease),
              border-color 0.35s var(--ease);
}
.card-wrapper.expanded .card-actions {
  max-height: 64px;
  padding: 10px 12px;
  border-top-color: var(--border);
}
.action-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 8px;
  cursor: pointer;
  flex: 1;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.action-btn svg { width: 15px; height: 15px; }
.action-btn:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.action-btn.primary { background: var(--brand-gradient); color: #fff; border-color: transparent; }
.action-btn.primary:hover { box-shadow: var(--shadow-sm); }

/* Stato vuoto */
.empty-state {
  text-align: center;
  color: var(--text-faint);
  padding: 50px 20px;
}
.empty-state svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: 0.6; }
.empty-state p { margin: 0; font-size: 14px; }

/* =====================================================================
   Controllo segmentato (filtro tipi) — vetro flottante
   ===================================================================== */
.map-controls {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
}
.segmented {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  padding: 5px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-glass);
  border: 1px solid rgba(255, 255, 255, 0.6);
  gap: 2px;
}
.seg-btn {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s var(--ease), background 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.seg-btn svg { width: 15px; height: 15px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { color: #fff; box-shadow: var(--shadow-sm); }
.seg-btn[data-filter="all"].active { background: var(--primary); }
.seg-btn[data-filter="1"].active { background: var(--estetica); }
.seg-btn[data-filter="2"].active { background: var(--medica); }

/* Pulsante "torna alla mia posizione" */
.locate-btn {
  position: absolute;
  bottom: 26px;
  right: 18px;
  z-index: 1000;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--primary-600);
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.locate-btn:hover { transform: scale(1.06); box-shadow: var(--shadow-lg); }
.locate-btn svg { width: 22px; height: 22px; }
.locate-btn.exploring {
  background: var(--warning);
  color: #fff;
  border-color: transparent;
}

/* =====================================================================
   Popup ancorato al pin (overlay Google Maps)
   ===================================================================== */
.gmap-popup {
  position: absolute;
  transform: translate(-50%, calc(-100% - 14px));
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 18px 18px 16px;
  width: 232px;
  font-family: var(--font-primary);
  line-height: 1.55;
  text-align: center;
  pointer-events: auto;
  z-index: 10;
}
.gmap-popup::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 11px solid var(--surface);
  filter: drop-shadow(0 3px 2px rgba(15, 23, 42, 0.08));
}
.popup-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  margin-bottom: 8px;
}
.popup-kind.k1 { background: var(--estetica-soft); color: var(--estetica); }
.popup-kind.k2 { background: var(--medica-soft); color: var(--medica); }
.gmap-popup h4 { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: var(--text); }
.gmap-popup p { margin: 3px 0; font-size: 13.5px; color: var(--text-muted); }
.gmap-popup p strong { color: var(--text); font-weight: 600; }
.gmap-popup p.popup-addr-label {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.popup-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  margin-top: 13px;
  padding: 11px;
  background: var(--primary);
  color: #fff !important;
  text-align: center;
  text-decoration: none;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 5px 14px rgba(178, 146, 55, 0.35);
  transition: box-shadow 0.2s var(--ease);
}
.popup-nav-btn svg { width: 16px; height: 16px; }
.popup-nav-btn:hover { box-shadow: 0 8px 20px rgba(178, 146, 55, 0.5); text-decoration: none; }

/* Pulsanti a pillola impilati come nel mockup */
.popup-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.popup-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 10px;
  background: var(--dark);
  color: #fff !important;
  text-align: center;
  text-decoration: none;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: none;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.popup-action-btn svg { width: 15px; height: 15px; }
.popup-action-btn:hover {
  background: var(--dark-600);
  box-shadow: 0 6px 16px rgba(51, 55, 59, 0.35);
  text-decoration: none;
}
/* =====================================================================
   Pagina di gestione (Google Maps)
   ===================================================================== */
.gestione-wrap {
  flex: 1;
  display: flex;
  min-height: 0;
}
.gestione-form-col {
  width: 38%;
  max-width: 480px;
  min-width: 340px;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.gestione-map-col {
  flex: 1;
  position: relative;
  min-width: 0;
  background: var(--surface-3);
}
#gmap { width: 100%; height: 100%; }

.form-section { padding: 24px 26px; }
.form-section + .form-section { border-top: 1px solid var(--border); }
.form-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-title .step {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
}
.field input[type="text"],
.field input[type="time"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="number"],
.field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* Selettore tipo a pillole */
.type-picker { display: flex; gap: 10px; }
.type-option {
  flex: 1;
  position: relative;
  cursor: pointer;
}
.type-option input { position: absolute; opacity: 0; }
.type-option .type-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.type-option .type-ico {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff;
}
.type-option .type-ico svg { width: 17px; height: 17px; }
.type-option[data-type="1"] .type-ico { background: var(--estetica-gradient); }
.type-option[data-type="2"] .type-ico { background: var(--medica-gradient); }
.type-option .type-label { font-size: 14px; font-weight: 600; }
.type-option input:checked + .type-card { box-shadow: var(--shadow-sm); }
.type-option[data-type="1"] input:checked + .type-card { border-color: var(--estetica); background: var(--estetica-soft); }
.type-option[data-type="2"] input:checked + .type-card { border-color: var(--medica); background: var(--medica-soft); }

.coords-display {
  display: flex;
  gap: 12px;
  background: var(--primary-soft);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--primary-700);
  align-items: center;
}
.coords-display svg { width: 18px; height: 18px; flex-shrink: 0; }
.coords-display .vals { font-variant-numeric: tabular-nums; font-weight: 600; }
.coords-display .vals span { color: var(--text-faint); font-weight: 500; }

.form-hint { font-size: 12.5px; color: var(--text-muted); margin: -8px 0 14px; }

/* Banner avvisi */
.banner {
  display: flex;
  gap: 13px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 26px 4px;
}
.banner svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.banner.warn { background: #fef3c7; color: #92400e; }
.banner.info { background: var(--primary-soft); color: var(--primary-700); }
.banner code {
  background: rgba(0,0,0,0.07);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12.5px;
}
.banner a { font-weight: 600; }

/* Toast di feedback */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--text);
  color: #fff;
  padding: 13px 20px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: 9px;
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.4s var(--ease);
}
.toast svg { width: 18px; height: 18px; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.ok { background: #065f46; }
.toast.err { background: #991b1b; }

/* Lista sedi esistenti nella gestione */
.points-list { display: flex; flex-direction: column; gap: 10px; }
.point-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: box-shadow 0.2s var(--ease);
}
.point-item:hover { box-shadow: var(--shadow-sm); }
.point-item .pi-ico {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.point-item .pi-ico svg { width: 17px; height: 17px; }
.point-item[data-type="1"] .pi-ico { background: var(--estetica-gradient); }
.point-item[data-type="2"] .pi-ico { background: var(--medica-gradient); }
.point-item .pi-body { flex: 1; min-width: 0; }
.point-item .pi-name {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.point-item .pi-sub { font-size: 12px; color: var(--text-muted); }
.point-item .pi-del {
  border: none;
  background: var(--danger-soft);
  color: var(--danger);
  width: 34px; height: 34px;
  border-radius: 9px;
  cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: background 0.2s var(--ease);
}
.point-item .pi-del:hover { background: var(--danger); color: #fff; }
.point-item .pi-del svg { width: 16px; height: 16px; }

.gmap-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.gmap-placeholder .ph-inner { max-width: 420px; }
.gmap-placeholder svg { width: 56px; height: 56px; color: var(--text-faint); margin-bottom: 16px; }
.gmap-placeholder h3 { font-size: 19px; margin-bottom: 10px; color: var(--text); }
.gmap-placeholder p { font-size: 14px; line-height: 1.6; margin: 6px 0; }
.gmap-placeholder ol { text-align: left; font-size: 13.5px; line-height: 1.8; color: var(--text); }
.gmap-placeholder code { background: var(--surface-2); padding: 2px 7px; border-radius: 6px; font-size: 12.5px; }

/* =====================================================================
   Layout mappa a tutto schermo (.vismar-map-app)
   Desktop: elenco a sinistra + mappa. Mobile: mappa piena + bottom sheet.
   ===================================================================== */
.vismar-map-app {
  position: relative;
  display: flex;
  flex: 1;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}
.vismar-map-app .colonna-sinistra {
  z-index: 1010;
  box-shadow: 8px 0 24px rgba(15, 23, 42, 0.06);
}

/* Overlay che oscura la mappa quando il pannello è aperto (solo mobile) */
.map-overlay { display: none; }

/* Header oro mobile: visibile solo sotto i 900px */
.mobile-header { display: none; }

/* Popup mobile (card centrata): attivo solo sotto i 900px */
.mobile-popup { display: none; }

/* Bottone mostra/nascondi elenco (solo mobile) */
.toggle-list-btn { display: none; border: none; cursor: pointer; }
.toggle-list-btn .icon-close { display: none; }
.vismar-map-app.list-open .toggle-list-btn .icon-list { display: none; }
.vismar-map-app.list-open .toggle-list-btn .icon-close { display: block; }

/* --- Controlli zoom Leaflet in stile Vismar -------------------------- */
.leaflet-control-zoom.leaflet-bar {
  border: none;
  border-radius: 13px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.leaflet-control-zoom a {
  width: 38px;
  height: 38px;
  line-height: 38px;
  font-size: 17px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.leaflet-control-zoom a:last-child { border-bottom: none; }
.leaflet-control-zoom a:hover { background: #fff; color: var(--primary-600); }

/* =====================================================================
   Marker posizione utente (animato)
   ===================================================================== */
.user-location-marker {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.user-location-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  position: relative;
  z-index: 2;
}

.user-location-pulse {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.25); /* arancione trasparente */
  border: 2px dashed var(--warning); /* stroke tratteggiato arancione */
  animation: pulse 2.5s infinite cubic-bezier(0.22, 0.61, 0.36, 1);
  z-index: 1;
  transform-origin: center;
}

@keyframes pulse {
  0% { transform: scale(0.3); opacity: 0.8; }
  80%, 100% { transform: scale(1); opacity: 0; }
}

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 900px) {
  body.app { height: auto; min-height: 100vh; }
  .topbar { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 12px; }
  .nav { margin-left: 0; order: 3; width: 100%; }
  .contenitore-flex { flex-direction: column; }
  .colonna-sinistra, .gestione-form-col {
    width: 100%; max-width: none; min-width: 0;
    border-right: none; border-bottom: 1px solid var(--border);
    max-height: none;
  }
  .colonna-destra, .gestione-map-col { height: 60vh; min-height: 380px; flex: none; }
  .gestione-wrap { flex-direction: column; }

  /* --- App mobile: header oro + viste Lista/Mappa (mockup Biotec) ---- */
  .vismar-map-app {
    flex: none;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
  }
  .vismar-map-app .gm-bundled-control { display: none; } /* c'è il pinch */

  /* Header oro: logo centrato, ricerca e toggle viste */
  .mobile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: var(--primary);
    padding: calc(16px + env(safe-area-inset-top)) 20px 32px;
    flex-shrink: 0;
    z-index: 1300;
  }
  .mobile-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    color: #fff;
  }
  .mobile-logo .logo-mark {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.65);
    background: rgba(255, 255, 255, 0.12);
    display: grid;
    place-items: center;
  }
  .mobile-logo .logo-mark svg { width: 22px; height: 22px; }
  .mobile-logo .logo-text {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.95;
  }

  /* Testo informativo mostrato quando una sede è selezionata */
  .mobile-info { display: none; margin: 0; text-align: center; color: #fff; }
  .mobile-info strong { display: block; font-size: 17px; font-weight: 700; margin-bottom: 3px; }
  .mobile-info small { font-size: 12.5px; opacity: 0.85; }

  /* Barra di ricerca dentro l'header oro (spostata via JS) */
  .mobile-header .search-box { margin: 0; width: 100%; max-width: 420px; }
  .mobile-header .search-box input {
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    border-radius: var(--r-pill);
    background: transparent;
    color: #fff;
    box-shadow: none;
  }
  .mobile-header .search-box input::placeholder { color: rgba(255, 255, 255, 0.8); }
  .mobile-header .search-box input:focus { border-color: #fff; box-shadow: none; }
  .mobile-header .search-box svg { color: #fff; }

  /* Toggle Lista / Mappa */
  .view-toggle { display: flex; gap: 12px; }
  .view-toggle .vt-btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 10px 30px;
    border-radius: var(--r-pill);
    font-size: 14px;
    font-weight: 600;
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
  }
  .view-toggle .vt-btn.active { background: var(--dark); color: #fff; }

  /* Vista LISTA: pannello bianco arrotondato che copre il bordo dell'header */
  .vismar-map-app .colonna-sinistra {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: none;
    margin-top: -18px;
    border: none;
    border-radius: 24px 24px 0 0;
    background: var(--surface);
    box-shadow: none;
    z-index: 1310;
  }
  .vismar-map-app .panel-head { display: none; } /* logo già nell'header oro */
  .vismar-map-app #locations-list-container {
    padding: 24px 16px calc(20px + env(safe-area-inset-bottom));
  }
  .vismar-map-app .card-wrapper {
    background: var(--surface-2);
    border-color: transparent;
    box-shadow: none;
    border-radius: 16px;
  }
  .vismar-map-app .card-wrapper.active-card { background: var(--primary); }

  /* Vista MAPPA: pannello mappa arrotondato sotto l'header */
  .vismar-map-app .colonna-destra {
    position: relative;
    inset: auto;
    flex: 1;
    height: auto;
    min-height: 0;
    margin-top: -18px;
    border-radius: 24px 24px 0 0;
    overflow: hidden;
    z-index: 1310;
  }

  /* Alternanza delle viste */
  .vismar-map-app[data-mobile-view="list"] .colonna-destra { display: none; }
  .vismar-map-app[data-mobile-view="map"] .colonna-sinistra { display: none; }
  .vismar-map-app[data-mobile-view="map"] .mobile-header .search-box { display: none; }
  .vismar-map-app[data-mobile-view="map"].has-selection .mobile-info { display: block; }

  /* Su mobile la nuvoletta ancorata al pin non si usa: al suo posto la card */
  .vismar-map-app .gmap-popup { display: none; }

  /* Card popup centrata sullo schermo */
  .mobile-popup.open {
    display: grid;
    position: absolute;
    inset: 0;
    place-items: center;
    padding: 20px;
    z-index: 1400;
    background: rgba(51, 55, 59, 0.45); /* Sfondo per catturare il click */
    pointer-events: auto; /* Abilita i click sull'overlay */
  }
  .mobile-popup-card {
    position: relative;
    pointer-events: auto;
    width: min(320px, 88%);
    background: var(--surface);
    border-radius: 24px;
    padding: 30px 24px 24px;
    box-shadow: 0 18px 50px rgba(51, 55, 59, 0.30);
    text-align: center;
  }
  .mobile-popup-card .mp-close {
    display: block;
    position: absolute;
    top: 2px;
    right: 5px;
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
  }
  .mobile-popup-card h4 {
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
  }
  .mobile-popup-card p {
    margin: 3px 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-muted);
  }
  .mobile-popup-card p.popup-addr-label {
    margin: 12px 0 0;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
  }
  .mobile-popup-card .popup-actions { margin-top: 16px; }

  .locate-btn {
    bottom: calc(22px + env(safe-area-inset-bottom));
    right: 16px;
  }
}

@media (max-width: 480px) {
  .brand-name small { display: none; }
  .nav a span { display: none; }
  .seg-btn { padding: 8px 12px; }
  .panel-head, .search-box { padding-left: 0px; padding-right: 0px; }
  .search-box { margin-left: 16px; margin-right: 16px; }
  #locations-list-container { padding-left: 16px; padding-right: 16px; }
}
