/* Mapa obce – ovládání nad 3D maketou. Vzhled vychází z mapy v HeroCave (skleněné panely, Inter). */
:root {
  --ink: #1d1b18; --ink2: #57534c; --muted: #8a857c;
  --accent: #b3412f; --accent-bg: #fbeee9; --blue: #2a78d6; --good: #2f8f3a;
  --panel: rgba(255, 255, 255, .9); --line: rgba(29, 27, 24, .09);
  --shadow: 0 10px 30px rgba(40, 45, 60, .14), 0 1px 2px rgba(40, 45, 60, .08);
  --side-w: 380px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #e6edf1; color: var(--ink);
  font: 13.5px/1.45 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body.noc { background: #1b2436; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--blue); }
#scene { position: fixed; inset: 0; }
#scene canvas { display: block; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.labels button { pointer-events: auto; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; z-index: 30; background: #e6edf1; text-align: center; }
.boot div { display: grid; gap: 4px; font-size: 16px; }
.boot span { color: var(--muted); font-size: 13px; }
.boot.hide { display: none; }

.panel { position: fixed; background: var(--panel); backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 14px; box-shadow: var(--shadow); }
.eyebrow { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 4px 0 2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Horní lišta */
.topbar { top: 12px; left: 12px; width: var(--side-w); display: grid; gap: 8px; padding: 10px; z-index: 6; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 15px; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 12px; }
.znak { width: 30px; height: 34px; flex: none; border-radius: 3px 3px 15px 15px; overflow: hidden;
  background: linear-gradient(155deg, #c8102e 0 46%, #fff 46% 56%, #1f4fa0 56%); box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.15); }
.search { position: relative; }
.search input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  padding: 0 12px 0 34px; font: inherit; font-size: 14px; outline: none; }
.search input:focus { border-color: var(--accent); }
.search svg { position: absolute; left: 11px; top: 12px; }
.results { position: absolute; top: 46px; left: 0; right: 0; padding: 6px; display: none; z-index: 10; max-height: 50vh; overflow: auto; }
.results.open { display: block; }
.results button { display: flex; justify-content: space-between; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 9px; border-radius: 8px; text-align: left; }
.results button:hover, .results button.active { background: var(--accent-bg); }
.results small { color: var(--muted); white-space: nowrap; }

/* Záložky a boční panel */
.tabs { top: 128px; left: 12px; width: var(--side-w); display: flex; gap: 2px; padding: 4px; z-index: 5; overflow-x: auto; scrollbar-width: none; }
.tabs button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 6px 2px; font-size: 11px; font-weight: 600; color: var(--ink2);
  display: grid; justify-items: center; gap: 1px; min-width: 48px; }
.tabs button span { font-size: 16px; line-height: 1.2; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.side { top: 192px; left: 12px; width: var(--side-w); bottom: 34px; overflow: auto; padding: 14px 16px; z-index: 4; }
.side.closed { display: none; }
.side h2 { margin: 0 0 4px; font-size: 18px; }
.side h3 { margin: 16px 0 6px; font-size: 13.5px; }
.side p { margin: 6px 0; }
.list { display: grid; gap: 6px; margin: 8px 0; }
.item { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 10px; text-align: left; width: 100%; }
button.item:hover { border-color: rgba(179, 65, 47, .4); }
.item .ico { font-size: 18px; line-height: 1.2; flex: none; width: 24px; text-align: center; }
.item b { display: block; }
.item .meta { color: var(--muted); font-size: 12px; }
.item img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: rgba(29, 27, 24, .06); color: var(--ink2); }
.chip.plan { background: #eef4fd; color: #1d4f9e; }
.chip.projekt { background: #f3edfd; color: #5b3aa0; }
.chip.realizace { background: #fff4dc; color: #8a5a00; }
.chip.hotovo { background: #edf7ee; color: #1d6b27; }
.chip.ukazka { background: #fdecec; color: #8f1f1f; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 8px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }
.note { background: #fff8e6; border: 1px solid #f3e2b5; border-radius: 10px; padding: 8px 10px; font-size: 12px; color: #6b5310; margin: 10px 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 9px; padding: 8px 12px; font-weight: 600; background: rgba(29, 27, 24, .06); text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--accent); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cal { display: grid; gap: 4px; }
.cal div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 9px; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.cal .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
form.report { display: grid; gap: 8px; }
form.report label { display: grid; gap: 3px; font-weight: 600; font-size: 12px; }
form.report select, form.report textarea, form.report input { font: inherit; border: 1px solid var(--line); border-radius: 9px; padding: 8px; background: #fff; font-weight: 400; }
form.report textarea { min-height: 80px; resize: vertical; }

/* Vrstvy */
.layers { top: 12px; right: 64px; width: 230px; padding: 10px 12px; display: grid; gap: 4px; z-index: 5; }
.layers.closed { display: none; }
.layers label { display: flex; gap: 8px; align-items: center; cursor: pointer; padding: 2px 0; }
.layers input[type=range] { width: 100%; }
.legend { display: grid; gap: 3px; font-size: 11.5px; color: var(--ink2); }
.legend:empty { display: none; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; vertical-align: -2px; margin-right: 6px; }
.seg { display: flex; background: rgba(29, 27, 24, .06); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 5px 4px; border-radius: 8px; font-weight: 500; font-size: 12px; color: var(--ink2); white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

/* Ovládání mapy */
.mapctl { top: 12px; right: 12px; display: grid; padding: 4px; gap: 2px; z-index: 5; }
.mapctl button { width: 36px; height: 36px; border: 0; background: none; border-radius: 8px; display: grid; place-items: center; font-size: 18px; color: var(--ink2); }
.mapctl button:hover, .mapctl button.on { background: rgba(29, 27, 24, .07); color: var(--ink); }

/* Detail vybraného místa */
.detail { right: 12px; bottom: 34px; width: 340px; max-height: calc(100vh - 300px); overflow: auto; padding: 14px 16px; z-index: 6; }
.detail h2 { margin: 0 0 2px; font-size: 18px; }
.detail .x { position: absolute; top: 10px; right: 10px; border: 0; background: rgba(29, 27, 24, .06); width: 28px; height: 28px; border-radius: 8px; font-size: 16px; line-height: 1; }
.detail img { width: 100%; border-radius: 10px; margin: 8px 0 2px; }

.toast { left: 50%; bottom: 40px; transform: translateX(-50%); padding: 10px 14px; z-index: 20; font-weight: 500; max-width: calc(100vw - 32px); }
.attrib { position: fixed; right: 8px; bottom: 6px; font-size: 10.5px; color: var(--muted); z-index: 3; text-align: right; }
body.noc .attrib { color: #9aa3b5; }
body.reporting #scene { cursor: crosshair; }

/* Popisky ve scéně */
.cp { font-size: 10px; font-weight: 700; color: #4a3b30; background: rgba(255, 255, 255, .85); border-radius: 5px; padding: 0 4px; line-height: 15px; pointer-events: none; }
body.noc .cp { background: rgba(30, 36, 52, .8); color: #ffe2a8; }
/* špendlík: kolečko s hrotem; element sám nesmí mít transform – ten mu přepisuje CSS2DRenderer */
.pin { --pin-bg: #fff; position: relative; border: 0; background: none; padding: 0 0 7px; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .25)); }
.pin > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--pin-bg); font-size: 15px; line-height: 1; }
.pin::after { content: ''; position: absolute; left: 50%; bottom: 0; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top: 8px solid var(--pin-bg); }
.pin:hover { --pin-bg: #fff4dc; }
.pin.akce { --pin-bg: #fde8f0; }
.pin.investice { --pin-bg: #eef4fd; }
.pin.foto { --pin-bg: #f2ecdf; }
.pin.odpad { --pin-bg: #e5f5e7; }
.pin.zavada { --pin-bg: var(--accent); }
.nazev { font-weight: 700; font-size: 15px; color: #3b2f26; text-shadow: 0 0 4px #fff, 0 0 8px #fff; background: none; border: 0; pointer-events: none; white-space: nowrap; }
.nazev.reka { font-style: italic; font-weight: 600; color: #2e6f9e; font-size: 13px; }
body.noc .nazev { color: #f2e6d0; text-shadow: 0 0 6px #000; }

/* Mobil: záložky dole, panely jako spodní list */
@media (max-width: 760px) {
  :root { --side-w: calc(100vw - 24px); }
  .topbar { top: 8px; left: 8px; right: 8px; width: auto; grid-template-columns: auto 1fr; align-items: center; padding: 6px; }
  .brand > span:last-child { display: none; }
  .tabs { top: auto; bottom: 8px; left: 8px; right: 8px; width: auto; }
  .side { top: auto; left: 8px; right: 8px; width: auto; bottom: 72px; max-height: 46vh; }
  .detail { left: 8px; right: 8px; width: auto; bottom: 72px; max-height: 50vh; }
  .layers { top: 62px; right: 56px; }
  .mapctl { top: 62px; right: 8px; }
  .attrib { display: none; }
}
