/* =====================================================================
 *  Design system — faithful to teslanavi.online (shadcn / Tailwind, oklch)
 *  Light theme · DM Sans (body) · Space Grotesk (display) · Noto Sans Georgian
 * ===================================================================== */
:root {
  --background: oklch(98.5% 0.003 250);
  --foreground: oklch(28% 0.03 260);
  --card: oklch(100% 0 0);
  --card-foreground: oklch(28% 0.03 260);
  --popover: oklch(100% 0 0);
  --popover-foreground: oklch(28% 0.03 260);
  --primary: oklch(62% 0.19 256);
  --primary-foreground: oklch(100% 0 0);
  --secondary: oklch(96.5% 0.005 250);
  --secondary-foreground: oklch(28% 0.03 260);
  --muted: oklch(94% 0.007 250);
  --muted-foreground: oklch(55% 0.02 250);
  --accent: oklch(94% 0.02 256);
  --accent-foreground: oklch(35% 0.15 256);
  --border: oklch(92% 0.008 250);
  --input: oklch(92% 0.008 250);
  --ring: oklch(62% 0.19 256);
  --good: oklch(72% 0.17 155);
  --bad: oklch(62% 0.22 25);
  --warn: oklch(75% 0.15 75);
  --radius: 0.875rem;
  --shadow: 0 12px 34px rgba(30, 41, 59, 0.14);
  --shadow-sm: 0 4px 14px rgba(30, 41, 59, 0.08);
  --font-body: "DM Sans", "Noto Sans Georgian", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Space Grotesk", "Noto Sans Georgian", "DM Sans", ui-sans-serif, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, .display { font-family: var(--font-display); letter-spacing: -0.01em; }

/* ---------- layout ---------- */
.wrap { max-width: 460px; margin: 0 auto; padding: 20px 16px 56px; }
.wrap-lg { max-width: 960px; }
.stack > * + * { margin-top: 16px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--primary);
}
.muted { color: var(--muted-foreground); }
.small { font-size: 12px; }
h1 { font-size: 26px; margin: 6px 0 0; font-weight: 700; }
h2 { font-size: 19px; margin: 0 0 8px; font-weight: 600; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; }
.mono { font-family: var(--font-mono); }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------- buttons ---------- */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--border);
  background: var(--secondary); color: var(--secondary-foreground);
  border-radius: 12px; padding: 12px 16px; font-weight: 600;
  transition: filter .15s, background .15s, transform .1s;
}
button:hover, .btn:hover { background: var(--muted); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); border-color: transparent; }
.btn-primary:hover { background: var(--primary); filter: brightness(1.06); }
.btn-block { width: 100%; display: block; text-align: center; }
.btn-lg { padding: 16px; font-size: 17px; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }

/* ---------- inputs ---------- */
input[type="text"], input[type="search"], input[type="password"], input[type="email"] {
  width: 100%; font: inherit; color: var(--foreground);
  background: var(--card); border: 1px solid var(--input);
  border-radius: 12px; padding: 13px 14px; outline: none;
}
input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px oklch(62% 0.19 256 / 0.18); }
input[type="range"] { width: 100%; accent-color: var(--primary); }
label.field { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }

/* ---------- pills / status ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--card);
}
.pill.good { border-color: oklch(72% 0.17 155 / .4); background: oklch(72% 0.17 155 / .1); color: oklch(45% 0.13 155); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted-foreground); }
.dot.on { background: var(--good); box-shadow: 0 0 0 4px oklch(72% 0.17 155 / .18); }
.dot.warn { background: var(--warn); }
.dot.off { background: var(--bad); }
.tag {
  display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; padding: 2px 7px; border-radius: 6px;
  background: oklch(62% 0.22 25 / .12); color: oklch(50% 0.2 25);
}

/* ---------- search dropdown ---------- */
.search-box { position: relative; }
.search-pill {
  display: flex; align-items: center; gap: 10px;
  height: 60px; padding: 0 12px 0 18px;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow);
}
.search-pill:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px oklch(62% 0.19 256 / 0.18); }
.search-pill input { flex: 1; border: 0; background: transparent; box-shadow: none; padding: 0; font-size: 17px; }
.search-pill input:focus { box-shadow: none; }
.search-ico { width: 20px; height: 20px; color: var(--muted-foreground); flex: 0 0 auto; }
.suggests {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--popover); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow);
}
.suggests button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  border-radius: 0; padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.suggests button:last-child { border-bottom: 0; }
.suggests .s1 { font-size: 15px; color: var(--foreground); }
.suggests .s2 { font-size: 12px; color: var(--muted-foreground); }

/* ---------- QR / code ---------- */
.code-big {
  font-family: var(--font-display);
  font-size: 46px; font-weight: 800; letter-spacing: .18em;
}
.qr { background: #fff; padding: 10px; border-radius: 14px; display: inline-block; border: 1px solid var(--border); }
.qr img { display: block; width: 180px; height: 180px; }

/* ---------- Tesla display ---------- */
.tesla { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; background: #e8eef6; }
.overlay { position: absolute; z-index: 5; pointer-events: none; }
.overlay > * { pointer-events: auto; }
.turn-banner {
  top: 16px; left: 50%; transform: translateX(-50%);
  min-width: 300px; max-width: 92vw;
  background: color-mix(in oklab, var(--card) 94%, transparent);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 14px 20px; display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.turn-arrow { font-size: 46px; line-height: 1; color: var(--primary); }
.turn-dist { font-size: 30px; font-weight: 800; font-family: var(--font-display); }
.turn-text { font-size: 15px; color: var(--muted-foreground); max-width: 46vw; }
.hud {
  background: color-mix(in oklab, var(--card) 92%, transparent);
  border: 1px solid var(--border); border-radius: 18px;
  padding: 12px 18px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.hud-speed { left: 18px; bottom: 18px; text-align: center; }
.hud-speed .n { font-size: 48px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; font-family: var(--font-display); }
.hud-speed .u { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted-foreground); }
.hud-eta { right: 18px; bottom: 18px; text-align: right; }
.hud-eta .name { font-weight: 700; }
.pair-panel {
  top: 16px; right: 16px; width: 264px; text-align: center;
  background: color-mix(in oklab, var(--card) 96%, transparent);
  border: 1px solid var(--border);
  border-radius: 18px; padding: 18px; box-shadow: var(--shadow);
}
.recenter-btn { right: 18px; bottom: 104px; }
.exit-btn { left: 18px; top: 16px; }

/* speedometer full screen (phone) */
.speedo {
  position: fixed; inset: 0; z-index: 60; background: #05070d; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; padding: 22px;
}
.speedo .big-arrow { font-size: 120px; line-height: 1; text-align: center; }
.speedo .big-dist { font-size: 52px; font-weight: 800; text-align: center; font-family: var(--font-display); }
.speedo .big-speed { font-size: 66px; font-weight: 800; font-variant-numeric: tabular-nums; font-family: var(--font-display); }

/* ---------- misc ---------- */
.err { color: oklch(45% 0.2 25); background: oklch(62% 0.22 25 / .1); border: 1px solid oklch(62% 0.22 25 / .3);
  border-radius: 12px; padding: 12px 14px; }
.map-mini { height: 240px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }
.kv { font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border-radius: 999px; border: 1px solid var(--border); background: var(--muted);
  color: var(--muted-foreground); padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--primary); color: var(--primary-fg, #fff); border-color: transparent; }
.route-opt {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left; border: 1px solid var(--border);
  background: var(--muted); border-radius: 12px; padding: 12px; margin-bottom: 8px;
}
.route-opt.on { border-color: var(--primary); background: oklch(62% 0.19 256 / .06); }
.route-opt .min { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.route-opt.on .min { color: var(--primary); }

/* landing tiles */
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: 34px; line-height: 1.1; }
.big-tiles { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 22px; }
@media (min-width: 560px) { .big-tiles { grid-template-columns: 1fr 1fr; } }
.tile {
  display: block; color: var(--foreground);
  border: 1px solid var(--border); background: var(--card); border-radius: var(--radius);
  padding: 22px; transition: transform .15s, border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.tile:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: var(--shadow); }
.tile .ico { font-size: 34px; }
.tile h3 { margin: 10px 0 4px; font-size: 19px; }
.feature-list { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 22px; }
@media (min-width: 560px) { .feature-list { grid-template-columns: 1fr 1fr; } }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature .fi { font-size: 22px; }

/* ===================== Tesla display: sidebar + map app ===================== */
.app-shell { position: fixed; inset: 0; display: flex; background: var(--background); }
.sidebar {
  width: 360px; max-width: 86vw; flex: 0 0 auto; height: 100%; overflow-y: auto;
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
  background: var(--background); border-right: 1px solid var(--border);
}
.sidebar.collapsed { display: none; }
.map-pane { position: relative; flex: 1 1 auto; min-width: 0; }
.icon-btn {
  width: 38px; height: 38px; padding: 0; border-radius: 10px; font-size: 15px;
  background: var(--card); border: 1px solid var(--border); color: var(--muted-foreground);
}
.sidebar-open { position: absolute; z-index: 6; top: 14px; left: 14px; box-shadow: var(--shadow-sm); }

.place-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.place-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--muted); text-align: left;
}
.place-card .pi { font-size: 18px; }
.place-card .pl { font-size: 13px; font-weight: 600; color: var(--foreground); }

.phone-ico {
  width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center;
  font-size: 22px; border-radius: 12px; background: var(--muted); border: 1px solid var(--border);
}
.pair-inline { display: flex; gap: 14px; align-items: center; margin-top: 14px; }
.pair-inline .qr img { width: 120px; height: 120px; }

.cat-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.cat {
  border-radius: 999px; border: 1px solid var(--border); background: var(--card);
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--foreground);
}
.cat.on { background: var(--primary); color: #fff; border-color: transparent; }

/* map overlays */
.map-search { position: absolute; z-index: 6; top: 16px; left: 50%; transform: translateX(-50%); width: min(560px, 70%); }
.map-toggles { position: absolute; z-index: 6; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.tgl {
  min-width: 96px; text-align: center; border-radius: 12px; padding: 9px 14px; font-weight: 600; font-size: 13px;
  background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.tgl.on { background: var(--primary); color: #fff; border-color: transparent; }
.myloc { position: absolute; z-index: 6; left: 16px; bottom: 20px; border-radius: 999px; padding: 10px 16px; font-weight: 600; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(15,23,42,.45); display: grid; place-items: center; padding: 20px; }
.modal-card { width: min(460px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; max-width: 100%; height: auto; max-height: 46vh; border-right: 0; border-bottom: 1px solid var(--border); }
  .map-pane { flex: 1 1 auto; }
  .map-search { width: 88%; }
}
