/* ============================================================
   Dovesiva.it — Design System v3
   Header: dark navy/black glassmorphism
   Body/sidebar/panel: bianco pulito, moderne
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --topbar-h: 52px;

  /* ── Colore primario brand: terracotta Dovesiva ── */
  --brand:       #C2562B;
  --brand-dark:  #a04522;
  --brand-light: #d96a3a;
  --brand-pale:  #fdf0ea;
  --brand-rgb:   194, 86, 43;

  /* Palette di supporto */
  --navy-950:    #05051a;
  --navy-900:    #0a0a2e;
  --emerald:     #10b981;
  --rose:        #f43f5e;

  /* Semantici — interfaccia chiara */
  --color-bg:       #fafaf9;
  --color-surface:  #ffffff;
  --color-surface2: #fdf8f6;
  --color-border:   #e8e0db;
  --color-border2:  #d4c9c3;
  --color-text:     #1a1108;
  --color-muted:    #6b5e57;
  --color-primary:  var(--brand);

  /* Gradienti */
  --grad-btn:   linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  --grad-glow:  0 0 20px rgba(var(--brand-rgb), .3);

  /* Font */
  --font:       'Inter', system-ui, sans-serif;
  --header-h:   64px;

  /* Ombre */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.06);
  --shadow-sm:  0 2px 8px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
  --shadow-xl:  0 16px 48px rgba(0,0,0,.14);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 999px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

/* ── Drupal toolbar offset ─────────────────────────────────── */
body.toolbar-horizontal .site-header                   { top: 39px; }
body.toolbar-horizontal.toolbar-tray-open .site-header { top: 79px; }
body.toolbar-horizontal main                           { padding-top: calc(var(--header-h) + 39px); }
body.toolbar-horizontal.toolbar-tray-open main         { padding-top: calc(var(--header-h) + 79px); }

/* ── HEADER — dark, glassmorphism ──────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(5, 5, 26, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,.08);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
}
.site-logo .logo-icon {
  opacity: .95;
  flex-shrink: 0;
}
.site-logo .logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.03em;
  color: #fff;
}
.site-logo .logo-tld {
  font-weight: 300;
  color: rgba(255,255,255,.4);
  letter-spacing: 0;
}

.site-nav { display: flex; gap: .15rem; align-items: center; }

.site-nav a {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .4rem .9rem;
  font-size: .84rem;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  border-radius: var(--radius-xl);
  transition: background .18s, color .18s;
  white-space: nowrap;
}
.site-nav a:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}
.site-nav .nav-cta {
  background: var(--grad-btn);
  color: #fff !important;
  font-weight: 600;
  margin-left: .5rem;
  box-shadow: 0 0 16px rgba(var(--brand-rgb),.4);
}
.site-nav .nav-cta:hover { opacity: .88; }

/* ── Main ──────────────────────────────────────────────────── */
main { padding-top: calc(var(--header-h) + var(--topbar-h)); min-height: 100vh; }

body.toolbar-horizontal main { padding-top: calc(var(--header-h) + var(--topbar-h) + 39px); }
body.toolbar-horizontal.toolbar-tray-open main { padding-top: calc(var(--header-h) + var(--topbar-h) + 79px); }

/* ── Topbar: ricerca + filtri + posizione ──────────────────── */
.topbar {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--color-surface);
  border-bottom: 1.5px solid var(--color-border);
  z-index: 599;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
body.toolbar-horizontal .topbar { top: calc(var(--header-h) + 39px); }
body.toolbar-horizontal.toolbar-tray-open .topbar { top: calc(var(--header-h) + 79px); }

/* ── Selettore città ───────────────────────────────────────── */
.city-selector {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: .35rem .75rem;
  color: var(--color-muted);
  flex-shrink: 0;
  transition: border-color .18s;
}
.city-selector:focus-within { border-color: var(--brand); }
.city-select {
  border: none;
  background: none;
  outline: none;
  font-size: .85rem;
  font-family: var(--font);
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: .4rem .875rem;
  flex-shrink: 0;
  width: 200px;
  transition: border-color .18s, box-shadow .18s;
}
.topbar-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb),.1);
}
.topbar-search-input {
  border: none; background: none; outline: none;
  font-size: .85rem; font-family: var(--font);
  color: var(--color-text); width: 100%;
}
.topbar-search-input::placeholder { color: #94a3b8; }

.topbar-filters {
  display: flex;
  gap: .35rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar-filters::-webkit-scrollbar { display: none; }

/* Geolocate nella topbar — non più assoluto sulla mappa */
.topbar .geolocate-btn {
  position: static;
  flex-shrink: 0;
  padding: .4rem 1rem;
  height: 34px;
  font-size: .82rem;
  border-radius: var(--radius-xl);
}

/* ── Layout mappa ──────────────────────────────────────────── */
.page-map {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - var(--header-h) - var(--topbar-h));
}

body.toolbar-horizontal .page-map {
  height: calc(100vh - var(--header-h) - var(--topbar-h) - 78px);
}
body.toolbar-horizontal.toolbar-tray-open .page-map {
  height: calc(100vh - var(--header-h) - var(--topbar-h) - 158px);
}

/* ── Sidebar — bianca, solo lista ──────────────────────────── */
.sidebar-panel {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 2px 0 12px rgba(0,0,0,.05);
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .85rem;
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  color: var(--color-muted);
  font-family: var(--font);
  transition: all .18s;
}
.filter-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: rgba(var(--brand-rgb),.05);
}
.filter-btn.active {
  background: var(--grad-btn);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 10px rgba(var(--brand-rgb),.35);
}

/* ── Lista POI ─────────────────────────────────────────────── */
.poi-list {
  flex: 1;
  overflow-y: auto;
  padding: .5rem .625rem;
  background: var(--color-surface);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}
.poi-list::-webkit-scrollbar { width: 4px; }
.poi-list::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

.poi-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .15s;
  margin-bottom: 2px;
}
.poi-card:hover {
  background: var(--color-surface2);
  border-color: var(--color-border);
}
.poi-card.active {
  background: rgba(var(--brand-rgb),.06);
  border-color: rgba(var(--brand-rgb),.25);
}

.poi-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.poi-card-icon.attrazioni { background: #fef9ec; }
.poi-card-icon.ristoranti { background: #ecfdf5; }
.poi-card-icon.hotel      { background: #eff6ff; }
.poi-card-icon.eventi     { background: #fff1f2; }
.poi-card-icon.bus        { background: #f0f0ff; }

.poi-card-name {
  font-size: .875rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--color-text);
}
.poi-card-sub { font-size: .75rem; color: var(--color-muted); margin-top: 1px; }

.poi-card-distance {
  font-size: .72rem; font-weight: 600;
  color: var(--brand);
  background: rgba(var(--brand-rgb),.08);
  padding: .15rem .5rem;
  border-radius: var(--radius-xl);
  flex-shrink: 0;
}

/* ── Mappa ─────────────────────────────────────────────────── */
#dovesiva-map { width: 100%; height: 100%; }

/* ── Info Panel — bianco ───────────────────────────────────── */
.info-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.25rem 1.5rem 1.5rem;
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.4,0,.2,1);
  z-index: 500;
  max-height: 68%;
  overflow-y: auto;
  box-shadow: 0 -4px 32px rgba(0,0,0,.10);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}
.info-panel.open { transform: translateY(0); }

.info-panel-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: .75rem; gap: 1rem;
}
.info-panel-title {
  font-size: 1.2rem; font-weight: 800;
  letter-spacing: -.02em; color: var(--color-text);
}
.info-panel-category {
  font-size: .68rem; font-weight: 700;
  padding: .25rem .75rem;
  border-radius: var(--radius-xl);
  background: var(--grad-btn);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(var(--brand-rgb),.3);
}
.info-panel-close {
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; cursor: pointer; color: var(--color-muted);
  transition: all .18s; flex-shrink: 0;
}
.info-panel-close:hover { background: #fef2f2; border-color: var(--rose); color: var(--rose); }

.info-panel-meta {
  display: flex; flex-wrap: wrap;
  gap: .35rem 1.25rem;
  font-size: .82rem; color: var(--color-muted);
  margin-bottom: .875rem;
}
.info-panel-meta span { display: flex; align-items: center; gap: .3rem; }

.info-panel-desc {
  font-size: .875rem; line-height: 1.75;
  color: #475569; margin-bottom: 1rem;
}

/* Bus section */
.bus-section { margin-top: 1rem; }
.bus-section-title {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--color-muted); margin-bottom: .6rem;
}
.bus-list { display: flex; flex-direction: column; gap: .375rem; }
.bus-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .875rem;
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: .83rem;
}
.bus-badge {
  background: var(--grad-btn); color: #fff; font-weight: 700;
  padding: .15rem .55rem; border-radius: var(--radius-sm);
  font-size: .74rem; min-width: 36px; text-align: center;
}
.bus-stop-name { flex: 1; font-weight: 500; color: var(--color-text); }
.bus-times { color: var(--color-muted); font-size: .74rem; }

/* ── Map area wrapper ──────────────────────────────────────── */
.map-area { position: relative; flex: 1; }

/* ── GTFS status bar — discreta, auto-nascosta ─────────────── */
.gtfs-status-bar {
  position: absolute;
  bottom: .75rem; left: .75rem;
  z-index: 600;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: .35rem .9rem;
  font-size: .75rem; font-weight: 500;
  color: var(--color-muted);
  box-shadow: var(--shadow-sm);
  transition: opacity .5s;
}
.gtfs-status-bar.loaded { color: var(--emerald); border-color: rgba(16,185,129,.3); }
.gtfs-status-bar.hidden { opacity: 0; pointer-events: none; }

/* ── Sezione direzioni nel pannello info ───────────────────── */
.directions-section {
  margin-top: 1rem;
  border-top: 1.5px solid var(--color-border);
  padding-top: 1rem;
}
.directions-header {
  display: flex; align-items: center; gap: .4rem;
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--color-muted);
  margin-bottom: .875rem;
}

.direction-step {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .75rem;
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: .4rem;
}
.step-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 800; flex-shrink: 0;
}
.step-user { background: rgba(var(--brand-rgb),.12); color: var(--brand); font-size: .65rem; }
.step-dest { background: rgba(245,158,11,.12); font-size: 1rem; }
.step-body { flex: 1; min-width: 0; }
.step-label { font-size: .7rem; color: var(--color-muted); margin-bottom: 1px; }
.step-stop  { font-size: .83rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-dist  { font-size: .72rem; color: var(--brand); font-weight: 600; background: rgba(var(--brand-rgb),.08); padding: .15rem .45rem; border-radius: 20px; flex-shrink: 0; }

.direction-lines-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--color-muted);
  text-align: center;
  margin-bottom: .35rem;
}
.direction-lines {
  display: flex; align-items: center; justify-content: center;
  padding: 0 0 .25rem; gap: .4rem;
}
.line-pills { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; }
.line-pill {
  padding: .25rem .65rem;
  border-radius: var(--radius-sm);
  color: #fff; font-weight: 700; font-size: .78rem;
  min-width: 32px; text-align: center;
}
.line-pill-placeholder { font-size: .8rem; color: var(--color-muted); }

.directions-note {
  font-size: .75rem; color: var(--color-muted);
  text-align: center; margin-top: .5rem; line-height: 1.5;
}
.dir-note, .dir-loading { font-size: .8rem; color: var(--color-muted); text-align: center; }

/* ── Orari partenze ─────────────────────────────────────────── */
.bus-section-title {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-muted); margin-bottom: .5rem;
}
.departure-list { display: flex; flex-direction: column; gap: .3rem; }
.departure-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .45rem .75rem;
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
}
.departure-line {
  color: #fff; font-weight: 700; font-size: .78rem;
  padding: .15rem .55rem; border-radius: var(--radius-sm);
  min-width: 36px; text-align: center;
}
.departure-time {
  font-size: .95rem; font-weight: 700;
  color: var(--color-text); letter-spacing: .02em;
  margin-left: auto;
}
.departure-times-list {
  font-size: .9rem; font-weight: 600;
  color: var(--color-text);
  letter-spacing: .02em;
  margin-left: auto;
}

/* ── Marker fermate bus sulla mappa ────────────────────────── */
.stop-marker {
  width: 38px; height: 38px;
  border-radius: 50% 50% 50% 2px;
  transform: rotate(-45deg);
  border: 2.5px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
}
.stop-marker span { transform: rotate(45deg); }
.stop-marker-from {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 3px 12px rgba(var(--brand-rgb),.5);
}
.stop-marker-to {
  background: linear-gradient(135deg, #1a1108, #2d1f10);
  box-shadow: 0 3px 12px rgba(0,0,0,.35);
}

/* Pulsante "Attiva posizione" nel pannello ─────────────────── */
.geo-prompt-btn {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; margin-top: 1rem;
  padding: .65rem 1rem;
  background: var(--grad-btn);
  color: #fff; border: none; border-radius: var(--radius-md);
  font-size: .85rem; font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: opacity .15s;
  box-shadow: 0 2px 10px rgba(var(--brand-rgb),.3);
}
.geo-prompt-btn:hover { opacity: .88; }

/* ── Geolocate btn — nella topbar ──────────────────────────── */
.geolocate-btn {
  display: flex; align-items: center; gap: .45rem;
  padding: .4rem 1rem;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  font-size: .82rem; font-weight: 600; font-family: var(--font);
  cursor: pointer; color: var(--color-text);
  transition: all .2s;
  white-space: nowrap;
}
.geolocate-btn:hover {
  border-color: var(--brand); color: var(--brand);
}
.geolocate-btn.active {
  background: var(--grad-btn);
  border-color: transparent; color: #fff;
  box-shadow: 0 2px 10px rgba(var(--brand-rgb),.3);
}

/* ── Leaflet overrides ─────────────────────────────────────── */
.leaflet-control-zoom {
  border: 1.5px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
  box-shadow: var(--shadow-md) !important;
}
.leaflet-control-zoom a {
  background: var(--color-surface) !important;
  color: var(--color-text) !important;
  border-bottom: 1px solid var(--color-border) !important;
  font-size: 1.1rem !important;
  width: 32px !important; height: 32px !important;
  line-height: 32px !important;
  font-weight: 600;
}
.leaflet-control-zoom a:hover {
  background: var(--color-surface2) !important;
  color: var(--brand) !important;
}
.leaflet-control-attribution { display: none !important; }

.leaflet-popup-content-wrapper {
  background: var(--color-surface) !important;
  border: 1.5px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-xl) !important;
  padding: 0 !important; overflow: hidden;
}
.leaflet-popup-tip-container { display: none; }
.leaflet-popup-close-button { display: none !important; }
.popup-inner { padding: .9rem 1rem; min-width: 195px; }
.popup-inner h4 { font-size: .92rem; font-weight: 700; color: var(--color-text); margin-bottom: .25rem; }
.popup-inner p  { font-size: .77rem; color: var(--color-muted); margin-bottom: .7rem; }
.popup-btn {
  display: block; width: 100%; padding: .5rem;
  background: var(--grad-btn); color: #fff;
  text-align: center; font-size: .8rem; font-weight: 700;
  cursor: pointer; border: none; border-radius: var(--radius-sm);
  font-family: var(--font); letter-spacing: .02em; transition: opacity .15s;
}
.popup-btn:hover { opacity: .85; }

/* Marker */
.custom-marker {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50% 50% 50% 2px;
  transform: rotate(-45deg);
  border: 2px solid rgba(255,255,255,.6);
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
  font-size: .9rem;
}
.custom-marker .icon { transform: rotate(45deg); }
.marker-attrazioni { background: linear-gradient(135deg,#f59e0b,#f97316); }
.marker-ristoranti { background: linear-gradient(135deg,#10b981,#06b6d4); }
.marker-hotel      { background: linear-gradient(135deg,#3b82f6,var(--brand)); }
.marker-eventi     { background: linear-gradient(135deg,#ec4899,#f43f5e); }
.marker-bus        { background: linear-gradient(135deg,var(--brand),#8b5cf6); border-radius: var(--radius-sm); transform: none; }

/* ── Spinner ───────────────────────────────────────────────── */
.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--color-border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: .5rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy-950);
  color: rgba(255,255,255,.4);
  padding: 1.5rem 1.75rem;
  font-size: .82rem; text-align: center;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ══ MOBILE-ONLY COMPONENTS ═══════════════════════════════════ */

/* Visibilità condizionale */
.mobile-only { display: none; }
.desktop-only { display: flex; flex-direction: column; }

/* ── Filtri floating sulla mappa ─────────────────────────────── */
.m-filters {
  position: fixed;
  bottom: calc(var(--m-card-h, 0px) + .75rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 700;
  display: flex;
  gap: .4rem;
  padding: .45rem .65rem;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  transition: bottom .3s ease;
}
.m-filter {
  padding: .35rem .75rem;
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--color-border);
  background: transparent;
  font-size: .8rem; font-weight: 600;
  cursor: pointer; font-family: var(--font);
  color: var(--color-muted);
  transition: all .18s;
  white-space: nowrap;
}
.m-filter.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.m-filter:not(.active):hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* ── Card POI compatta (bottom) ──────────────────────────────── */
.m-poi-card {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 800;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  padding: 0 .75rem .75rem;
  pointer-events: none;
}
.m-poi-card.open {
  transform: translateY(0);
  pointer-events: all;
}
.m-poi-card-inner {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: .875rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  box-shadow: 0 -2px 24px rgba(0,0,0,.12), var(--shadow-lg);
}
.m-poi-icon {
  font-size: 1.4rem;
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: #fef3e8;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.m-poi-info { flex: 1; min-width: 0; }
.m-poi-name {
  font-size: .95rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-poi-address { font-size: .78rem; color: var(--color-muted); margin-top: 1px; }

.m-bus-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--brand);
  border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(194,86,43,.4);
  transition: opacity .15s;
}
.m-bus-btn:hover { opacity: .85; }

.m-poi-close {
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  width: 28px; height: 28px;
  font-size: .75rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--color-muted);
  flex-shrink: 0; align-self: flex-start;
}

/* ── Sheet direzioni — due stati: peek e open ────────────────── */
.m-dir-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 900;
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 32px rgba(0,0,0,.15);
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  max-height: 88vh;
  overflow-y: hidden;
  padding: 0 1.1rem 2rem;
}

/* Peek: mostra solo handle + header (~130px) */
.m-dir-sheet.peek {
  transform: translateY(calc(100% - 130px));
  overflow-y: hidden;
}

/* Open: tutto visibile, scrollabile */
.m-dir-sheet.open {
  transform: translateY(0);
  overflow-y: auto;
  scrollbar-width: none;
}
.m-dir-sheet.open::-webkit-scrollbar { display: none; }

.m-dir-handle {
  width: 40px; height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  margin: .75rem auto .5rem;
}

.m-dir-header {
  display: flex; align-items: center;
  gap: .75rem; padding: .5rem 0 .875rem;
  border-bottom: 1.5px solid var(--color-border);
  margin-bottom: .875rem;
  cursor: pointer; /* click espande/richiude */
}
.m-dir-back {
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--color-text);
  flex-shrink: 0;
}
.m-dir-title { flex: 1; }
.m-dir-to {
  font-size: .95rem; font-weight: 700;
  display: block;
}
/* Pulsante toggle ↑↓ */
.m-dir-toggle {
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--color-muted);
  flex-shrink: 0; font-size: 1rem;
  transition: all .2s;
}
.m-dir-toggle:hover { border-color: var(--brand); color: var(--brand); }

/* Fermate */
.m-dir-stops {
  background: var(--color-surface2);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: .75rem;
  margin-bottom: .875rem;
  position: relative;
}
.m-dir-stop {
  display: flex; align-items: center; gap: .75rem; padding: .25rem 0;
}
.m-dir-line {
  width: 2px; height: 18px;
  background: var(--color-border);
  margin: 4px 0 4px 9px;
}
.m-stop-dot {
  width: 20px; height: 20px; border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.dot-user { background: rgba(194,86,43,.15); border: 2px solid var(--brand); }
.dot-dest { background: rgba(99,102,241,.15); border: 2px solid var(--indigo-500); }
.m-stop-info { flex: 1; min-width: 0; }
.m-stop-label { font-size: .7rem; color: var(--color-muted); }
.m-stop-name { font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-stop-dist { font-size: .75rem; font-weight: 600; color: var(--brand); background: rgba(194,86,43,.08); padding: .15rem .45rem; border-radius: 20px; flex-shrink: 0; }

/* Linee bus */
.m-dir-bus {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: .875rem; flex-wrap: wrap;
}
.m-dir-bus-label { font-size: .82rem; font-weight: 600; color: var(--color-muted); flex-shrink: 0; }
.m-dir-lines { display: flex; flex-wrap: wrap; gap: .35rem; }

/* Orari */
.m-dir-times { margin-top: .25rem; }
.m-dir-times-label {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--color-muted); margin-bottom: .5rem;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .page-map { grid-template-columns: 260px 1fr; }
}

@media (max-width: 768px) {
  .site-nav { display: none; }

  /* Attiva elementi mobile */
  .mobile-only { display: flex !important; }
  .desktop-only { display: none !important; }

  /* Topbar mobile: ricerca + pulsante posizione */
  :root { --topbar-h: 52px; }
  .topbar { padding: .4rem .75rem; height: var(--topbar-h); }
  .topbar-search { flex: 1; }
  .topbar-filters { display: none; }
  .topbar .geolocate-btn { display: flex !important; padding: .4rem .75rem; }
  .topbar .geolocate-btn #geo-label { display: none; }
  .topbar .geolocate-btn.active #geo-label { display: inline; font-size: .78rem; }

  /* Mappa FULL SCREEN */
  .page-map {
    display: block;
    height: calc(100dvh - var(--header-h) - var(--topbar-h));
  }
  .map-area { width: 100%; height: 100%; position: relative; }
  #dovesiva-map { width: 100%; height: 100%; }

  /* Drupal toolbar offsets */
  body.toolbar-horizontal .page-map {
    height: calc(100dvh - var(--header-h) - var(--topbar-h) - 78px);
  }
  body.toolbar-horizontal.toolbar-tray-open .page-map {
    height: calc(100dvh - var(--header-h) - var(--topbar-h) - 158px);
  }
}
