/* ============================================================
   SEDC Hydrogen Mobility & Smart Station Platform
   Design tokens + base styles
   ============================================================ */

:root {
  /* Brand palette — deep blue / teal / green, smart-city energy */
  --navy-900: #061a30;
  --navy-800: #0a2540;
  --navy-700: #0b3d6e;
  --navy-600: #11528f;
  --navy-500: #1c6cb0;

  --teal-600: #0e7490;
  --teal-500: #0f8fa8;
  --teal-400: #16c79a;
  --teal-300: #4fd6b6;

  --green-600: #15803d;
  --green-500: #16a34a;
  --green-400: #34c46a;

  --amber-500: #d97706;
  --amber-400: #f59e0b;
  --red-500: #dc2626;
  --red-400: #ef4444;

  /* Accent — overridable via Tweaks */
  --accent: var(--teal-400);
  --accent-deep: var(--teal-600);

  /* Neutrals */
  --ink-900: #0d1b2a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --bg: #f4f7fa;
  --bg-soft: #eef3f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;

  /* Type */
  --font-display: 'Sora', system-ui, sans-serif;
  --font-ui: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  /* Radii + shadow */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --shadow-sm: 0 1px 2px rgba(13,27,42,.06), 0 1px 3px rgba(13,27,42,.04);
  --shadow-md: 0 4px 14px rgba(13,27,42,.07), 0 1px 4px rgba(13,27,42,.05);
  --shadow-lg: 0 18px 48px rgba(13,27,42,.14);
  --shadow-glow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink-900);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; }

::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- Typography helpers ---------- */
.t-display { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; }
.t-mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Reusable primitives ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.panel-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
  color: var(--ink-900);
  margin: 0;
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-400);
}

/* Status badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 3px 9px 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
  line-height: 1.4;
}
.badge .dot { width: 7px; height: 7px; border-radius: 99px; background: currentColor; flex: none; }
.badge.in-service   { color: var(--green-600); background: #e9f7ef; }
.badge.refuel-soon  { color: var(--amber-500); background: #fdf3e3; }
.badge.at-station   { color: var(--teal-600);  background: #e2f5f4; }
.badge.delayed      { color: var(--red-500);   background: #fdeaea; }
.badge.maintenance  { color: #7c3aed;          background: #f1ebfd; }
.badge.offline      { color: var(--ink-500);   background: #eef2f7; }
.badge.ready        { color: var(--green-600); background: #e9f7ef; }
.badge.limited      { color: var(--amber-500); background: #fdf3e3; }
.badge.approved     { color: var(--green-600); background: #e9f7ef; }
.badge.arriving     { color: var(--teal-600);  background: #e2f5f4; }
.badge.waiting      { color: var(--ink-500);   background: #eef2f7; }
.badge.completed    { color: var(--green-600); background: #e9f7ef; }
.badge.priority     { color: var(--red-500);   background: #fdeaea; }

/* Soft button */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-ui); font-weight: 600; font-size: 13px;
  padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-700);
  transition: all .15s ease;
}
.btn:hover { border-color: #cbd5e1; background: var(--surface-2); }
.btn.primary { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.btn.primary:hover { background: var(--navy-800); }
.btn.accent { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.btn.accent:hover { filter: brightness(.95); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--navy-700); }
.btn.ghost:hover { background: var(--bg-soft); }

/* Progress / fuel bar */
.bar { height: 7px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; }

/* Generic row hover */
.hoverable { transition: background .12s ease; }
.hoverable:hover { background: var(--surface-2); }

/* Animations */
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes blip { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes fadeUp { from { transform: translateY(10px); } to { transform: none; } }
/* Never animate opacity — content stays fully visible even if the animation
   clock is frozen (background tab, some embeds) or motion is disabled. Only a
   subtle slide is applied as enhancement. */
.fade-up { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .fade-up { animation: fadeUp .4s ease; }
}

.live-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--green-500); animation: pulse-dot 1.6s ease-in-out infinite; }

/* ============================================================
   Real Leaflet map — container + custom markers
   ============================================================ */
.h2-map { position: relative; overflow: hidden; z-index: 0; }
.h2-map .leaflet-container { width: 100%; height: 100%; background: transparent; font-family: var(--font-ui); }
.h2-map .leaflet-control-attribution { font-size: 9.5px; color: #94a3b8; background: rgba(255,255,255,.7); }
.h2-map .leaflet-bar a { color: var(--ink-700); border-radius: 0; }
.h2-map .leaflet-bar { border: 1px solid var(--line); box-shadow: var(--shadow-md); border-radius: 10px; overflow: hidden; }

/* Vehicle marker */
.h2-veh { position: relative; width: 22px; height: 22px; display: grid; place-items: center; }
.h2-veh-body { width: 22px; height: 22px; background: #fff; border: 3px solid var(--c); display: grid; place-items: center; box-shadow: 0 2px 5px rgba(13,27,42,.35); }
.h2-veh-core { width: 9px; height: 9px; background: var(--c); }
.h2-veh-label { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; color: #1f3346; white-space: nowrap; paint-order: stroke; -webkit-text-stroke: 2.5px #fff; }
.h2-veh-warn { position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 99px; background: #d97706; border: 1.5px solid #fff; }
.h2-veh-sel { position: absolute; width: 34px; height: 34px; border-radius: 99px; background: var(--c); opacity: .2; animation: vehSel 1.8s ease-out infinite; }
.h2-veh-delay { position: absolute; width: 26px; height: 26px; border-radius: 99px; background: #dc2626; opacity: .22; animation: pulse-dot 1s ease-in-out infinite; }
@keyframes vehSel { 0% { transform: scale(.6); opacity: .35; } 100% { transform: scale(1.5); opacity: 0; } }

/* Station marker */
.h2-station { position: relative; display: grid; place-items: center; filter: drop-shadow(0 2px 3px rgba(13,27,42,.3)); }
.h2-station-label { position: absolute; top: 38px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: #33455a; white-space: nowrap; paint-order: stroke; -webkit-text-stroke: 3px #fff; }
.h2-station.h2-pulse::before { content: ''; position: absolute; top: 6px; width: 26px; height: 26px; border-radius: 99px; background: var(--c); opacity: .25; animation: vehSel 2.6s ease-out infinite; }

/* User location dot (passenger) */
.h2-userdot { position: relative; width: 22px; height: 22px; display: grid; place-items: center; }
.h2-userdot-ring { position: absolute; width: 22px; height: 22px; border-radius: 99px; background: #2a6fdb; opacity: .2; animation: vehSel 2.4s ease-out infinite; }
.h2-userdot-core { width: 14px; height: 14px; border-radius: 99px; background: #2a6fdb; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(13,27,42,.35); }

/* Mobile showcase context rail — hide when there isn't room beside the phone */
@media (max-width: 920px) { .mob-rail { display: none !important; } }
