/* =============================================================================
   Lokation — colours, type and finishing touches (loaded by BOTH pages,
   after styles.css)

   Look: warm paper and ink, with one red (the pin colour) for the single most
   important action on each screen. No glows, gradients or glass.

   Every colour is a token below. Change a number here and both pages, in that
   mode, follow. Values are "R G B" so Tailwind can add transparency to them.
   theme.js sets <html data-theme="light|dark">.
   ============================================================================= */

/* ---- Light mode (default) ------------------------------------------------- */
:root {
  color-scheme: light;
  --canvas:     244 241 235;   /* page behind everything — warm paper      */
  --surface:    255 253 249;   /* panels, cards, chips                     */
  --raised:     239 235 227;   /* fields and secondary buttons             */
  --raised-2:   224 218 207;   /* tracks, empty waveform bars              */
  --line:       221 214 202;   /* hairlines and outlines                   */
  --ink:         28  26  23;   /* main text and dark buttons               */
  --muted:      105  99  90;   /* secondary text                           */
  --faint:      150 143 133;   /* hints and placeholders                   */
  --accent:     200  55  38;   /* Lokation red — pin, main button          */
  --accent-ink: 168  44  29;   /* red text on light backgrounds            */
  --on-accent:  255 255 255;   /* text on the red                          */
  --success:     30 122  74;
  --danger:     180  35  24;
  --pin-edge:   120  28  18;   /* thin outline around the pin              */
}

/* ---- Dark mode ------------------------------------------------------------ */
[data-theme="dark"] {
  color-scheme: dark;
  --canvas:      20  19  17;
  --surface:     30  28  25;
  --raised:      41  38  34;
  --raised-2:    60  56  50;
  --line:        55  51  46;
  --ink:        237 232 224;
  --muted:      165 157 146;
  --faint:      118 111 102;
  --accent:     210  65  46;
  --accent-ink: 240 122 100;
  --on-accent:  255 255 255;
  --success:     46 150  96;
  --danger:     240 110  90;
  --pin-edge:    90  20  12;
}

/* ---- Type ----------------------------------------------------------------- */
/* The phone's own font: Roboto on Android, San Francisco on iPhone, Segoe UI
   on Windows. Familiar, fast (nothing to download), and supports Nepali. */
:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Devanagari", sans-serif;
}
html, .font-sans, .font-mono, .leaflet-container, button, input, textarea,
.placeholder\:font-sans::placeholder {
  font-family: var(--font);
}
/* Numbers (timers, coordinates, counters) line up without a "code" font. */
.font-mono { font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* Plain weights: bold only where it matters. */
.font-bold { font-weight: 600; }
h1, h2 { letter-spacing: normal; }

/* Small section labels: sentence case, not spaced capitals. */
.uppercase.tracking-widest {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 500;
}

/* ---- Page ----------------------------------------------------------------- */
html, body {
  background: rgb(var(--canvas));
  color: rgb(var(--ink));
}
::selection { background: rgb(var(--accent) / 0.22); }

/* ---- Brand chip ----------------------------------------------------------- */
.brand-word {
  font-weight: 600;
  font-size: 15px;
  color: rgb(var(--ink));
}
.brand-mark path   { fill: rgb(var(--accent)); }
.brand-mark circle { fill: #fff; }

/* Theme toggle shows the mode you would switch TO. */
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ---- Map ------------------------------------------------------------------ */
.leaflet-container { background: rgb(var(--raised)); }

/* Dark mode: one free map style, turned into a night map with a filter.
   Pins and circles sit in other layers, so they keep their real colours. */
[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.6);
}

.leaflet-control-attribution {
  background: rgb(var(--surface) / 0.85) !important;
  color: rgb(var(--muted)) !important;
  font-size: 10px;
}
.leaflet-control-attribution a { color: rgb(var(--muted)) !important; }

.leaflet-bar { border: 0 !important; box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 0 0 1px rgb(var(--line)) !important; border-radius: 10px !important; overflow: hidden; }
.leaflet-bar a {
  background: rgb(var(--surface)) !important;
  color: rgb(var(--ink)) !important;
  border-bottom-color: rgb(var(--line)) !important;
}
.leaflet-bar a:hover { background: rgb(var(--raised)) !important; }

/* Pins: red body, white centre. */
.anchor-pin svg, .dest-pin svg { filter: drop-shadow(0 3px 3px rgb(0 0 0 / 0.35)); }
.anchor-pin svg path               { fill: rgb(var(--accent)); stroke: rgb(var(--pin-edge)); }
.anchor-pin svg circle:first-of-type { fill: #fff; }
.anchor-pin svg circle:last-of-type  { fill: rgb(var(--accent)); }

.dest-pin svg path:first-child { fill: rgb(var(--accent)); stroke: rgb(var(--pin-edge)); }
.dest-pin svg circle           { fill: #fff; }
.dest-pin svg path:last-child  { stroke: rgb(var(--accent)); }

.lk-accuracy { stroke: rgb(var(--accent)); stroke-opacity: 0.55; fill: rgb(var(--accent)); fill-opacity: 0.07; }
.lk-radius   { stroke: rgb(var(--accent)); stroke-opacity: 0.7;  fill: rgb(var(--accent)); fill-opacity: 0.08; }

/* ---- Panels: creator sheet and driver details ------------------------------ */
#sheet, main {
  background: rgb(var(--surface));
  border-top: 1px solid rgb(var(--line));
  box-shadow: 0 -6px 24px -12px rgb(0 0 0 / 0.25);
}
@media (min-width: 768px) {
  #sheet { border-top: 0; border-right: 1px solid rgb(var(--line)); box-shadow: none; }
}
#sheetBody { scrollbar-width: thin; scrollbar-color: rgb(var(--raised-2)) transparent; }

textarea, input { caret-color: rgb(var(--accent)); }

/* ---- The Lokation code: plain text, like a booking reference --------------- */
#code, #codeOut {
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgb(var(--ink));
  white-space: nowrap;
}
#code:empty { display: none; }

/* ---- Driver page: notes are plain text under a divider, not a card --------- */
#notesBlock {
  border-top: 1px solid rgb(var(--line));
  padding-top: 16px;
}
#notesBlock h2 { margin-bottom: 4px; }

/* Buttons: medium weight, flat. */
#navBtn, #callBtn, #submitBtn, #copyBtn { box-shadow: none; font-weight: 600; }
/* Form fields and secondary buttons: white with a thin border (standard form
   look), instead of grey filled blocks. */
#sheet .ring-1.bg-raised, #sheet .ring-1.bg-raised\/70,
main .ring-1.bg-raised\/70, #linkOut {
  background-color: rgb(var(--surface));
  --tw-ring-color: rgb(var(--raised-2));
}

/* Standard 48px touch height instead of oversized 56px blocks. */
button.h-14, a.h-14, input.h-14 { height: 48px; }
button.w-14, a.w-14 { width: 48px; }

/* ---- Small bits ------------------------------------------------------------ */
#locateIcon { color: rgb(var(--accent)); }
#toast { text-align: center; line-height: 1.35; }

button:focus-visible, a:focus-visible {
  outline: 2px solid rgb(var(--ink));
  outline-offset: 2px;
}

/* ---- Quiet motion ---------------------------------------------------------- */
@keyframes lk-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

#resultView:not(.hidden) { animation: lk-rise 0.3s ease-out both; }
#stateReady:not(.hidden) > div:first-child > * { animation: lk-rise 0.3s ease-out both; }
#stateReady:not(.hidden) > div:first-child > *:nth-child(2) { animation-delay: 0.04s; }
#stateReady:not(.hidden) > div:first-child > *:nth-child(3) { animation-delay: 0.08s; }
#stateReady:not(.hidden) > div:first-child > *:nth-child(4) { animation-delay: 0.12s; }

@media (prefers-reduced-motion: reduce) {
  #resultView:not(.hidden),
  #stateReady:not(.hidden) > div:first-child > * { animation: none; }
}
