/*
  Vodácká navigace – vizuální systém podle docs/DESIGN-WEB.md (Návrh 1, rozhodnutí D1–D16).
  Hodnoty barev, písma a rozměrů jsou převzaté z návrhu – měnit jen v proměnných níže.
*/
:root {
  /* značka a text */
  --c-primary: #00695c;
  --c-primary-hover: #004d40;
  /* odkazy oranžově přesně jako starý web (global.css: a, a:hover #FF9800; 19. 11. 2026, změna D1) */
  --c-link: #ff9800;
  --c-link-hover: #ff9800;
  --c-primary-soft: #d2ece7;
  --c-text: #1c2b2a;
  --c-heading: #16302c;
  --c-paragraph: #2b3a38;
  --c-secondary: #35514c;
  --c-label: #4a5c59;
  --c-muted: #5d6f6c;
  --c-icon: #6b7c79;
  --c-placeholder: #7a8a87;
  --c-municipality: #2f4a45;

  /* pozadí a linky */
  --c-page: #f3f6f5;
  --c-list: #eef3f1;
  --c-group: #e8efed;
  --c-municipality-bg: #d3e5e0;
  --c-section-bar: #f6f9f8;
  --c-input: #f2f6f5;
  --c-map: #dfe8e4;
  --c-line-input: #d5dfdc;
  --c-line: #dfe6e4;
  --c-line-2: #e3e9e7;
  --c-line-card: #edf1f0;
  --c-card-outline: #d9e2df;
  --c-node-ring: #c9d6d3;
  --c-band: #71a88c;        /* pás nad mapou a seznamem – původní zelená starého webu (Navrh-Funkce-Navrh) */
  --c-band-line: #5f9278;

  /* stavy */
  --c-selected: #ffd9a6;
  --c-selected-ring: #ef6c00;
  --c-selected-line: #f2c27f;
  --c-hover: #f4f9f8;
  --c-hover-outline: #9cc9bf;
  --c-hover-ring: #7fb8ad;
  --c-gps: #1e88e5;

  /* divoká voda – modrošedé akcenty (tabule Výběr řeky) */
  --c-ww: #34507a;
  --c-ww-bg: #e8ecf3;

  /* štítky */
  --c-ok-text: #0d47a1;
  --c-ok-bg: #e3eefb;
  --c-bad-text: #b71c1c;
  --c-bad-bg: #fdecea;
  --c-danger: #c62828;
  --c-carry-text: #8a4b00;
  --c-carry-bg: #fff0d9;

  /* sjízdnost – návrh 3 */
  --c-water: #4a90e2;
  --c-dry: #b4bcc1;
  --c-high: #e0574a;
  --c-advise: #8e5bb5;
  --c-nodata: #cfd8dc;

  /* rozměry */
  --header-h: 56px;
  --control-h: 40px;
  --chip-h: 32px;
  --touch: 44px;
  --r-s: 8px;
  --r-card: 10px;
  --r-m: 12px;
  --r-pill: 999px;
  --shadow-card: 0 0 0 1px var(--c-card-outline), 0 1px 3px rgba(0, 0, 0, .10);
  --shadow-float: 0 4px 16px rgba(0, 0, 0, .16);

  --font: Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-page);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }

a { color: var(--c-link); text-decoration: none; }
a:hover { color: var(--c-link-hover); text-decoration: underline; }

h1, h2, h3 { color: var(--c-heading); font-weight: 500; line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }

.num { font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- hlavička (tabule Návrh 1 – Řeka desktop / mobil, Výběr řeky) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 1100; /* panely hlavičky nad mapou (ovládání Leafletu má z-index 1000) */
  min-height: var(--header-h); flex-shrink: 0;
  background: var(--c-primary);
  color: #fff;
  display: flex; align-items: center; gap: 16px;
  padding: 8px 16px 8px 14px;
}
.site-header a { color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 500; letter-spacing: .2px; white-space: nowrap; }
.brand:hover { text-decoration: none; color: #fff; }
.brand img { width: 36px; height: 36px; flex-shrink: 0; }
.header-divider { width: 1px; height: 24px; background: rgba(255, 255, 255, .3); }
.header-spacer { flex-grow: 1; }
.header-icon-btn { width: var(--touch); height: var(--touch); flex-shrink: 0; display: none; align-items: center; justify-content: center; border-radius: 50%; }
.header-icon-btn:hover { background: rgba(255, 255, 255, .12); }
.header-river { display: none; }

/* štítky */
.ww-tag {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--c-ww-bg); color: var(--c-ww); white-space: nowrap; line-height: 1.4;
}
.country-tag { font-size: 11px; font-weight: 700; color: var(--c-muted); background: #eef1f0; padding: 1px 6px; border-radius: 4px; vertical-align: 1px; }

/* výběr řeky – tlačítko v hlavičce; panel se měří k hlavičce (sticky = obsahující blok) */
.river-picker > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  height: var(--control-h); padding: 0 12px;
  border-radius: var(--r-s);
  background: rgba(255, 255, 255, .14);
  font-size: 15px; font-weight: 500; white-space: nowrap;
}
.river-picker > summary::-webkit-details-marker { display: none; }
.river-picker > summary:hover { background: rgba(255, 255, 255, .22); }
.river-picker .length { color: var(--c-primary-soft); font-weight: 400; }
.river-picker-chevron { display: flex; }
.river-picker[open] > summary { background: #fff; color: var(--c-primary); }
.river-picker[open] > summary .length { color: var(--c-muted); }
.river-picker[open] .river-picker-chevron { transform: rotate(180deg); }

.rp-panel {
  position: absolute; top: 100%; left: 0; width: 640px; max-width: 100vw; max-height: calc(100vh - var(--header-h) - 16px);
  display: flex; flex-direction: column; gap: 6px; padding: 12px 10px 8px;
  background: #fff; color: var(--c-text); border-radius: 0 0 14px 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.rp-body { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }
.rp-view { display: flex; flex-direction: column; gap: 6px; }
.rp-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 10px 4px; }
.rp-head-sub { padding: 10px 10px 2px; }
.rp-label { font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--c-muted); }
.rp-label-wild { color: var(--c-ww); }
.site-header .rp-where { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 500; color: var(--c-primary); }
.rp-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; align-items: start; }
.site-header .rp-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border-radius: var(--r-s); color: var(--c-text); }
.site-header .rp-item:hover { background: var(--c-hover); text-decoration: none; color: var(--c-text); }
.rp-check { display: flex; width: 18px; flex-shrink: 0; color: var(--c-primary); }
.rp-name { flex-grow: 1; min-width: 0; font-size: 15px; font-weight: 500; }
.rp-km { font-size: 13px; color: var(--c-muted); white-space: nowrap; }
.site-header .rp-item.is-current { background: #e6f2ef; }
.rp-item.is-current .rp-name { font-weight: 700; }
.rp-view-wild .rp-check { color: var(--c-ww); }
.site-header .rp-view-wild .rp-item.is-current { background: var(--c-ww-bg); }
.site-header .rp-foot { flex-shrink: 0; display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 12px 12px 6px; border-top: 1px solid var(--c-line-2); }
.site-header .rp-to-wild { color: var(--c-ww); }
.site-header .rp-to-wild .ww-tag { font-size: 12px; }
.rp-foot-text { flex-grow: 1; font-size: 14px; color: var(--c-label); }
.site-header .rp-to-tourist { gap: 8px; font-size: 14px; font-weight: 500; color: var(--c-primary); }
.site-header .rp-foot:hover { text-decoration: none; background: var(--c-hover); }
.river-picker[data-view="tourist"] .rp-view-wild, .river-picker[data-view="tourist"] .rp-to-tourist,
.river-picker[data-view="wild"] .rp-view-tourist, .river-picker[data-view="wild"] .rp-to-wild { display: none; }

.overlay-top { display: none; }
.only-narrow { display: none; }
.pill-close {
  height: var(--touch); display: flex; align-items: center; gap: 4px; padding: 0 16px 0 10px; flex-shrink: 0;
  border: 0; border-radius: var(--r-pill); background: var(--c-list); color: var(--c-heading); font: 500 15px var(--font); cursor: pointer;
}
.pill-close:hover { background: #e2ebe8; }

.site-search { flex: 0 1 300px; min-width: 0; }
.site-search label {
  display: flex; align-items: center; gap: 8px; height: var(--control-h); padding: 0 12px;
  background: #fff; border-radius: var(--r-s); color: var(--c-muted);
}
.site-search input {
  border: 0; outline: 0; flex-grow: 1; min-width: 0; background: transparent;
  font: 400 14px var(--font); color: var(--c-text);
}
.site-nav { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 500; }
.site-nav .nav-link { padding: 10px 12px; border-radius: var(--r-s); }
.site-nav .nav-link:hover { background: rgba(255, 255, 255, .12); text-decoration: none; }
.btn-outline-light {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; margin-left: 12px;
  border: 1px solid rgba(255, 255, 255, .6); border-radius: var(--r-pill); white-space: nowrap; font-size: 13px; font-weight: 500;
}
.btn-outline-light:hover { background: rgba(255, 255, 255, .12); text-decoration: none; }

/* menu ☰ – tablet a desktop rozbalovací nabídka, mobil přes celou obrazovku */
.site-menu > summary {
  list-style: none; cursor: pointer; width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-s);
}
.site-menu > summary::-webkit-details-marker { display: none; }
.site-menu > summary:hover, .site-menu[open] > summary { background: rgba(255, 255, 255, .14); }
.sm-panel {
  position: absolute; top: calc(100% - 4px); right: 8px; width: 300px; max-height: calc(100vh - var(--header-h));
  overflow-y: auto; padding: 6px 0; background: #fff; color: var(--c-text); border-radius: var(--r-m); box-shadow: var(--shadow-float);
}
.sm-river, .sm-legal { display: none; }
.site-header .sm-row { min-height: var(--touch); display: flex; align-items: center; gap: 12px; padding: 0 16px; color: var(--c-heading); }
.site-header .sm-row:hover { background: var(--c-hover); text-decoration: none; color: var(--c-heading); }
.sm-ico { display: flex; color: var(--c-primary); }
.sm-text { flex-grow: 1; font-size: 15px; font-weight: 500; }
.sm-arrow { display: flex; color: #9fb0ac; }
.sm-more { display: flex; flex-direction: column; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--c-line-card); }
.site-header .sm-more a { padding: 8px 16px; font-size: 14px; color: var(--c-label); }
.site-header .sm-more a:hover { background: var(--c-hover); text-decoration: none; color: var(--c-heading); }

/* ---------- obsah ---------- */
main { flex: 1 0 auto; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.page { padding-top: 32px; padding-bottom: 48px; }
.kicker { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--c-primary); }

.card { background: #fff; border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 16px; border-radius: var(--r-s);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); color: #fff; text-decoration: none; }
.btn-secondary { background: #fff; color: var(--c-primary); border-color: var(--c-primary); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: var(--chip-h); padding: 0 12px;
  border-radius: var(--r-pill); border: 1px solid var(--c-line-input); background: #fff;
  font-size: 14px; color: var(--c-text); white-space: nowrap; /* návrh 13 – zvětšeno pro čitelnost */
}
.chip .count { color: var(--c-muted); }
.chip.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 500; }
.chip.active .count { color: var(--c-primary-soft); }

/* ---------- patička ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--c-line); padding: 24px 0; font-size: 14px; color: var(--c-secondary); }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; }
.site-footer .copyright { margin-left: auto; color: var(--c-muted); }

/* ---------- chybové stránky ---------- */
.error-page { text-align: center; padding: 64px 0; }
.error-page .code { font-size: 64px; font-weight: 700; color: var(--c-primary); line-height: 1; }

/* ---------- body přerušení (D2): mobil < 768, tablet 768–1279, desktop ≥ 1280 ---------- */
@media (max-width: 1279.98px) {
  .site-header { gap: 12px; padding: 0 10px 0 14px; min-height: var(--header-h); }
  .brand { font-size: 16px; letter-spacing: 0; }
  .brand img { width: 34px; height: 34px; }
  .header-divider { display: none; }
  .site-search { flex: 1 1 auto; max-width: 300px; }
  .site-nav { display: none; }
  .site-menu > summary { width: var(--touch); height: var(--touch); border-radius: 50%; }
  .site-menu > summary svg { width: 18px; height: 18px; }
}

/* mobil: hlavička všude stejná (logo, název řeky jako nadpis, hledání, ☰); řeka se mění v menu → Změnit řeku */
@media (max-width: 767.98px) {
  .site-header { gap: 10px; padding: 0 6px 0 12px; height: var(--header-h); }
  .site-header.has-river .brand-name, .header-divider, .site-search, .header-spacer { display: none; }
  .site-header:not(.has-river) .brand { flex-grow: 1; }
  .brand img { width: 32px; height: 32px; }
  .header-river { flex-grow: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
  .header-river-name { font-size: 18px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .header-river .length { font-size: 13px; color: var(--c-primary-soft); white-space: nowrap; }
  .header-river .ww-tag { align-self: center; }
  .river-picker { position: absolute; }
  .river-picker > summary { display: none; }
  .header-icon-btn { display: flex; }
  .site-menu > summary svg { width: 22px; height: 22px; }
  .only-wide { display: none; }
  .only-narrow { display: inline; }
  h1 { font-size: 24px; }

  /* bez JavaScriptu: panely pod hlavičkou přes celou šířku */
  .rp-panel, .sm-panel { left: 0; right: 0; top: 100%; width: auto; border-radius: 0; max-height: calc(100vh - var(--header-h)); overflow-y: auto; }

  /* s JavaScriptem: přes celou obrazovku se „✕ Zavřít“ (tabule Výběr řeky a Řeka, mobil – obrazovka 5) */
  .js .rp-panel, .js .sm-panel {
    position: fixed; inset: 0; z-index: 2000; max-height: none; width: auto; padding: 0; gap: 0;
    display: flex; flex-direction: column; overflow: hidden; border-radius: 0; box-shadow: none; background: #fff;
  }
  .js .overlay-top { height: 60px; flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 18px; border-bottom: 1px solid var(--c-line-2); }
  .overlay-top h2 { margin: 0; flex-grow: 1; font-size: 19px; font-weight: 500; color: var(--c-text); }

  .rp-body { flex-grow: 1; }
  .rp-view { gap: 0; }
  .rp-head, .rp-head-sub { padding: 14px 16px 6px; }
  .site-header .rp-where { display: none; }
  .rp-list { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .site-header .rp-item { min-height: 48px; gap: 12px; padding: 0 16px 0 12px; border-radius: 0; border-bottom: 1px solid var(--c-line-card); }
  .rp-check { width: 22px; }
  .rp-check svg { width: 20px; height: 20px; }
  .rp-name { font-size: 17px; }
  .rp-km { font-size: 14px; }
  .site-header .rp-foot { min-height: 60px; margin: 0; padding: 0 16px; background: #f8faf9; }
  .site-header .rp-to-tourist { font-size: 15px; }

  .sm-scroll { flex-grow: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
  .sm-river { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--c-page); border-bottom: 1px solid var(--c-line-2); }
  .sm-label { font-size: 12px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--c-muted); }
  .sm-river-row { display: flex; align-items: center; gap: 12px; }
  .sm-river-ico { width: 44px; height: 44px; flex-shrink: 0; border-radius: var(--r-m); background: #e3f1ee; color: var(--c-primary); display: flex; align-items: center; justify-content: center; }
  .sm-river-text { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; }
  .sm-river-text strong { font-size: 18px; font-weight: 500; color: var(--c-text); }
  .sm-river-text span { font-size: 13px; color: var(--c-muted); }
  .site-header .sm-change {
    height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--r-m);
    background: var(--c-primary); color: #fff; font-size: 16px; font-weight: 500;
  }
  .site-header .sm-change:hover { background: var(--c-primary-hover); text-decoration: none; }
  .sm-main { display: flex; flex-direction: column; }
  .site-header .sm-row { min-height: 52px; gap: 14px; padding: 0 18px; border-bottom: 1px solid var(--c-line-card); }
  .sm-text { font-size: 16px; }
  .sm-more { display: none; }
  .sm-legal { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: auto; padding: 16px 18px 22px; font-size: 14px; }
  .site-header .sm-legal a { color: var(--c-label); }

  body.popup-open { overflow: hidden; }
}

/* ---------- sjízdnost (návrh 3, DESIGN-WEB kap. 5): čára 12 px, „proud“ = modrý pruh 4 px uprostřed ---------- */
:root {
  --w-low: var(--c-dry);
  --w-lower: linear-gradient(90deg, var(--c-dry) 0 4px, var(--c-water) 4px 8px, var(--c-dry) 8px);
  --w-ok: var(--c-water);
  --w-higher: linear-gradient(90deg, var(--c-high) 0 4px, var(--c-water) 4px 8px, var(--c-high) 8px);
  --w-high: var(--c-high);
  --w-advise: repeating-linear-gradient(180deg, var(--c-advise) 0 8px, #fff 8px 12px);
  --w-nodata: repeating-linear-gradient(180deg, var(--c-nodata) 0 6px, transparent 6px 10px);
}
.w-low { background: var(--w-low); }
.w-lower { background: var(--w-lower); }
.w-ok { background: var(--w-ok); }
.w-higher { background: var(--w-higher); }
.w-high { background: var(--w-high); }
.w-advise { background: var(--w-advise); }
.w-nodata { background: var(--w-nodata); }
.w-none { display: none; }
/* text stavu vody */
.ws-low, .ws-nodata { color: #455a64; }
.ws-lower, .ws-ok { color: var(--c-ok-text); }
.ws-higher, .ws-high { color: var(--c-bad-text); }
.ws-advise { color: #4a148c; }

/* ---------- svislý přehled sjízdnosti: uzel = začátek úseku, čára = stav vody (návrh 3; stránka sjízdnosti, Kde je voda, přehled řeky) ---------- */
.wo { list-style: none; margin: 0; padding: 0; }
.wo-item { position: relative; min-height: 44px; padding: 0 0 0 30px; }
.wo-line { position: absolute; left: 8px; top: 10px; bottom: -10px; width: 12px; z-index: 1; }
.wo-item:last-child .wo-line { bottom: -14px; }
.wo-end { min-height: 28px; }
.wo-dot { position: absolute; left: 6px; top: 6px; width: 16px; height: 16px; border-radius: 50%; box-sizing: border-box; background: #1c2b2a; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--c-node-ring); z-index: 2; }
.wo-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; min-height: 28px; }
.wo-name { font-size: 15px; font-weight: 500; color: var(--c-text); line-height: 28px; }
a.wo-name:hover { color: var(--c-link); }
.wo-state { font-size: 13px; font-weight: 700; }
