/* ============================================================
   Roadscanner — design system
   ============================================================ */

:root {
  --bg: #06080B;
  --bg-2: #0A0E13;
  --surface: #0F141B;
  --surface-2: #151C25;
  --surface-3: #1C2530;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #F3F7FA;
  --muted: #8B99A8;
  --muted-2: #5F6B78;
  --accent: #B8FF3C;
  --accent-2: #46E6A4;
  --accent-ink: #08120A;
  --danger: #FF6B6B;
  --warn: #FFC24B;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  --header-h: 60px;
  --tab-h: 68px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  min-height: 100dvh;
  background-image:
    radial-gradient(900px 500px at 50% -180px, rgba(184, 255, 60, 0.13), transparent 70%),
    radial-gradient(600px 400px at 110% 20%, rgba(70, 230, 164, 0.06), transparent 70%);
  background-repeat: no-repeat;
}

button,
input,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* ---------------- shell ---------------- */

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--tab-h) + 18px);
  position: relative;
}

.view {
  animation: fade-up 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: linear-gradient(to bottom, rgba(6, 8, 11, 0.96), rgba(6, 8, 11, 0.82));
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 17px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 0 22px rgba(184, 255, 60, 0.35);
}

.brand span.rs-dim {
  color: var(--muted-2);
  font-weight: 600;
}

.city-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.city-pill i {
  color: var(--accent);
  font-size: 11px;
}

main {
  padding: 18px 16px 0;
}

/* ---------------- typography ---------------- */

h1,
h2,
h3,
h4 {
  margin: 0;
  letter-spacing: -0.03em;
  font-weight: 700;
}

h1 {
  font-size: 28px;
  line-height: 1.12;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 15.5px;
}

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-2);
  font-weight: 700;
}

.sub {
  color: var(--muted);
  font-size: 13.5px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 12px;
}

/* ---------------- hero ---------------- */

.hero {
  padding: 6px 0 18px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 46ch;
}

/* ---------------- card / surface ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.card.tight {
  padding: 12px;
}

/* ---------------- search box ---------------- */

.searchbox {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 6px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 20;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 16px;
  transition: background 0.15s;
}

.field:focus-within {
  background: var(--surface-2);
}

.field + .field {
  border-top: 1px solid var(--line);
}

.field:focus-within + .field,
.field + .field:focus-within {
  border-top-color: transparent;
}

.field .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 2px solid var(--muted-2);
}

.field .dot.pick {
  border-color: var(--accent);
  background: rgba(184, 255, 60, 0.18);
}

.field .dot.drop {
  border-radius: 2px;
  border-color: var(--muted);
}

.field input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text);
}

.field input::placeholder {
  color: var(--muted-2);
  font-weight: 400;
}

.field .mini {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  flex: 0 0 auto;
}

.field .mini:hover {
  background: var(--surface-3);
  color: var(--text);
}

.field .mini.active {
  color: var(--accent);
}

.swaper {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--text);
}

/* autocomplete */

.ac {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 60;
  max-height: 300px;
  overflow-y: auto;
}

.ac-item {
  display: flex;
  gap: 11px;
  padding: 11px 13px;
  width: 100%;
  text-align: left;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.ac-item:last-child {
  border-bottom: 0;
}

.ac-item:hover,
.ac-item:focus-visible {
  background: var(--surface-3);
}

.ac-item i {
  color: var(--muted-2);
  font-size: 12px;
  width: 16px;
  text-align: center;
}

.ac-item .t {
  display: block;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-item .d {
  display: block;
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Proximity badge: makes the "closest first" ranking legible instead of implicit. */
.ac-item .km {
  margin-left: auto;
  flex: none;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 2px 7px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: all 0.15s;
}

.chip i {
  font-size: 10px;
  margin-right: 5px;
}

.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.chip:active {
  transform: scale(0.97);
}

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 50px;
  padding: 0 20px;
  border-radius: 15px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  transition: transform 0.12s, filter 0.15s;
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 30px rgba(184, 255, 60, 0.22);
}

.btn-primary:disabled {
  background: var(--surface-3);
  color: var(--muted-2);
  box-shadow: none;
}

.btn-ghost {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  height: 44px;
  font-size: 13.5px;
}

.btn-block {
  width: 100%;
}

/* ---------------- offer cards ---------------- */

.summary-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 4px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 10px;
}

.stat .k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-2);
  font-weight: 700;
}

.stat .v {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 2px;
}

.stat .v.accent {
  color: var(--accent);
}

.offer {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  margin-bottom: 9px;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.offer:active {
  transform: scale(0.992);
}

.offer:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.offer.best {
  border-color: rgba(184, 255, 60, 0.4);
  background: linear-gradient(160deg, rgba(184, 255, 60, 0.07), var(--surface) 42%);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  flex: 0 0 auto;
}

.offer .mid {
  flex: 1;
  min-width: 0;
}

.offer .nm {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -0.01em;
}

.offer .cls {
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.offer .right {
  text-align: right;
  flex: 0 0 auto;
}

.offer .price {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.offer .eta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
}

.offer .eta i {
  color: var(--accent-2);
  font-size: 9px;
  margin-right: 3px;
}

.badge {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--muted);
}

.badge.hot {
  background: var(--accent);
  color: var(--accent-ink);
}

.badge.live {
  background: rgba(70, 230, 164, 0.16);
  color: var(--accent-2);
}

.tag {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted-2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tag.ok {
  color: var(--accent-2);
}

/* confidence dots */
.conf {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}

.conf i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--surface-3);
}

.conf i.on {
  background: var(--accent-2);
}

/* ---------------- bottom sheet ---------------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 6, 0.72);
  backdrop-filter: blur(4px);
  z-index: 100;
  animation: fade-in 0.2s;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 101;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg-2);
  border-top: 1px solid var(--line-strong);
  border-radius: 24px 24px 0 0;
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 88dvh;
  overflow-y: auto;
  animation: sheet-up 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

.grabber {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  margin: 4px auto 14px;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
}

.kv:last-child {
  border-bottom: 0;
}

.kv .k {
  color: var(--muted);
}

.kv .v {
  font-weight: 600;
  text-align: right;
}

.kv.total {
  border-top: 1px solid var(--line-strong);
  border-bottom: 0;
  margin-top: 4px;
  padding-top: 12px;
  font-size: 15px;
}

.kv.total .v {
  font-size: 19px;
  font-weight: 800;
  color: var(--accent);
}

/* ---------------- notice / callout ---------------- */

.callout {
  display: flex;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.5;
  background: rgba(255, 194, 75, 0.09);
  border: 1px solid rgba(255, 194, 75, 0.22);
  color: #F5D9A4;
}

.callout i {
  color: var(--warn);
  margin-top: 2px;
}

.callout.info {
  background: rgba(70, 230, 164, 0.07);
  border-color: rgba(70, 230, 164, 0.2);
  color: #B7EBD8;
}

.callout.info i {
  color: var(--accent-2);
}

/* ---------------- map ---------------- */

#map {
  height: 168px;
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--surface-2);
  margin-bottom: 14px;
}

.leaflet-container {
  background: #0B0F14 !important;
  font-family: var(--font);
}

/* OSM standard tiles inverted for dark mode — the reliable, key-free dark-map
   recipe. Keeps street hierarchy and label contrast. */
.leaflet-tile-container img {
  filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9) saturate(0.7);
}

.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.5) !important;
  color: var(--muted-2) !important;
  font-size: 8px !important;
}

.leaflet-control-attribution a {
  color: var(--muted-2) !important;
}

.leaflet-bar {
  display: none;
}

/* ---------------- scanner animation ---------------- */

.scanning {
  display: grid;
  place-items: center;
  padding: 42px 0 34px;
  text-align: center;
}

.radar {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  position: relative;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
}

.radar .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(184, 255, 60, 0.18);
}

.radar .ring:nth-child(2) {
  inset: 20px;
}
.radar .ring:nth-child(3) {
  inset: 40px;
}

.radar .sweep {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(184, 255, 60, 0.42), transparent 26%);
  animation: spin 1.5s linear infinite;
  mask: radial-gradient(circle, transparent 38%, #000 39%);
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 39%);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.radar .core {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 34px rgba(184, 255, 60, 0.7);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    transform: scale(0.82);
    opacity: 0.75;
  }
}

.scan-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.scan-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted-2);
  transition: all 0.3s;
}

.scan-pill.done {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------------- bottom nav ---------------- */

.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(9, 12, 16, 0.94);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tab i {
  font-size: 16px;
}

.tab.on {
  color: var(--accent);
}

/* ---------------- empty states ---------------- */

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted-2);
}

.empty i {
  font-size: 30px;
  margin-bottom: 12px;
  opacity: 0.5;
  display: block;
}

.empty p {
  margin: 0;
  font-size: 13.5px;
}

/* ---------------- list rows ---------------- */

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 8px;
  width: 100%;
  text-align: left;
}

.row .mid {
  flex: 1;
  min-width: 0;
}

.row .t {
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.row .t span.arrow {
  color: var(--muted-2);
  font-size: 9px;
}

.row .d {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 2px;
}

/* ---------------- toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + 20px);
  transform: translateX(-50%);
  z-index: 300;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: fade-up 0.25s;
  max-width: calc(100vw - 40px);
}

.toast.err {
  border-color: rgba(255, 107, 107, 0.5);
  color: #FFC9C9;
}

/* ---------------- passenger selector ---------------- */

.party-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 9px;
}

.party-select {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 4px;
}

.party-select button {
  height: 34px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  transition: all 0.15s;
}

.party-select button.on {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ---------------- misc ---------------- */

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(8, 18, 10, 0.25);
  border-top-color: var(--accent-ink);
  animation: spin 0.7s linear infinite;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}

.linkbtn {
  color: var(--accent);
  font-weight: 600;
  font-size: 12.5px;
}

.brandrow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.provider-note {
  font-size: 11.5px;
  color: var(--muted-2);
  line-height: 1.45;
}

@media (min-width: 720px) {
  main {
    padding: 24px 20px 0;
  }
  .hero h1 {
    font-size: 34px;
  }
}
