/* =============================================================
   GasApp 2026 — Design System
   Mobile-first · Inter · Glassmorphism · Responsive
============================================================= */

[hidden] { display: none !important; }

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --red:          #e63946;
  --red-d:        #c1121f;
  --red-l:        rgba(230,57,70,.09);
  --blue:         #3b82f6;
  --green:        #10b981;
  --amber:        #f59e0b;

  --c-bg:         #f4f5f9;
  --c-surface:    #ffffff;
  --c-surface2:   #f0f1f7;
  --c-border:     #e2e4ef;
  --c-text:       #111827;
  --c-muted:      #6b7280;
  --c-primary:    var(--red);
  --c-primary-d:  var(--red-d);
  --c-primary-l:  var(--red-l);
  --c-accent:     var(--blue);
  --c-header:     #0d0e1c;

  --r-sm:  8px;
  --r:     12px;
  --r-lg:  18px;
  --r-xl:  24px;

  --sh-xs: 0 1px 2px rgba(0,0,0,.05);
  --sh-sm: 0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --sh:    0 4px 8px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
  --sh-md: 0 10px 20px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);
  --sh-lg: 0 20px 40px rgba(0,0,0,.1),  0 8px 16px rgba(0,0,0,.04);

  --ease:  cubic-bezier(.4,0,.2,1);
  --t:     .2s var(--ease);
  --t-sm:  .12s var(--ease);

  --header-h: 58px;
  --search-h: 112px;
}

body.theme-dark {
  --c-bg:      #0b0c18;
  --c-surface: #12141f;
  --c-surface2:#1a1d2e;
  --c-border:  #252840;
  --c-text:    #eceef8;
  --c-muted:   #8890b0;
  --c-header:  #080912;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t), color var(--t);
}
a { color: inherit; }
button { font-family: inherit; }

/* ── Accesibilidad ─────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Cabecera ──────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--c-header);
  border-bottom: 1px solid rgba(255,255,255,.05);
  box-shadow: 0 2px 20px rgba(0,0,0,.25);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 1.25rem;
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: .55rem;
  text-decoration: none;
  color: #fff;
}
.logo-icon {
  width: 34px; height: 34px;
  background: var(--red);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  box-shadow: 0 3px 10px rgba(230,57,70,.45);
  flex-shrink: 0;
}
.logo-text {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.5px;
  color: #fff;
}

.header-actions { display: flex; align-items: center; gap: .35rem; }

.data-warning {
  background: rgba(245,158,11,.15);
  border-top: 1px solid rgba(245,158,11,.2);
  color: #fcd34d;
  text-align: center;
  font-size: .78rem;
  font-weight: 500;
  padding: .3rem 1rem;
}
.data-ok {
  background: rgba(16,185,129,.12);
  border-top: 1px solid rgba(16,185,129,.15);
  color: #34d399;
  text-align: center;
  font-size: .78rem;
  padding: .25rem 1rem;
}

.icon-btn {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  cursor: pointer;
  font-size: .95rem;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.85);
  transition: background var(--t), border-color var(--t);
}
.icon-btn:hover {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.2);
}

.user-nav-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  color: rgba(255,255,255,.85);
  text-decoration: none;
  font-size: .82rem;
  font-weight: 500;
  padding: .35rem .75rem;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  transition: all var(--t);
}
.user-nav-btn:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); }
.user-nav-btn i { font-size: 1rem; }

/* ── Barra de búsqueda ─────────────────────────────────────── */
.search-bar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: .75rem 1rem;
  position: sticky;
  top: var(--header-h);
  z-index: 1100;
  box-shadow: 0 4px 12px rgba(0,0,0,.05);
}

.search-row {
  display: flex;
  gap: .5rem;
  margin-bottom: .55rem;
}

.search-input-wrap { flex: 1; position: relative; }

.search-icon {
  position: absolute;
  left: .9rem; top: 50%;
  transform: translateY(-50%);
  color: var(--c-muted);
  font-size: .8rem;
  pointer-events: none;
}

.search-clear-btn {
  position: absolute; right: .6rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--c-muted); font-size: .9rem; padding: .3rem;
  line-height: 1; border-radius: 50%;
  transition: color var(--t-sm), background var(--t-sm);
}
.search-clear-btn:hover { color: var(--c-text); background: var(--c-surface2); }

.input-search {
  width: 100%;
  padding: .72rem 2rem .72rem 2.4rem; /* espacio derecho para el botón ✕ */
  border: 1.5px solid var(--c-border);
  border-radius: 30px;
  font-size: .9rem;
  font-family: inherit;
  background: var(--c-bg);
  color: var(--c-text);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.input-search:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-l);
  background: var(--c-surface);
}

.suggestions-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  box-shadow: var(--sh-md);
  max-height: 280px;
  overflow-y: auto;
  z-index: 1100;
  display: none;
}
.suggestions-list.open { display: block; }

.suggestion-item {
  padding: .55rem .9rem;
  cursor: pointer;
  font-size: .87rem;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: .6rem;
  transition: background var(--t-sm);
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--c-surface2); }
.suggestion-item--search {
  background: var(--c-primary-l);
  font-weight: 600;
  color: var(--c-primary);
  border-radius: var(--r) var(--r) 0 0;
}
.suggestion-item--search:hover { background: rgba(230,57,70,.14); }
.sug-icon-wrap {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--c-surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; color: var(--c-muted); flex-shrink: 0;
}
.suggestion-item--search .sug-icon-wrap { background: var(--c-primary); color: #fff; }
.sug-label { flex: 1; }
.suggestion-type {
  font-size: .67rem; color: var(--c-muted);
  background: var(--c-surface2);
  padding: 1px 7px; border-radius: 4px; white-space: nowrap;
}

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}

.select-filter {
  flex: 1;
  min-width: 120px;
  padding: .55rem .75rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color var(--t);
}
.select-filter:focus { border-color: var(--c-primary); }

/* ── Botones ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem;
  padding: .62rem 1.1rem;
  border: none; border-radius: var(--r-sm);
  cursor: pointer;
  font-size: .85rem; font-weight: 600; font-family: inherit;
  white-space: nowrap;
  letter-spacing: -.01em;
  transition: all var(--t);
}
.btn:active { transform: scale(.96); }

.btn-primary {
  background: var(--c-primary); color: #fff;
  box-shadow: 0 2px 8px rgba(230,57,70,.3);
}
.btn-primary:hover {
  background: var(--c-primary-d);
  box-shadow: 0 4px 14px rgba(230,57,70,.4);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--c-accent); color: #fff;
  box-shadow: 0 2px 8px rgba(59,130,246,.3);
}
.btn-accent:hover {
  background: #2563eb;
  box-shadow: 0 4px 14px rgba(59,130,246,.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--c-border);
  color: var(--c-text);
}
.btn-outline:hover { background: var(--c-surface2); border-color: var(--c-muted); }

.btn-sm { padding: .4rem .85rem; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-label { display: none; }
@media (min-width: 420px) { .btn-label { display: inline; } }

/* ── Layout principal ────────────────────────────────────── */
.app-main {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 48vw 1fr;
}

@media (min-width: 768px) {
  .app-main {
    grid-template-columns: 380px 1fr;
    grid-template-rows: 1fr;
    height: calc(100dvh - var(--header-h) - var(--search-h));
  }
  .map-container { order: 2; }
  .sidebar       { order: 1; }
}

@media (min-width: 1200px) {
  .app-main { grid-template-columns: 420px 1fr; }
}

/* ── Mapa ────────────────────────────────────────────────── */
.map-container {
  position: relative; width: 100%; height: 100%; min-height: 280px;
}

#map {
  width: 100%; height: 100%; background: #e5e7eb;
  isolation: isolate;
}

/* Los controles de Leaflet nunca deben superar la barra de búsqueda */
.leaflet-top,
.leaflet-bottom {
  z-index: 800 !important;
}

/* Botón "Buscar en esta zona" flotante sobre el mapa */
.btn-search-area {
  position: absolute; top: .85rem; left: 50%;
  transform: translateX(-50%) translateY(-6px);
  z-index: 790;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: 20px;
  padding: .48rem 1rem;
  font-family: inherit; font-size: .83rem; font-weight: 600;
  color: var(--c-text); cursor: pointer; white-space: nowrap;
  box-shadow: var(--sh-md);
  display: inline-flex; align-items: center; gap: .45rem;
  opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease), box-shadow var(--t);
}
.btn-search-area.visible {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.btn-search-area:hover { background: var(--c-surface2); box-shadow: var(--sh-lg); }

/* Dark mode: tiles de Leaflet y popups */
body.theme-dark .leaflet-popup-content-wrapper {
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  box-shadow: var(--sh-md);
}
body.theme-dark .leaflet-popup-tip {
  background: var(--c-surface);
}
body.theme-dark .leaflet-popup a { color: var(--c-primary); }
body.theme-dark .leaflet-control-zoom a {
  background: var(--c-surface); color: var(--c-text);
  border-color: var(--c-border);
}
body.theme-dark .leaflet-control-zoom a:hover { background: var(--c-surface2); }
body.theme-dark .leaflet-control-attribution {
  background: rgba(18,20,31,.75); color: var(--c-muted);
}
body.theme-dark .leaflet-control-attribution a { color: #93c5fd; }

.map-loading {
  display: none; position: absolute; inset: 0;
  background: rgba(255,255,255,.55);
  align-items: center; justify-content: center; z-index: 800;
}
.map-loading.visible { display: flex; }
body.theme-dark .map-loading.visible { background: rgba(0,0,0,.45); }

.spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  background: var(--c-bg);
  border-right: 1px solid var(--c-border);
  overflow-y: auto;
  display: flex; flex-direction: column;
}

.sidebar-header {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0;
  background: var(--c-surface);
  z-index: 10;
  box-shadow: var(--sh-xs);
}

.sidebar-title {
  font-size: .95rem; font-weight: 700; color: var(--c-text);
}
.sidebar-header-actions {
  display: flex; align-items: center; gap: .35rem;
}

/* ── Skeleton ────────────────────────────────────────────── */
.skeleton-list { padding: .75rem; display: flex; flex-direction: column; gap: .65rem; }

.skeleton-card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r); padding: 1rem;
}
.skel { background: var(--c-surface2); border-radius: 4px; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
.skel-title  { height: 15px; width: 55%; margin-bottom: .6rem; }
.skel-text   { height: 11px; width: 80%; margin-bottom: .5rem; }
.skel-price  { height: 20px; width: 28%; }

/* ── Lista de estaciones ─────────────────────────────────── */
.station-list {
  list-style: none; margin: 0; padding: .75rem;
  display: flex; flex-direction: column; gap: .6rem; flex: 1;
}

.station-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: .9rem 1rem;
  cursor: pointer;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  position: relative;
  box-shadow: var(--sh-xs);
}
.station-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
  border-color: rgba(230,57,70,.25);
}
.station-card.active {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-l);
}

.card-brand {
  font-size: .67rem; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; margin-bottom: .2rem;
}
.card-name {
  font-size: .92rem; font-weight: 700; margin-bottom: .22rem; color: var(--c-text);
}
.card-address { font-size: .78rem; color: var(--c-muted); margin-bottom: .45rem; }

.card-meta {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: .4rem; font-size: .76rem; color: var(--c-muted);
}
.card-dist { display: flex; align-items: center; gap: .25rem; }
.card-horario { font-size: .7rem; }

.card-prices {
  display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem;
}

.price-badge {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: .3rem .55rem;
  font-size: .78rem;
  display: flex; flex-direction: column; align-items: center; gap: .18rem;
  min-width: 60px;
}
.fuel-tag {
  color: #fff; font-size: .58rem; font-weight: 800;
  padding: 1px 5px; border-radius: 3px; letter-spacing: .04em;
  text-transform: uppercase;
}
.price-badge .fuel-val { font-weight: 700; color: var(--c-text); font-size: .8rem; }
.price-badge.cheapest { box-shadow: 0 0 0 2px var(--c-primary); }

.card-actions {
  display: flex; gap: .4rem; margin-top: .65rem;
}
.card-actions .btn { flex: 1; font-size: .77rem; padding: .45rem .5rem; }

.fav-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.05rem; padding: .3rem;
  position: absolute; top: .65rem; right: .65rem;
  color: var(--c-muted); transition: color var(--t), transform var(--t-sm);
}
.fav-btn:hover { color: #f59e0b; transform: scale(1.15); }

/* Badges recomendación */
.reco-badge {
  background: linear-gradient(135deg, #065f46, #10b981);
  color: #fff; font-size: .69rem; font-weight: 700;
  padding: .28rem .65rem; border-radius: 5px;
  margin-bottom: .4rem;
  display: inline-flex; align-items: center; gap: .3rem;
}
.station-card.reco-card { border-color: #10b981; }

/* ── Estado vacío ────────────────────────────────────────── */
.empty-state {
  flex: 1; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 2rem;
  color: var(--c-muted); font-size: .92rem;
}
.empty-state-inner { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.empty-icon { font-size: 2.2rem; color: var(--c-border); }

/* ── Load more / favoritos ───────────────────────────────── */
.load-more-wrap { padding: .75rem; text-align: center; }

.favorites-panel {
  padding: 1rem;
  border-top: 1px solid var(--c-border);
}
.favorites-panel h3 { margin: 0 0 .75rem; font-size: .95rem; font-weight: 700; }

/* ── Modal detalle ───────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal-overlay.open { display: flex; animation: fadeIn .18s var(--ease); }
@media (min-width: 600px) { .modal-overlay.open { align-items: center; padding: 1rem; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.modal {
  background: var(--c-surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%; max-width: 580px;
  max-height: 88dvh; overflow-y: auto;
  padding: 1.75rem;
  position: relative;
  box-shadow: var(--sh-lg);
  animation: slideUp .22s var(--ease);
}
@media (min-width: 600px) { .modal { border-radius: var(--r-xl); } }
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: var(--c-surface2); border: none;
  border-radius: 50%; width: 32px; height: 32px;
  cursor: pointer; font-size: .9rem; color: var(--c-text);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t);
}
.modal-close:hover { background: var(--c-border); }
.modal h2 { margin: 0 0 .35rem; font-size: 1.15rem; font-weight: 800; padding-right: 2.5rem; }

.modal-prices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: .55rem; margin: 1.1rem 0;
}
/* modal-price-item definido abajo junto a fuel-badge */

.modal-price-item {
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: .65rem .75rem; text-align: center;
}
.fuel-badge {
  color: #fff; font-size: .6rem; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
  display: inline-block; margin-bottom: .28rem; letter-spacing: .04em;
}
.modal-price-item .fuel-lbl { font-size: .68rem; color: var(--c-muted); margin-bottom: .15rem; }
.modal-price-item .fuel-num { font-size: .95rem; font-weight: 700; color: var(--c-text); }

.modal-meta { font-size: .83rem; color: var(--c-muted); margin: .35rem 0; }
.modal-actions { display: flex; gap: .55rem; flex-wrap: wrap; margin-top: 1.1rem; }
.modal-actions .btn { flex: 1; }

/* ── Leaflet popup ───────────────────────────────────────── */
.leaflet-popup-content-wrapper { border-radius: var(--r) !important; box-shadow: var(--sh-md) !important; }
.popup-inner { min-width: 190px; }
.popup-brand { font-size: .67rem; font-weight: 800; text-transform: uppercase; margin-bottom: .2rem; }
.popup-name  { font-weight: 700; font-size: .9rem; margin: .15rem 0; }
.popup-price { font-size: .95rem; font-weight: 700; margin: .25rem 0; }
.popup-link  {
  display: inline-block; margin-top: .4rem;
  background: var(--c-primary); color: #fff;
  padding: .3rem .8rem; border-radius: 6px;
  text-decoration: none; font-size: .8rem; font-weight: 600;
}

/* ── Brand filter multi-select ───────────────────────────── */
.brand-filter { position: relative; }

.brand-filter-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem .75rem;
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-bg); color: var(--c-text);
  font-size: .85rem; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: all var(--t); min-width: 145px;
}
.brand-filter-btn:hover { border-color: var(--c-primary); }
.brand-filter-btn--active {
  border-color: var(--c-primary);
  background: var(--c-primary-l);
  color: var(--c-primary); font-weight: 700;
}
.brand-chevron { font-size: .65rem; margin-left: auto; transition: transform var(--t); }

.brand-filter-dropdown {
  position: absolute; top: calc(100% + 5px); left: 0;
  min-width: 240px; max-width: 300px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r); box-shadow: var(--sh-lg);
  z-index: 1200; display: flex; flex-direction: column;
  max-height: 360px;
}
.brand-search-wrap {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-muted);
}
.brand-search-wrap input {
  flex: 1; border: none; outline: none;
  background: none; font-size: .88rem; font-family: inherit; color: var(--c-text);
}
.brand-filter-list { overflow-y: auto; flex: 1; padding: .3rem 0; }

.brand-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem .9rem;
  cursor: pointer; font-size: .84rem; color: var(--c-text);
  transition: background var(--t-sm);
}
.brand-item:hover { background: var(--c-surface2); }
.brand-item--checked { background: var(--c-surface2); font-weight: 600; }
.brand-item input { display: none; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.brand-item-name { flex: 1; }
.brand-check { color: var(--c-primary); font-size: .72rem; }
.brand-no-results { padding: .85rem; text-align: center; color: var(--c-muted); font-size: .84rem; }
.brand-separator {
  padding: .3rem .85rem .2rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--c-muted);
  border-top: 1px solid var(--c-border); margin-top: .2rem;
}
.brand-separator:first-child { border-top: none; margin-top: 0; }

.brand-filter-footer { padding: .5rem .85rem; border-top: 1px solid var(--c-border); }
.brand-filter-footer button {
  background: none; border: none;
  color: var(--c-muted); font-size: .8rem; font-family: inherit;
  cursor: pointer; display: flex; align-items: center; gap: .3rem;
}
.brand-filter-footer button:hover { color: var(--c-primary); }

/* ── Hover sobre marcadores del mapa (desktop) ───────────── */
.station-hover-tooltip {
  background: var(--c-surface) !important;
  border: 1px solid var(--c-border) !important;
  border-radius: var(--r-sm) !important;
  box-shadow: var(--sh-md) !important;
  padding: .45rem .65rem !important;
  font-family: inherit !important;
  font-size: .78rem !important;
  color: var(--c-text) !important;
  white-space: nowrap;
}
.station-hover-tooltip::before { display: none !important; }
.leaflet-tooltip.station-hover-tooltip::before {
  border-top-color: var(--c-border) !important;
}
.station-card.map-hover {
  background: var(--c-surface2);
  box-shadow: var(--sh-md);
  transform: translateX(2px);
}

/* ── Modo Viaje ──────────────────────────────────────────── */
.btn-travel-mode--active {
  background: var(--c-primary-l);
  border-color: var(--c-primary);
  color: var(--c-primary);
}

.travel-panel {
  padding: .6rem .85rem .5rem;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  display: flex; flex-direction: column; gap: .5rem;
}

.travel-inputs { display: flex; flex-direction: column; gap: 0; }

.travel-input-row {
  display: flex; align-items: center; gap: .5rem; position: relative;
}

.travel-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.travel-dot--start { background: var(--c-primary); }
.travel-dot--end   { background: #10b981; }

.travel-line-connector {
  width: 2px; height: 16px; background: var(--c-border);
  margin-left: 5px;
}

.travel-input {
  flex: 1; padding: .45rem .65rem;
  border: 1.5px solid var(--c-border); border-radius: var(--r-sm);
  background: var(--c-surface2); color: var(--c-text);
  font-family: inherit; font-size: .84rem;
  transition: border-color var(--t);
}
.travel-input:focus { outline: none; border-color: var(--c-primary); }

.travel-geo-btn {
  background: none; border: none; cursor: pointer;
  color: var(--c-primary); font-size: 1rem; padding: .3rem;
  transition: color var(--t-sm);
}
.travel-geo-btn:hover { color: var(--c-primary-d); }

.travel-suggestions {
  position: absolute;
  top: calc(100% + 4px); left: 12px; right: 0; z-index: 1200;
}

.travel-options-row {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.travel-opt-label { font-size: .8rem; color: var(--c-muted); white-space: nowrap; }

/* Cards en modo viaje con etiqueta de posición */
.travel-station-label {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: .18rem .55rem; border-radius: 99px;
  margin-bottom: .35rem;
}
.travel-label--proxima  { background: #fee2e2; color: #b91c1c; }
.travel-label--mitad    { background: #dbeafe; color: #1d4ed8; }
.travel-label--llegando { background: #dcfce7; color: #15803d; }
.travel-label--barata   { background: #fef9c3; color: #92400e; }

.travel-route-info {
  padding: .5rem .85rem; font-size: .8rem; color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; gap: .5rem;
}

/* Pins A/B del modo viaje en el mapa */
.travel-pin {
  width: 28px; height: 28px; border-radius: 50% 50% 50% 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .75rem; color: #fff;
  transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.travel-pin > * { transform: rotate(45deg); }
.travel-pin--start { background: var(--red, #e63946); }
.travel-pin--end   { background: #10b981; }

/* ── Route picker (bottom sheet móvil) ───────────────────── */
.route-picker-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.52);
  z-index: 3000;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .22s var(--ease);
}
.route-picker-overlay.open { opacity: 1; pointer-events: auto; }

.route-picker-sheet {
  background: var(--c-surface);
  border-radius: 20px 20px 0 0;
  padding: 0 1.25rem 1.5rem;
  width: 100%; max-width: 480px;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}
.route-picker-overlay.open .route-picker-sheet { transform: translateY(0); }

.route-picker-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--c-border); margin: .85rem auto 1.1rem;
}
.route-picker-title {
  font-weight: 700; font-size: 1rem; text-align: center; margin-bottom: .25rem;
}
.route-picker-dest {
  text-align: center; color: var(--c-muted); font-size: .83rem;
  margin-bottom: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.route-picker-options { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }

.route-picker-btn {
  display: flex; align-items: center; gap: .85rem;
  padding: .8rem 1rem;
  border: 1px solid var(--c-border); border-radius: var(--r);
  text-decoration: none; color: var(--c-text);
  font-weight: 500; font-size: .95rem; font-family: inherit;
  background: var(--c-surface); cursor: pointer;
  transition: background var(--t-sm);
}
.route-picker-btn:hover, .route-picker-btn:active { background: var(--c-surface2); }

.route-picker-icon {
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  background: var(--app-color, #4285F4);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem;
}
.route-picker-label { flex: 1; }
.route-picker-chevron { color: var(--c-muted); font-size: .75rem; }

.route-picker-cancel {
  display: block; width: 100%; padding: .75rem;
  background: var(--c-surface2); border: none; border-radius: var(--r);
  font-family: inherit; font-size: .9rem; font-weight: 600;
  color: var(--c-text); cursor: pointer;
  transition: background var(--t-sm);
}
.route-picker-cancel:hover { background: var(--c-border); }

/* ── Footer ──────────────────────────────────────────────── */
.app-footer {
  background: var(--c-header); color: rgba(255,255,255,.4);
  text-align: center; font-size: .75rem; padding: .8rem 1rem;
}
.app-footer a { color: rgba(255,255,255,.6); text-decoration: underline; }
.app-footer a:hover { color: #fff; }

/* ── Marker cluster ──────────────────────────────────────── */
.marker-cluster-small div,
.marker-cluster-medium div { background-color: rgba(230,57,70,.7); }
.marker-cluster-large div  { background-color: rgba(193,18,31,.9); }
.marker-cluster { border: 3px solid rgba(255,255,255,.5); }

/* ── Responsive mobile ───────────────────────────────────── */
@media (max-width: 767px) {
  /* El body ocupa exactamente la pantalla: nunca hay scroll externo */
  body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
  }

  /* Header, barra de búsqueda y footer no se comprimen */
  .app-header,
  .search-bar,
  .app-footer { flex-shrink: 0; }

  /* El main crece para llenar el espacio restante */
  .app-main {
    flex: 1;
    min-height: 0;
    height: auto;
    display: grid;
    grid-template-columns: 1fr;
    /* Mapa arriba (flexible), panel de resultados abajo (fijo 215px) */
    grid-template-rows: 1fr 215px;
    overflow: hidden;
  }

  .map-container { min-height: 0; }

  /* Sidebar como bottom sheet nativo */
  .sidebar {
    border-right: none;
    border-top: none;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--c-surface);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,.10);
    position: relative;
  }

  /* Handle de arrastre visual (decorativo) */
  .sidebar::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--c-border);
    border-radius: 2px;
    margin: 10px auto 2px;
  }

  /* Header del panel compacto */
  .sidebar-header {
    padding: .3rem .9rem .45rem;
    border-bottom: none;
    box-shadow: none;
    background: transparent;
    position: relative; /* ya no sticky dentro del panel */
  }
  .sidebar-title {
    font-size: .78rem;
    font-weight: 600;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
  }

  /* Estado vacío compacto: icono + texto en fila */
  .empty-state {
    flex: 0;
    padding: .25rem .9rem .5rem;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    font-size: .82rem;
  }
  .empty-state-inner {
    flex-direction: row;
    align-items: center;
    gap: .65rem;
    text-align: left;
  }
  .empty-icon { font-size: 1.25rem; margin: 0; flex-shrink: 0; }
  .empty-state p { font-size: .79rem; margin: 0; }

  /* Footer compacto */
  .app-footer { padding: .38rem 1rem; font-size: .67rem; }

  /* Search bar y filtros */
  .search-bar { padding: .55rem .75rem .5rem; }
  .filters-row { gap: .3rem; }
  .select-filter { min-width: 88px; font-size: .78rem; padding: .42rem .5rem; }
  .brand-filter-btn { min-width: 100px; font-size: .78rem; padding: .42rem .6rem; }

  /* Cards en lista */
  .station-card { padding: .72rem .85rem; }
  .card-name    { font-size: .86rem; }
}

@media (max-width: 380px) {
  .header-inner { padding: 0 .75rem; }
  .logo-text    { display: none; }
  .filters-row  { gap: .2rem; }
  .select-filter { min-width: 76px; font-size: .75rem; }
}
