/* ParkVision — haydovchilar uchun veb-ilova.
   Dizayn: yo'l belgisi tili. Bo'sh joylar soni — ko'k "P" belgisi ustidagi raqam (xaritada ham, ro'yxatda ham bir xil).
   Ranglar: belgi ko'ki, yo'l chizig'i sarig'i, asfalt, beton. Raqamlar uchun Barlow (yo'l belgilari shriftidan ilhomlangan). */

@font-face { font-family: "Barlow SC"; font-weight: 600; font-display: swap;
  src: url("fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow SC"; font-weight: 700; font-display: swap;
  src: url("fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); }

:root {
  --sign: #1450A3;       /* parkovka belgisi */
  --sign-dark: #0E3B78;
  --paint: #F5C400;      /* yo'l chizig'i */
  --asphalt: #2E3338;
  --concrete: #E4E7E9;
  --line: #CBD1D5;
  --white: #FFFFFF;
  --stop: #C62828;
  --muted: #7C858C;
  --display: "Barlow SC", "Arial Narrow", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --sheet-h: 46vh;
  --bar-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.4 var(--body); color: var(--asphalt); background: var(--concrete);
  -webkit-tap-highlight-color: transparent; overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--paint); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── Xarita ─────────────────────────────────────────────────────────────── */
#map { position: fixed; left: 0; right: 0; top: 0; bottom: var(--sheet-h); background: #DADFE2;
  transition: bottom .25s ease; }
body.sheet-min #map { bottom: 112px; }

/* ── Yuqori panel ───────────────────────────────────────────────────────── */
.bar { position: fixed; top: 0; left: 0; right: 0; height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 10px 0; display: flex; align-items: center; justify-content: space-between;
  z-index: 1000; pointer-events: none; }
.bar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; background: var(--white); padding: 5px 12px 5px 5px;
  border-radius: 10px; box-shadow: 0 1px 3px rgba(46,51,56,.25); }
.psign { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 5px; background: var(--sign);
  color: var(--white); font: 700 20px/1 var(--display); box-shadow: inset 0 0 0 2px var(--white), 0 0 0 1px var(--sign); }
.brand-name { font: 700 18px/1 var(--display); letter-spacing: .01em; }
.bar-actions { display: flex; gap: 6px; }
.chip, .round { height: 40px; border: 0; border-radius: 10px; background: var(--white);
  box-shadow: 0 1px 3px rgba(46,51,56,.25); }
.chip { padding: 0 12px; font-weight: 600; font-size: 14px; }
.round { width: 40px; display: grid; place-items: center; }
.round svg { width: 22px; height: 22px; fill: none; stroke: var(--sign); stroke-width: 2; }
.round.active svg { fill: rgba(20,80,163,.15); }

.banner { position: fixed; top: calc(var(--bar-h) + env(safe-area-inset-top) + 4px); left: 10px; right: 10px;
  z-index: 1000; background: var(--asphalt); color: var(--white); padding: 10px 12px; border-radius: 10px; font-size: 14px; }

/* ── Pastki panel ───────────────────────────────────────────────────────── */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; height: var(--sheet-h); z-index: 1001;
  background: var(--white); border-radius: 16px 16px 0 0; box-shadow: 0 -2px 10px rgba(46,51,56,.18);
  display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); transition: height .25s ease; }
body.sheet-min .sheet { height: 112px; }
body.sheet-max .sheet { height: 82vh; }
body.sheet-max #map { bottom: 82vh; }
.grip { border: 0; background: none; padding: 8px 0 4px; display: grid; place-items: center; }
.grip span { width: 44px; height: 5px; border-radius: 3px; background: var(--line); }

.tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 0 12px 8px; background: var(--concrete);
  border-radius: 10px; padding: 3px; }
.tabs button { border: 0; background: none; padding: 9px 0; border-radius: 8px; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--white); color: var(--asphalt); box-shadow: 0 1px 2px rgba(46,51,56,.2); }

.view { overflow-y: auto; padding: 0 12px 16px; flex: 1; -webkit-overflow-scrolling: touch; }

.toggle { display: flex; align-items: center; gap: 8px; padding: 4px 2px 8px; font-size: 14px; }
.toggle input { width: 20px; height: 20px; accent-color: var(--sign); }
.hint { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

/* ── Belgi (bo'sh joylar soni) ──────────────────────────────────────────── */
.sign { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 5px; border-radius: 6px;
  background: var(--sign); color: var(--white); font: 700 19px/1 var(--display);
  box-shadow: inset 0 0 0 2px var(--white), 0 0 0 1px var(--sign); }
.sign--few { background: var(--paint); color: var(--asphalt); box-shadow: inset 0 0 0 2px var(--white), 0 0 0 1px #B89300; }
.sign--full { background: var(--stop); box-shadow: inset 0 0 0 2px var(--white), 0 0 0 1px var(--stop); }
.sign--none { background: var(--muted); box-shadow: inset 0 0 0 2px var(--white), 0 0 0 1px var(--muted); }
.sign--lg { min-width: 58px; height: 58px; font-size: 32px; border-radius: 9px; }
.sign--xl { min-width: 84px; height: 84px; font-size: 48px; border-radius: 12px; box-shadow: inset 0 0 0 3px var(--white), 0 0 0 1px var(--sign); }

/* xaritadagi belgi: ustunchada turgan kichik yo'l belgisi */
.pv-marker { display: flex; flex-direction: column; align-items: center; }
.pv-marker .pole { width: 3px; height: 9px; background: #5B6268; }
.pv-marker.selected .sign { transform: scale(1.2); transform-origin: bottom center; }

/* ── Ro'yxat ────────────────────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; width: 100%;
  text-align: left; border: 0; background: none; padding: 10px 2px; border-bottom: 1px solid var(--concrete); }
.item-name { font-weight: 650; font-size: 16px; line-height: 1.25; }
.item-sub { font-size: 13px; color: var(--muted); }
.item-total { font: 600 15px/1 var(--display); color: var(--asphalt); }
.item-dist { font: 600 17px/1 var(--display); color: var(--asphalt); white-space: nowrap; }

/* ── Parkovka kartasi ───────────────────────────────────────────────────── */
.back { border: 0; background: none; color: var(--sign); font-weight: 600; padding: 6px 0 10px; }
.detail-head { display: flex; gap: 14px; align-items: center; }
.detail-name { margin: 0; font: 700 22px/1.15 var(--display); }
.detail-total { font: 600 18px/1 var(--display); margin-top: 4px; }
.status { font-size: 14px; margin: 10px 0 2px; }
.status b { font-weight: 650; }
.meta { font-size: 13px; color: var(--muted); margin: 2px 0; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--white); font-weight: 600; text-decoration: none;
  color: var(--asphalt); }
.btn--primary { background: var(--sign); border-color: var(--sign); color: var(--white); }
.btn--primary:active { background: var(--sign-dark); }
.btn--wide { grid-column: 1 / -1; }
.btn--danger { color: var(--stop); }
.btn--arrive { background: var(--paint); border-color: var(--paint); color: var(--asphalt); }

/* ── Mashinam ───────────────────────────────────────────────────────────── */
.car-intro { margin: 4px 0 12px; }
.small { font-size: 13px; color: var(--muted); }
.car-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 6px; }
.arrow { width: 84px; height: 84px; border-radius: 50%; background: var(--concrete); display: grid; place-items: center;
  position: relative; flex: none; }
.arrow svg { width: 52px; height: 52px; transition: transform .3s ease; }
.arrow svg path { fill: var(--sign); }
.arrow .north { position: absolute; top: 3px; font: 700 11px/1 var(--display); color: var(--muted); }
.car-dist { font: 700 40px/1 var(--display); }
.car-dist-lbl { font-size: 13px; color: var(--muted); }
.field { display: block; margin: 12px 0 0; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field textarea { width: 100%; min-height: 64px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; resize: vertical; }
.photo { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; margin-top: 10px;
  border: 1px solid var(--line); }
.car-marker { width: 36px; height: 36px; border-radius: 50%; background: var(--paint); border: 3px solid var(--white);
  box-shadow: 0 1px 4px rgba(46,51,56,.45); display: grid; place-items: center; }
.car-marker svg { width: 20px; height: 20px; fill: var(--asphalt); }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--sign); border: 3px solid var(--white);
  box-shadow: 0 0 0 1px var(--sign), 0 1px 3px rgba(0,0,0,.35); }
.picking #map { cursor: crosshair; }

.leaflet-control-attribution { font-size: 10px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (min-width: 720px) {
  .sheet { left: 12px; right: auto; width: 400px; bottom: 12px; top: calc(var(--bar-h) + 12px); height: auto;
    border-radius: 16px; }
  #map { bottom: 0 !important; left: 424px; }
  .grip { display: none; }
  body.sheet-min .sheet, body.sheet-max .sheet { height: auto; }
}

/* ── Joylar (har bir joy holati) ────────────────────────────────────────── */
.spaces-title { font: 700 18px/1.2 var(--display); margin: 18px 0 4px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.cell-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.zone-name { font-size: 13px; font-weight: 600; margin: 10px 0 4px; }
.cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 5px; }
.cell { display: grid; place-items: center; height: 40px; padding: 0 3px; border-radius: 6px; overflow: hidden;
  font: 600 14px/1 var(--display); white-space: nowrap; text-overflow: ellipsis; }
.cell--free { background: var(--sign); color: var(--white); }
.cell--busy { background: var(--concrete); color: var(--muted); text-decoration: line-through; }
.cell--unknown { background: var(--white); color: var(--muted); border: 1px dashed var(--line); }
.cell-dot.cell--busy { background: #B8BEC2; }

/* ── Bron va hisob ──────────────────────────────────────────────────────── */
button.cell { border: 0; cursor: pointer; }
.cell--reserved { background: var(--paint); color: var(--asphalt); }
.cell-dot.cell--reserved { background: var(--paint); }
.cell--sel { outline: 3px solid var(--asphalt); outline-offset: 2px; }
.reserve-bar { position: sticky; bottom: 0; background: var(--white); padding: 10px 0 4px; margin-top: 10px;
  border-top: 1px solid var(--concrete); }
.reserve-bar .small { margin: 0 0 6px; }
.res-card { border: 2px solid var(--sign); border-radius: 12px; padding: 12px; margin: 4px 0 12px; }
.res-card--parked { border-color: var(--asphalt); }
.res-top { display: flex; gap: 12px; align-items: center; }
.res-label { font: 700 26px/1 var(--display); }
.res-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.res-barrier { color: var(--asphalt); font-weight: 600; }
.res-money { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; }
.res-money b { font: 700 24px/1 var(--display); }
.form { display: grid; gap: 10px; margin: 6px 0 12px; }
.form input { width: 100%; height: 48px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font-size: 17px; }
.form label span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.section-title { font: 700 18px/1.2 var(--display); margin: 16px 0 6px; }
.card-row, .hist-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0;
  border-bottom: 1px solid var(--concrete); gap: 8px; }
.card-row .btn { min-height: 36px; padding: 0 10px; font-size: 13px; }
.err { color: var(--stop); font-size: 14px; margin: 4px 0; }
.reserve-bar .btn { width: 100%; }

/* ── Eslatma (kelmagan bron) va ilova sozlamasi ─────────────────────────── */
.prompt { position: fixed; top: calc(var(--bar-h) + env(safe-area-inset-top) + 4px); left: 10px; right: 10px;
  z-index: 1002; background: var(--white); color: var(--asphalt); padding: 12px; border-radius: 12px;
  border-left: 6px solid var(--paint); box-shadow: 0 4px 16px rgba(46,51,56,.28); }
.prompt p { margin: 0 0 10px; font-size: 15px; line-height: 1.35; }
.prompt-acts { display: flex; gap: 8px; }
.prompt-acts .btn { flex: 1; }
.srv-link { float: right; margin-top: 10px; color: var(--sign); font-size: 14px; }
