/* web app styles -- dark theme, tokens copied verbatim from landing/index.html's inline <style>
   :root block so the ordering flow reads as the same product as the marketing site. Mobile-first:
   most orders come from a phone, so the base rules target a phone screen and desktop is the
   exception (see the single max-width query near the bottom), not the other way round. */

/* The whole flow shows and hides things with the `hidden` attribute, which works only through the
   UA rule `[hidden]{display:none}` -- and ANY author rule that sets `display` on the same element
   outranks it. Every button here is `.btn*{display:inline-flex}` and several rows are
   `display:flex`, so without this those elements ignore `hidden` completely and render anyway.
   That is not cosmetic: it is what put "Да, отменить" on screen next to "Отменить заказ" with no
   intervening click, turning the deliberate two-click guard on a destructive action into one tap.
   !important is the point of the rule -- it has to beat the class rules by design, not by order. */
[hidden] { display: none !important; }

:root {
  --blue: #00AFCA;
  --blue-light: #3FD3E8;
  --gold: #FFCE00;
  --ink: #0E2A38;
  --ink-2: #123A4C;
  --ink-deep: #081B25;
  --surface: rgba(255, 255, 255, .05);
  --surface-strong: rgba(255, 255, 255, .09);
  --border: rgba(255, 255, 255, .12);
  --text: #F3F9FB;
  --muted: #9FB6BE;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--ink);
  color: var(--text);
  line-height: 1.5;
  /* dvh (not vh) so mobile browser chrome sliding away/in doesn't leave a stale gap under the map */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { margin: 0 0 .4em; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 .8em; color: var(--muted); }
a { color: var(--blue-light); }
button { font: inherit; }

/* ---------- header ---------- */
header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(14, 42, 56, .92);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 500;
}
.logo { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.logo .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.langsw select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--ink-deep);
  background: var(--gold) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23081B25' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 8px center/8px 5px;
  padding: 6px 22px 6px 10px; border: none; border-radius: 8px; cursor: pointer;
}
.langsw select:focus { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- main / screens ---------- */
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* Steps 1 and 5 are map-first: the map fills whatever space isn't taken by the sheet below it. */
.map-wrap { position: relative; flex: 1; min-height: 220px; }
.map { position: absolute; inset: 0; background: var(--ink-2); }

/* Fixed centre crosshair for step 1 -- the MAP pans underneath this, this never moves.
   Mirrors mobile/assen_client/lib/screens/home_screen.dart's showCenterPin behaviour. */
.crosshair {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px;
  transform: translate(-50%, -100%); /* pin tip (not its centre) marks the actual point */
  pointer-events: none; z-index: 400;
}
.crosshair svg { width: 100%; height: 100%; filter: drop-shadow(0 6px 8px rgba(0,0,0,.45)); }

.btn-fab {
  position: absolute; right: 12px; bottom: 12px; z-index: 400;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface-strong); color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  backdrop-filter: blur(4px);
}
.btn-fab:hover { border-color: var(--blue); }

/* The bottom sheet that carries every step's actual content. Not a modal -- just a panel
   docked to the bottom of the screen, same visual language as .qo on the landing page. */
.sheet {
  flex: none;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 30px -18px rgba(0,0,0,.5);
}
/* Steps 2-4 have no map above them, so the sheet IS the screen -- give it room to scroll. */
.screen > .sheet:only-child, .sheet.standalone {
  flex: 1;
  overflow-y: auto;
  border-radius: 0;
  border-top: none;
}

.hint { font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }

label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
label:first-of-type { margin-top: 4px; }
input[type=text], input[type=tel], input[type=number] {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: rgba(8,27,37,.6); border: 1px solid var(--border); border-radius: 13px;
  padding: 13px 14px;
}
input::placeholder { color: #6F8C97; }
input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,175,202,.18); }

.error-text {
  color: #FFC2B4; font-size: 13.5px; margin: 10px 0 0;
  background: rgba(255,106,79,.12); border: 1px solid rgba(255,106,79,.32); border-radius: 11px; padding: 9px 12px;
}

.btn-primary, .btn-ghost, .btn-wa {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; margin-top: 14px; padding: 14px 20px; border-radius: 13px;
  font-weight: 700; font-size: 15.5px; text-decoration: none; border: 2px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--blue); color: var(--ink-deep); }
.btn-primary:hover:not(:disabled) { background: var(--blue-light); }
.btn-primary:disabled { opacity: .45; cursor: default; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--blue); }
.btn-wa { background: linear-gradient(180deg,#2EE277,#1FBE5B); color: #06281A; }
.btn-wa:hover { background: linear-gradient(180deg,#45EB89,#26CF67); }
.row-buttons { display: flex; gap: 10px; }
.row-buttons > * { margin-top: 14px; }

/* ---------- step 2: tank size cards (mirrors landing's .qo-sizes) ---------- */
.sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.sizes input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.sizes label {
  margin: 0; cursor: pointer; text-align: center; line-height: 1.2; text-transform: none; letter-spacing: normal;
  background: rgba(8,27,37,.35); border: 1px solid var(--border); border-radius: 13px; padding: 14px 6px;
}
.sizes label b { display: block; font-size: 17px; font-weight: 800; color: var(--text); }
.sizes label span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.sizes input:checked + label { background: var(--blue); border-color: var(--blue); }
.sizes input:checked + label b { color: var(--ink-deep); }
.sizes input:checked + label span { color: rgba(8,27,37,.72); }
.sizes input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- step 3: price ---------- */
.price-amount { font-size: 30px; font-weight: 800; color: var(--text); }
.price-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
#coverageBox { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }

/* ---------- step 4: OTP ---------- */
#activeOrderCapMessage { color: var(--text); font-weight: 600; }

/* ---------- step 5: tracking ---------- */
.tl-step { display: inline-flex; flex-direction: column; align-items: center; flex: 1; font-size: 10.5px; color: var(--muted); text-align: center; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-strong); border: 1px solid var(--border); margin-bottom: 6px; }
.tl-step.done .tl-dot { background: var(--blue); border-color: var(--blue); }
.tl-step.done { color: var(--text); }
#timeline { display: flex; margin: 10px 0 6px; }
#searchingCountdown { font-size: 13px; color: var(--gold); }
#priceRow { font-size: 15px; font-weight: 600; color: var(--text); }
#terminalCard {
  background: var(--surface-strong); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; font-weight: 700; margin-top: 8px;
}
#completePhoto { width: 100%; max-height: 200px; object-fit: cover; border-radius: 12px; margin-bottom: 10px; }
#cancelConfirm { display: flex; gap: 10px; margin-top: 10px; }
#cancelConfirm p { flex-basis: 100%; margin: 0 0 4px; }

/* ---------- resume screen ---------- */
.resume-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
}
.resume-row button { width: auto; margin: 0; padding: 8px 16px; }

/* ---------- Leaflet marker overrides (map.js divIcons) ---------- */
.assen-pin { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.assen-pin-pickup { background: var(--blue); }
.assen-pin-truck { background: var(--gold); }

/* ---------- desktop: cap width, sit the sheet beside the map instead of under it ---------- */
@media (min-width: 860px) {
  main { align-items: center; }
  .screen { max-width: 1040px; width: 100%; margin: 0 auto; }
  #step1, #step5 { flex-direction: row; }
  #step1 .map-wrap, #step5 .map-wrap { flex: 1.3; }
  #step1 .sheet, #step5 .sheet { flex: 1; border-radius: 0; border-top: none; border-left: 1px solid var(--border); max-width: 420px; overflow-y: auto; }
  #step2 .sheet, #step3 .sheet, #step4 .sheet, #resume .sheet { max-width: 480px; margin: 32px auto; border-radius: var(--radius); border: 1px solid var(--border); align-self: flex-start; }
}
