/* GoRooba rider app. One map, one sheet, one accent. Calm on purpose: parents read this mid-pickup. */
:root {
  --bg: #0b0d10;
  --surface: #15181d;
  --surface-2: #1d2128;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f5f7fa;
  --muted: #9aa4b2;
  --accent: #2dd4bf;        /* route line, focus, small highlights only */
  --error-text: #f87171;    /* 6.4:1 on --surface */
  --primary-bg: #f5f7fa;    /* main action: light on dark, the clearest thing on screen */
  --primary-text: #0b0d10;
  --radius-sheet: 20px;
  --radius: 14px;
  --shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Map fills the screen; the sheet sits over its lower part. */
#rideMap { position: fixed; inset: 0; background: #0e1116; }
.leaflet-container { background: #0e1116; font-family: var(--font); }
.leaflet-control-attribution { background: rgba(11, 13, 16, 0.7) !important; color: var(--muted) !important; font-size: 10px; }
/* The required map credit sits just below the phone's status bar (viewport-fit=cover), above the top bar. */
.leaflet-top { top: env(safe-area-inset-top, 0px); }
.leaflet-control-attribution a { color: var(--muted) !important; }

/* Top bar: brand and account only. */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 16px 0;
  pointer-events: none;
}
.brand, .account-btn { pointer-events: auto; }
.brand {
  display: inline-flex; align-items: center; height: 40px; padding: 0 14px;
  background: rgba(21, 24, 29, 0.92); border: 1px solid var(--line); border-radius: 999px;
  font-weight: 700; font-size: 16px; letter-spacing: -0.01em; color: var(--text); text-decoration: none;
}
.account-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(21, 24, 29, 0.92); border: 1px solid var(--line);
  font-weight: 600; font-size: 15px; display: grid; place-items: center;
}

/* The one sheet. */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 600;
  max-height: 78vh; overflow-y: auto;
  background: var(--surface); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: var(--shadow);
  padding: 10px 20px max(20px, env(safe-area-inset-bottom));
}
@media (min-width: 720px) {
  .sheet { left: 24px; right: auto; bottom: 24px; width: 400px; border-radius: var(--radius-sheet); }
}
.sheet::before {
  content: ""; display: block; width: 36px; height: 4px; border-radius: 2px;
  background: rgba(255, 255, 255, 0.18); margin: 0 auto 14px;
}
.panel { display: flex; flex-direction: column; gap: 14px; }

h1, h2 { font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.45; }
.status { font-size: 15px; color: var(--muted); }
.error { color: var(--error-text); font-size: 14px; line-height: 1.45; }

/* Inputs and rows. */
.field {
  width: 100%; min-height: 52px; padding: 0 16px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--radius); font-size: 16px;
}
.field:focus { border-color: var(--accent); outline: none; }
label.field-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 10px 4px;
  background: none; border: none; border-bottom: 1px solid var(--line); text-align: left;
}
.row:last-child { border-bottom: none; }
.row-icon {
  flex: 0 0 36px; height: 36px; border-radius: 50%; background: var(--surface-2);
  display: grid; place-items: center; color: var(--muted);
}
.row-text { flex: 1; min-width: 0; }
.row-title { display: block; font-size: 16px; font-weight: 600; }
.row-sub { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Ride options. */
.option {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 12px 14px;
  background: var(--surface-2); border: 2px solid transparent; border-radius: var(--radius); text-align: left;
}
.option[aria-pressed="true"] { border-color: var(--text); }
.option-price { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; min-height: 44px; padding: 0 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--primary-text); border-color: var(--text); }

/* Buttons. */
.btn {
  width: 100%; min-height: 54px; border-radius: var(--radius); border: none;
  font-size: 17px; font-weight: 600;
}
.btn-primary { background: var(--primary-bg); color: var(--primary-text); }
.btn-primary:disabled { opacity: 0.45; cursor: default; }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-quiet { background: none; color: var(--muted); min-height: 48px; font-weight: 500; }
.actions { display: flex; gap: 10px; }
.actions .btn { flex: 1; }

/* Finding a driver: a quiet indeterminate bar, nothing flashing. */
.progress { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.progress::after {
  content: ""; display: block; width: 35%; height: 100%; border-radius: 2px; background: var(--text);
  animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .progress::after { animation: none; width: 100%; opacity: 0.4; } }

/* Driver card. */
.driver { display: flex; align-items: center; gap: 14px; }
.avatar {
  flex: 0 0 56px; height: 56px; border-radius: 50%; background: var(--surface-2);
  display: grid; place-items: center; font-size: 20px; font-weight: 700;
}
.driver-name { font-size: 18px; font-weight: 700; }
.driver-car { font-size: 14px; color: var(--muted); }
/* Trip header: what's happening on the left, the time left in a box on the right (light on dark, like the
   main action: it's the one number a parent looks for). */
.trip-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.trip-head > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.eta {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 6px 10px;
  border-radius: 10px; background: var(--primary-bg); color: var(--primary-text); line-height: 1.1;
}
.eta-about { font-size: 11px; font-weight: 500; }
.eta-num { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.eta-unit { font-size: 13px; font-weight: 600; }
/* The car turns smoothly between reported headings; its position glide is done in JavaScript. */
@media (prefers-reduced-motion: reduce) { .marker-car { transition: none; } }
/* Trip code entry on the watch page: easy to read back against the message. */
.code-field { text-transform: uppercase; letter-spacing: 0.2em; font-variant-numeric: tabular-nums; }
/* The number plate, drawn like one: what a child checks before touching the door. */
.plate {
  margin-left: auto; padding: 6px 10px; border: 2px solid var(--text); border-radius: 8px;
  font-size: 16px; font-weight: 700; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pin {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2);
}
.pin-code { font-size: 26px; font-weight: 700; letter-spacing: 0.18em; font-variant-numeric: tabular-nums; }
.icon-btn {
  min-height: 48px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line);
  background: none; display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500;
}

/* Receipt. */
.receipt { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; background: var(--surface-2); border-radius: var(--radius); }
.receipt-line { display: flex; justify-content: space-between; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.receipt-total { color: var(--text); font-weight: 700; font-size: 17px; border-top: 1px solid var(--line); padding-top: 10px; }

/* Safety and account dialogs reuse the sheet look, above everything. */
.dialog-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-end; justify-content: center; }
.dialog {
  width: 100%; max-width: 480px; background: var(--surface); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  padding: 22px 20px max(20px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px;
}
.btn-emergency { background: #b91c1c; color: #fff; }

/* Map markers. */
.marker { width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--bg); box-shadow: 0 0 0 2px var(--text); background: var(--text); }
.marker.marker-dest { background: var(--accent); box-shadow: 0 0 0 2px var(--accent); border-radius: 4px; }
.marker-driver { width: 22px; height: 22px; background: var(--accent); box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.25); }

/* Centre pin: its tip marks the map centre while choosing a destination. */
.center-pin { position: fixed; left: 50%; top: 42%; z-index: 450; transform: translate(-50%, -100%); pointer-events: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5)); }
.marker-car { width: 44px; height: 44px; display: grid; place-items: center; transition: transform 0.9s linear; }
.marker-car svg { filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.65)); }
/* Free cars nearby before booking: smaller and quieter than the car that's coming for you. */
.marker-nearby { transform-origin: center; scale: 0.8; opacity: 0.85; }
/* No fresh position from the driver's phone: the car stays where last seen, faded, never pretending to move. */
.car-stale .marker-car { opacity: 0.45; }

/* Labelled map pins: a small dark label above a dot that marks the exact spot. */
.map-pin { width: 90px; height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; }
.map-pin-label {
  padding: 4px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); font: 600 12px/1.2 var(--font); white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.map-pin-dot {
  width: 18px; height: 18px; border-radius: 50%; background: var(--text);
  border: 5px solid var(--bg); box-shadow: 0 0 0 2px var(--text), 0 2px 6px rgba(0, 0, 0, 0.6);
}
.marker-dest .map-pin-dot { background: var(--accent); border-radius: 5px; box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(0, 0, 0, 0.6); }

/* Sheet changes cross-fade where the browser supports view transitions. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }
