/* ═══════════════════════════════════════════
   Abastece — Mobile Fuel Finder
   ═══════════════════════════════════════════ */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --night:      #0A1628;
  --night-mid:  #112040;
  --night-soft: #1A2F52;
  --amber:      #F5A623;
  --amber-dark: #D4891A;
  --white:      #FFFFFF;
  --muted:      #8B9BB4;
  --green:      #22C55E;
  --red:        #EF4444;
  --orange:     #F97316;
  --panel-bg:   #0E1E38;
  --border:     rgba(255,255,255,0.08);
  --blue-maps:  #1A73E8;
}

html, body {
  height: 100%; width: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--night);
  color: var(--white);
  overflow: hidden;
  position: fixed;
}

/* ── SCREENS ─────────────────────────────── */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  transition: opacity .4s ease, transform .4s ease;
}
.screen.hidden {
  opacity: 0; pointer-events: none; transform: translateY(16px);
}

/* ── LANGUAGE SWITCHER ───────────────────── */
.lang-switch {
  position: absolute;
  top: 20px; right: 20px;
  z-index: 100;
  display: flex;
  background: var(--night-mid);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.lang-btn {
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all .2s;
  letter-spacing: .5px;
}
.lang-btn.active {
  background: var(--amber);
  color: var(--night);
}

/* ── WELCOME SCREEN ──────────────────────── */
#welcome {
  background: var(--night);
  justify-content: space-between;
  padding: 0 0 40px;
  overflow: hidden;
}
.welcome-hero {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 64px 32px 24px;
  position: relative;
}
.hero-glow {
  position: absolute;
  width: 340px; height: 340px;
  background: radial-gradient(circle, rgba(245,166,35,.18) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.pump-icon {
  font-size: 72px; margin-bottom: 8px;
  position: relative; z-index: 1;
  filter: drop-shadow(0 0 24px rgba(245,166,35,.5));
}
.brand-name {
  font-size: 38px; font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--white);
  position: relative; z-index: 1;
}
.brand-name span { color: var(--amber); }
.brand-tagline {
  font-size: 15px; font-weight: 400;
  color: var(--muted);
  margin-top: 10px; text-align: center;
  line-height: 1.55; position: relative; z-index: 1;
  max-width: 265px;
}

/* ── STATS ROW ───────────────────────────── */
.welcome-stats {
  display: flex; padding: 0 24px;
  margin-bottom: 28px;
}
.stat-item {
  flex: 1; text-align: center;
  padding: 14px 8px;
  border-top: 1px solid var(--border);
}
.stat-item:not(:last-child) { border-right: 1px solid var(--border); }
.stat-num { font-size: 20px; font-weight: 700; color: var(--amber); letter-spacing: -.5px; }
.stat-label { font-size: 10px; color: var(--muted); margin-top: 2px; font-weight: 500; }

/* ── WELCOME BOTTOM ──────────────────────── */
.welcome-bottom {
  padding: 0 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.section-label {
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px;
  margin-bottom: 6px;
}

/* ── PILL COMPONENTS ─────────────────────── */
.fuel-pills {
  display: flex; gap: 8px;
  overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none;
}
.fuel-pills::-webkit-scrollbar { display: none; }

.pill {
  flex-shrink: 0;
  padding: 8px 14px; border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--night-mid);
  color: var(--muted);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .2s;
  white-space: nowrap;
  font-family: inherit;
}
.pill.active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--night); font-weight: 700;
}

.radius-pills { display: flex; gap: 6px; }
.radius-pill {
  flex: 1; text-align: center;
  padding: 8px 4px; border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--night-mid);
  color: var(--muted);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .2s;
  font-family: inherit;
}
.radius-pill.active {
  background: var(--night-soft);
  border-color: var(--amber);
  color: var(--amber); font-weight: 700;
}

/* ── PRIMARY BUTTON ──────────────────────── */
.btn-primary {
  width: 100%; padding: 18px;
  border-radius: 16px;
  background: var(--amber); color: var(--night);
  font-size: 16px; font-weight: 700;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .2s; letter-spacing: -.3px;
  font-family: inherit;
}
.btn-primary:active  { transform: scale(.97); background: var(--amber-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* ── MAP SCREEN ──────────────────────────── */
#mapScreen { background: var(--night); }

/* ── TOP BAR ─────────────────────────────── */
.topbar {
  position: relative; z-index: 1000;
  background: var(--night);
  padding: 14px 16px 10px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-back {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--night-mid);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; flex-shrink: 0;
  font-family: inherit; color: var(--white);
}
.topbar-info { flex: 1; }
.topbar-title { font-size: 15px; font-weight: 700; }
.topbar-sub   { font-size: 11px; color: var(--muted); margin-top: 1px; }
.topbar-fuel-badge {
  background: var(--amber); color: var(--night);
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 8px;
  flex-shrink: 0;
}
.topbar-lang {
  background: var(--night-mid);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex; overflow: hidden; flex-shrink: 0;
}
.topbar-lang .lang-btn { padding: 5px 9px; font-size: 11px; }

/* ── MAP ─────────────────────────────────── */
#map { flex: 1; z-index: 1; min-height: 0; }
.leaflet-tile { filter: brightness(.85) saturate(.9); }

/* ── BOTTOM PANEL ────────────────────────── */
.bottom-panel {
  position: relative; z-index: 1000;
  background: var(--panel-bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0; max-height: 52vh;
  display: flex; flex-direction: column;
}
.panel-handle-row { padding: 10px 16px 0; }
.panel-handle {
  width: 36px; height: 4px;
  background: var(--border); border-radius: 2px; margin: 0 auto;
}
.panel-title-row {
  display: flex; align-items: baseline;
  justify-content: space-between;
  padding: 8px 16px 10px;
}
.panel-title   { font-size: 14px; font-weight: 700; }
.panel-count   { font-size: 12px; color: var(--muted); font-weight: 500; }

.stations-list {
  overflow-y: auto; flex: 1;
  padding: 0 12px 12px;
  display: flex; flex-direction: column; gap: 8px;
  scrollbar-width: none;
}
.stations-list::-webkit-scrollbar { display: none; }

/* ── STATION CARD ────────────────────────── */
.station-card {
  background: var(--night-mid);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: all .15s;
  position: relative; overflow: hidden;
}
.station-card:active { transform: scale(.98); }
.station-card.cheapest { border-color: rgba(34,197,94,.4); }
.station-card.priciest { border-color: rgba(239,68,68,.3); }
.card-rank-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; border-radius: 14px 0 0 14px;
}
.card-price-badge {
  width: 64px; height: 64px; border-radius: 12px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.price-val  { font-size: 17px; font-weight: 800; letter-spacing: -.5px; line-height: 1; }
.price-unit { font-size: 9px; font-weight: 600; opacity: .7; margin-top: 2px; }
.card-info  { flex: 1; min-width: 0; }
.card-name  {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-brand { font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-dist  { font-size: 12px; color: var(--muted); margin-top: 4px; }
.card-chevron { color: var(--muted); font-size: 16px; flex-shrink: 0; }

/* ── POPUP SHEET ─────────────────────────── */
.popup-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 2000; display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity .3s;
  backdrop-filter: blur(4px);
}
.popup-overlay.open { opacity: 1; pointer-events: all; }
.popup-sheet {
  width: 100%;
  background: var(--panel-bg);
  border-radius: 24px 24px 0 0;
  padding: 0 0 40px;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,.72,0,1);
  max-height: 85vh; overflow-y: auto;
}
.popup-overlay.open .popup-sheet { transform: translateY(0); }
.popup-handle {
  width: 36px; height: 4px;
  background: var(--border); border-radius: 2px;
  margin: 12px auto 16px;
}
.popup-header {
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
}
.popup-brand-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.popup-brand-dot   { width: 10px; height: 10px; border-radius: 50%; }
.popup-brand-name  { font-size: 12px; color: var(--muted); font-weight: 500; }
.popup-station-name { font-size: 20px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; }
.popup-address { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.popup-dist-badge {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 8px; background: var(--night-soft);
  padding: 4px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.popup-prices { padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.popup-prices-title {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .8px; margin-bottom: 4px;
}
.price-row {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--night-mid);
  border-radius: 10px; border: 1px solid var(--border);
}
.price-row.highlighted { border-color: var(--amber); background: rgba(245,166,35,.08); }
.price-type   { font-size: 14px; font-weight: 500; }
.price-amount { font-size: 18px; font-weight: 800; letter-spacing: -.5px; color: var(--amber); }

.popup-actions { padding: 4px 20px 0; display: flex; flex-direction: column; gap: 10px; }
.btn-navigate {
  width: 100%; padding: 16px; border-radius: 14px;
  background: var(--blue-maps); color: white;
  font-size: 15px; font-weight: 700; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .2s; font-family: inherit;
}
.btn-navigate:active { transform: scale(.97); background: #1557B0; }
.btn-close-sheet {
  width: 100%; padding: 14px; border-radius: 14px;
  background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--border); cursor: pointer;
  font-family: inherit;
}

/* ── LOADING ─────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(10,22,40,.9);
  z-index: 3000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .3s;
  backdrop-filter: blur(8px);
}
.loading-overlay.active { opacity: 1; pointer-events: all; }
.loading-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 15px; font-weight: 500; color: var(--muted);
  text-align: center; max-width: 240px; line-height: 1.5;
}

/* ── TOAST ───────────────────────────────── */
.toast {
  position: fixed; top: 20px; left: 16px; right: 16px;
  background: #2D1B1B; border: 1px solid rgba(239,68,68,.4);
  border-radius: 12px; padding: 14px 16px;
  z-index: 4000; font-size: 14px; color: #FCA5A5; font-weight: 500;
  transform: translateY(-100px); transition: transform .3s;
  line-height: 1.4;
}
.toast.show { transform: translateY(0); }

/* ── MAP MARKERS ─────────────────────────── */
.map-marker { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.marker-bubble {
  padding: 5px 8px; border-radius: 10px;
  font-size: 12px; font-weight: 800;
  color: white; white-space: nowrap;
  box-shadow: 0 3px 12px rgba(0,0,0,.4);
  border: 2px solid rgba(255,255,255,.2);
}
.marker-tail {
  width: 8px; height: 8px;
  transform: rotate(45deg); margin-top: -5px;
  border-right: 2px solid rgba(255,255,255,.2);
  border-bottom: 2px solid rgba(255,255,255,.2);
}
.user-marker {
  width: 16px; height: 16px;
  background: #3B82F6; border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 6px rgba(59,130,246,.25);
  animation: pulse-user 2s infinite;
}
@keyframes pulse-user {
  0%,100% { box-shadow: 0 0 0 6px rgba(59,130,246,.25); }
  50%      { box-shadow: 0 0 0 12px rgba(59,130,246,.1); }
}

/* ── EMPTY STATE ─────────────────────────── */
.empty-state { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty-icon  { font-size: 32px; margin-bottom: 8px; }
.empty-text  { font-size: 14px; line-height: 1.5; }
