:root {
  --primary: #0B5ED7;
  --primary-dark: #084298;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #0F172A;
  --muted: #475569;
  --border: #94A3B8;
  --border-soft: #CBD5E1;
  --success: #15803D;
  --warn-bg: #FEF3C7; --warn-text: #78350F;
  --ok-bg: #DCFCE7;   --ok-text: #14532D;
  --info-bg: #DBEAFE; --info-text: #1E3A8A;
  --busy-bg: #FEE2E2; --busy-text: #7F1D1D;
  --danger: #B91C1C;
  --radius: 14px;
  --focus: 0 0 0 3px #FFFFFF, 0 0 0 6px #0B5ED7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
}
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: none; box-shadow: var(--focus); }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 10000;
  background: #fff; color: var(--primary-dark); padding: 12px 16px; border-radius: 10px; font-weight: 700;
}
.skip-link:focus { top: 8px; }

/* RASPORED */
#app {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
}
.topbar {
  flex: none;
  min-height: 60px;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  padding-top: max(6px, env(safe-area-inset-top));
  z-index: 1000;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-title { font-size: 19px; font-weight: 800; white-space: nowrap; }
.top-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn-top {
  min-height: 48px; padding: 0 12px; border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.55);
  background: var(--primary-dark); color: #fff;
  font-weight: 700; font-size: 16px; white-space: nowrap;
}
.btn-top.btn-add { background: var(--success); border-color: #fff; }

.toolbar {
  flex: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  padding: 8px 10px;
  display: flex; gap: 8px; overflow-x: auto;
  z-index: 900;
}
.toolbar select, .toolbar input[type="search"] {
  min-height: 48px; border: 2px solid var(--border); border-radius: 12px;
  padding: 0 12px; background: #fff; flex: none;
}
.toolbar input[type="search"] { width: 190px; }
.chip {
  flex: none;
  min-height: 48px; padding: 0 14px; border-radius: 999px;
  border: 2px solid var(--border); background: #fff;
  font-weight: 600; font-size: 16px; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip-osm { border-style: dashed; }

.status-bar {
  flex: none; background: var(--warn-bg); color: var(--warn-text);
  padding: 8px 12px; font-size: 15px; font-weight: 600;
}

main { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; z-index: 1; }
.list-view {
  position: absolute; inset: 0; z-index: 500;
  overflow-y: auto; background: var(--bg);
  padding: 14px 12px 110px;
}

.crosshair {
  position: absolute; left: 50%; top: 50%; z-index: 600;
  width: 56px; height: 56px; margin: -28px 0 0 -28px; pointer-events: none;
  border: 4px solid var(--danger); border-radius: 50%;
  box-shadow: 0 0 0 3px #fff;
}
.crosshair::before, .crosshair::after {
  content: ""; position: absolute; background: var(--danger);
}
.crosshair::before { left: 50%; top: -14px; bottom: -14px; width: 4px; margin-left: -2px; }
.crosshair::after  { top: 50%; left: -14px; right: -14px; height: 4px; margin-top: -2px; }

.action-bar {
  position: fixed; left: 10px; right: 10px; bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 1200; background: #0F172A; color: #fff; border-radius: 16px;
  padding: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.35);
  max-width: 560px; margin: 0 auto;
}
.action-bar p { font-weight: 700; margin-bottom: 10px; }
.action-bar-danger { background: var(--danger); }
.action-bar-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.dock {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 1100; background: #0F172A; padding: 6px; border-radius: 999px;
  display: flex; gap: 6px; box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  max-width: calc(100vw - 16px);
}
.dock-btn {
  min-height: 52px; padding: 0 16px; border-radius: 999px; border: none;
  font-weight: 700; font-size: 16px; color: #F1F5F9; background: transparent; white-space: nowrap;
}
.dock-btn[aria-pressed="true"] { background: var(--primary); color: #fff; }
.dock-btn.dock-near { background: var(--success); color: #fff; }

/* DUGMAD */
.btn {
  min-height: 48px; padding: 0 16px; border-radius: 12px; border: 2px solid transparent;
  font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-light   { background: #F1F5F9; color: var(--text); border-color: var(--border); }
.btn-block { width: 100%; margin-top: 8px; }
.btn[disabled] { opacity: 0.6; cursor: wait; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.link-btn {
  background: none; border: none; color: var(--primary-dark); font-weight: 700;
  text-decoration: underline; min-height: 44px; padding: 0 4px;
}

/* KARTICE */
.spot-list { list-style: none; max-width: 720px; margin: 0 auto; }
.spot-card {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: 0 2px 6px rgba(15,23,42,0.06);
}
.spot-title { font-size: 18px; font-weight: 800; margin-bottom: 2px; }
.spot-meta { color: var(--muted); font-size: 15px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 8px; font-size: 14px; font-weight: 700; }
.b-ok { background: var(--ok-bg); color: var(--ok-text); }
.b-warn { background: var(--warn-bg); color: var(--warn-text); }
.b-info { background: var(--info-bg); color: var(--info-text); }
.b-busy { background: var(--busy-bg); color: var(--busy-text); }
.spot-note { font-size: 15px; margin: 4px 0; }
.spot-src { font-size: 14px; color: var(--muted); }
.spot-src a { color: var(--primary-dark); }
.nav-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.nav-row .btn { padding: 0 6px; font-size: 15px; color: #fff; }
.nav-g { background: #0B5ED7; }
.nav-a { background: #1E293B; }
.nav-w { background: #075985; }
.sub-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sub-actions .btn { font-size: 15px; min-height: 44px; padding: 0 12px; }
.empty { text-align: center; padding: 24px; color: var(--muted); }
.list-title { max-width: 720px; margin: 0 auto 10px; font-size: 18px; }

/* LEAFLET POPUP */
.leaflet-popup-content { margin: 10px 12px; font-size: 15px; min-width: 240px; }
.leaflet-popup-content .spot-card { border: none; box-shadow: none; padding: 0; margin: 0; }
.hp-marker {
  width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 900; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}
.hp-marker.ok { background: #0B5ED7; }
.hp-marker.unv { background: #64748B; }
.hp-marker.osm { background: #7C3AED; }
.hp-marker.approx { border-style: dashed; }
.spot-hint { font-size: 15px; margin: 4px 0; padding: 8px 10px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-text); }
.hp-marker.busy { box-shadow: 0 0 0 4px #B91C1C, 0 3px 8px rgba(0,0,0,0.4); }

/* MODALI */
.modal {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(15, 23, 42, 0.72);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.modal-box {
  background: #fff; width: 100%; max-width: 540px; max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  border-radius: 18px; padding: 18px; box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.modal-wide { max-width: 760px; }
.modal-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border-soft);
}
.modal-head h2 { font-size: 20px; }
.modal-box h3 { font-size: 17px; margin: 14px 0 6px; }
.modal-box p { margin-bottom: 8px; }
.btn-close {
  flex: none; width: 48px; height: 48px; border-radius: 12px;
  border: 2px solid var(--border); background: #F1F5F9; font-size: 26px; line-height: 1;
}
.muted { color: var(--muted); font-size: 15px; }
.contacts { list-style: none; }
.contacts li { padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.contacts a { color: var(--primary-dark); font-weight: 700; }

.modal-lang { background: linear-gradient(160deg, #084298 0%, #0B5ED7 60%, #1D4ED8 100%); }
.lang-box { max-width: 440px; text-align: center; }
.lang-logo { display: block; margin: 0 auto 8px; }
.lang-brand { font-size: 26px; font-weight: 900; color: var(--primary-dark); }
.lang-title { font-size: 16px; font-weight: 600; color: var(--muted); margin-top: 2px; }
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.lang-btn {
  min-height: 56px; border: 2px solid var(--border); background: #F8FAFC; border-radius: 14px;
  font-size: 17px; font-weight: 700;
}
.lang-btn[aria-current="true"] { border-color: var(--primary); background: #EFF6FF; }

/* FORME */
.field { margin-bottom: 12px; border: none; }
.field label, .field legend { display: block; font-weight: 700; margin-bottom: 4px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="number"], .field input[type="url"], .field input[type="date"],
.field select, .field textarea {
  width: 100%; min-height: 48px; border: 2px solid var(--border); border-radius: 12px;
  padding: 8px 12px; background: #fff;
}
.field textarea { min-height: 72px; }
.field input[type="file"] { width: 100%; min-height: 48px; padding: 8px 0; }
.field.check { display: flex; gap: 10px; align-items: flex-start; }
.field.check input { width: 26px; height: 26px; flex: none; margin-top: 2px; }
.field.check label { font-weight: 600; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600;
  min-height: 48px; padding: 0 14px; border: 2px solid var(--border); border-radius: 12px;
}
.seg input { width: 20px; height: 20px; }
.hint { font-size: 15px; color: var(--muted); margin-top: 4px; }
.loc-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }

/* ADMIN */
.adm-item { border: 1px solid var(--border-soft); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.adm-item img { max-width: 100%; max-height: 260px; border-radius: 10px; display: block; margin: 8px 0; }
.adm-warn { color: var(--danger); font-weight: 800; margin: 6px 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(70px + env(safe-area-inset-top)); z-index: 6000;
  background: #0F172A; color: #fff; padding: 12px 16px; border-radius: 12px;
  font-weight: 700; max-width: calc(100vw - 24px); box-shadow: 0 10px 25px rgba(0,0,0,0.35);
}
.toast.err { background: var(--danger); }

@media (max-width: 440px) {
  .brand-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .top-actions { flex-wrap: nowrap; }
  .btn-top { padding: 0 10px; font-size: 15px; }
  .dock-btn { padding: 0 12px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* 9.4: stanje uživo, pravila grada, sačuvana mesta */
.hp-marker.live-free { background: #15803D; }
.hp-marker.live-full { background: #B91C1C; }
.city-rule {
  flex: none; background: var(--info-bg); color: var(--info-text);
  padding: 8px 12px; font-size: 15px; font-weight: 600;
}
.spot-rule { font-size: 15px; margin: 4px 0; padding: 8px 10px; border-radius: 10px; background: var(--info-bg); color: var(--info-text); }
.spot-live { font-size: 14px; color: var(--muted); margin: 2px 0 0; }
.top-list { margin: 0; padding-left: 22px; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0; }
.stats-table th, .stats-table td { border: 1px solid var(--border-soft); padding: 6px 8px; text-align: left; }
.stats-table th { background: #F1F5F9; }
.adm-item img.misuse-img { max-width: 100%; border-radius: 10px; margin-top: 6px; }

/* 9.5: potvrđeno slobodno, parkiran sam, dodatni detalji, zvanična mesta */
.hp-marker.free-recent { box-shadow: 0 0 0 4px #15803D, 0 3px 8px rgba(0,0,0,0.4); }
.b-official { background: #FEF3C7; color: #78350F; border: 1px solid #B45309; }
.info-link { color: var(--primary-dark); font-weight: 700; display: inline-flex; align-items: center; min-height: 44px; }
.form-sub { font-weight: 800; margin: 16px 0 8px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.parked-bar { z-index: 1150; background: #14532D; padding: 10px 12px; }
.parked-bar .parked-line { margin-bottom: 8px; }
.parked-timer { font-variant-numeric: tabular-nums; }
body.has-parked .list-view { padding-bottom: 210px; }
