/* style.css — v5 — 2026-07-22 */

/* Vlastní písmo — odkomentuj po nahrání souboru do assets/fonts/
@font-face {
  font-family: 'Inter';
  src: url('fonts/InterVariable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}
*/

/* ==========================================================
   1. PROMĚNNÉ — jediné místo, kde se mění vzhled celého webu
   ========================================================== */
:root {
  /* Barvy typů vzkazů — musí odpovídat klíčům v config.php TYPY */
  --typ-setkani:    #4c9a5e;
  --typ-rozlouceni: #4a7fb5;
  --typ-vzpominka:  #8a8477;
  --typ-hledam:     #c0504a;

  /* Plochy */
  --bg:        #f4f2ed;
  --bg-2:      #ffffff;
  --bg-3:      #eae7e0;
  --bg-prekryv: rgba(20, 19, 17, 0.45);

  /* Text */
  --text:      #24231f;
  --text-2:    #5c5a53;
  --text-3:    #8e8b82;

  /* Linky a okraje */
  --cara:      #dcd8d0;
  --cara-2:    #c3beb4;

  /* Akce */
  --akce:      #2f5d8a;
  --akce-text: #ffffff;
  --chyba:     #a63f38;

  /* Rozměry */
  --r:         6px;
  --r-2:       12px;
  --mezera-xs: 4px;
  --mezera-s:  8px;
  --mezera-m:  16px;
  --mezera-l:  24px;
  --mezera-xl: 40px;

  /* Typografie */
  --pismo:      'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --pismo-text: var(--pismo);   /* písmo vzkazů; patkové: Georgia, serif */
  --velikost:   16px;
  --radek:      1.65;

  /* Ostatní */
  --stin:      0 1px 3px rgba(0,0,0,.08), 0 4px 14px rgba(0,0,0,.06);
  --prechod:   .18s ease;
  --panel-w:   380px;
}

/* Noční režim — automaticky */
@media (prefers-color-scheme: dark) {
  :root:not([data-rezim='den']) {
    --bg:        #171614;
    --bg-2:      #201f1c;
    --bg-3:      #2a2926;
    --bg-prekryv: rgba(0, 0, 0, .6);
    --text:      #e8e5de;
    --text-2:    #a8a49b;
    --text-3:    #78756d;
    --cara:      #333230;
    --cara-2:    #45443f;
    --akce:      #6ba3d8;
    --akce-text: #14130f;
    --chyba:     #e08078;
    --stin:      0 1px 3px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
    --typ-setkani:    #6cb87e;
    --typ-rozlouceni: #6b9fd0;
    --typ-vzpominka:  #a8a294;
    --typ-hledam:     #db6f68;
  }
}

/* Noční režim — ručně přepnutý */
:root[data-rezim='noc'] {
  --bg:        #171614;
  --bg-2:      #201f1c;
  --bg-3:      #2a2926;
  --bg-prekryv: rgba(0, 0, 0, .6);
  --text:      #e8e5de;
  --text-2:    #a8a49b;
  --text-3:    #78756d;
  --cara:      #333230;
  --cara-2:    #45443f;
  --akce:      #6ba3d8;
  --akce-text: #14130f;
  --chyba:     #e08078;
  --stin:      0 1px 3px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  --typ-setkani:    #6cb87e;
  --typ-rozlouceni: #6b9fd0;
  --typ-vzpominka:  #a8a294;
  --typ-hledam:     #db6f68;
}

/* ==========================================================
   2. ZÁKLAD
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--pismo);
  font-size: var(--velikost);
  line-height: var(--radek);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--akce);
  outline-offset: 2px;
}

.skryte {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==========================================================
   3. MAPA
   ========================================================== */
#mapa {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--bg-3);
}

/* Tlumení dlaždic v nočním režimu */
:root[data-rezim='noc'] .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-rezim='den']) .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6);
  }
}

.leaflet-container { font-family: var(--pismo); background: var(--bg-3); }
.leaflet-control-attribution {
  background: var(--bg-2) !important;
  color: var(--text-3) !important;
  font-size: 11px !important;
}
.leaflet-control-attribution a { color: var(--text-2) !important; }

/* Špendlík */
.pin {
  width: 22px; height: 30px;
  cursor: pointer;
  transition: transform var(--prechod);
}
.pin:hover { transform: scale(1.15); }
.pin svg { display: block; width: 100%; height: 100%; }
.pin-setkani    { color: var(--typ-setkani); }
.pin-rozlouceni { color: var(--typ-rozlouceni); }
.pin-vzpominka  { color: var(--typ-vzpominka); }
.pin-hledam     { color: var(--typ-hledam); }

/* Cluster — neutrální, barvy nese až jednotlivý špendlík */
.shluk {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-2);
  border: 2px solid var(--cara-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--stin);
  transition: transform var(--prechod);
}
.shluk:hover { transform: scale(1.08); }
.shluk-s { width: 34px; height: 34px; }
.shluk-m { width: 42px; height: 42px; font-size: 14px; }
.shluk-l { width: 52px; height: 52px; font-size: 15px; }

/* Bublina po najetí na špendlík */
.leaflet-tooltip.bublina {
  width: 240px;
  padding: 12px 14px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--cara-2);
  border-radius: var(--r-2);
  box-shadow: var(--stin);
  font-family: var(--pismo);
  font-size: 14px;
  line-height: 1.5;
  white-space: normal;
  pointer-events: none;
}
.leaflet-tooltip.bublina::before { display: none; }

.bublina-typ {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.bublina-typ .tecka { width: 8px; height: 8px; }

.bublina-misto {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 4px;
}

.bublina-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--pismo-text);
  font-size: 14px;
  line-height: 1.5;
}

/* ==========================================================
   4. HORNÍ LIŠTA
   ========================================================== */
.lista {
  position: absolute;
  top: var(--mezera-m);
  left: var(--mezera-m);
  right: var(--mezera-m);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: var(--mezera-s);
  pointer-events: none;
}
.lista > * { pointer-events: auto; }

.znacka {
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--text);
  padding: 10px var(--mezera-m);
  background: var(--bg-2);
  border: 1px solid var(--cara);
  border-radius: var(--r-2);
  box-shadow: var(--stin);
  cursor: pointer;
  transition: background var(--prechod), border-color var(--prechod);
}
.znacka:hover { background: var(--bg-3); border-color: var(--cara-2); }
.znacka:active { transform: translateY(1px); }

.lista-mezera { flex: 1; }

/* ==========================================================
   5. TLAČÍTKA
   ========================================================== */
.tl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--mezera-s);
  padding: 10px var(--mezera-m);
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--cara);
  border-radius: var(--r-2);
  box-shadow: var(--stin);
  cursor: pointer;
  transition: background var(--prechod), border-color var(--prechod);
  white-space: nowrap;
}
.tl:hover  { background: var(--bg-3); border-color: var(--cara-2); }
.tl:active { transform: translateY(1px); }
.tl[disabled] { opacity: .5; cursor: default; }

.tl-hlavni {
  background: var(--akce);
  color: var(--akce-text);
  border-color: transparent;
}
.tl-hlavni:hover { background: var(--akce); filter: brightness(1.08); }

.tl-ikona { padding: 10px 12px; }

.tl-text {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--text-2);
  padding: 6px 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.tl-text:hover { background: none; color: var(--text); }

/* ==========================================================
   6. FILTR TYPŮ
   ========================================================== */
.filtr {
  display: flex;
  gap: var(--mezera-xs);
  padding: 6px;
  background: var(--bg-2);
  border: 1px solid var(--cara);
  border-radius: var(--r-2);
  box-shadow: var(--stin);
}
.filtr-tl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: none;
  border: none;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-2);
  transition: background var(--prechod), color var(--prechod);
}
.filtr-tl:hover { background: var(--bg-3); }
.filtr-tl[aria-pressed='true'] { color: var(--text); background: var(--bg-3); }
.filtr-tl[aria-pressed='false'] { opacity: .45; }
.tecka {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.tecka-setkani    { color: var(--typ-setkani); }
.tecka-rozlouceni { color: var(--typ-rozlouceni); }
.tecka-vzpominka  { color: var(--typ-vzpominka); }
.tecka-hledam     { color: var(--typ-hledam); }

/* ==========================================================
   7. PANEL (detail / formulář)
   ========================================================== */
.panel {
  position: absolute;
  top: 0; right: 0;
  z-index: 600;
  width: var(--panel-w);
  max-width: 100%;
  height: 100%;
  background: var(--bg-2);
  border-left: 1px solid var(--cara);
  box-shadow: var(--stin);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.32,.72,.35,1);
  visibility: hidden;
}
.panel.otevren { transform: translateX(0); visibility: visible; }

.panel-hlava {
  display: flex;
  align-items: center;
  gap: var(--mezera-s);
  padding: var(--mezera-m) var(--mezera-l);
  border-bottom: 1px solid var(--cara);
  flex: none;
}
.panel-nadpis {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  flex: 1;
}
.panel-telo {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--mezera-l);
}
.panel-pata {
  flex: none;
  padding: var(--mezera-m) var(--mezera-l);
  border-top: 1px solid var(--cara);
  display: flex;
  gap: var(--mezera-s);
}

/* ==========================================================
   8. FORMULÁŘ
   ========================================================== */
.pole { margin-bottom: var(--mezera-l); }
.pole label {
  display: block;
  margin-bottom: var(--mezera-s);
  font-size: 14px;
  color: var(--text-2);
}
.pole-napoveda {
  margin-top: var(--mezera-xs);
  font-size: 13px;
  color: var(--text-3);
}

.vstup, .oblast {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--cara-2);
  border-radius: var(--r);
  transition: border-color var(--prechod);
}
.vstup:focus, .oblast:focus {
  border-color: var(--akce);
  outline: none;
}
.oblast {
  min-height: 150px;
  resize: vertical;
  font-family: var(--pismo-text);
  line-height: 1.7;
}

.typy { display: grid; gap: var(--mezera-s); }
.typ-volba {
  display: flex;
  align-items: flex-start;
  gap: var(--mezera-s);
  padding: 12px;
  border: 1px solid var(--cara);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color var(--prechod), background var(--prechod);
}
.typ-volba:hover { background: var(--bg-3); }
.typ-volba input { margin: 4px 0 0; accent-color: var(--akce); }
.typ-volba:has(input:checked) { border-color: var(--cara-2); background: var(--bg-3); }
.typ-nazev { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.typ-popis { font-size: 13px; color: var(--text-3); }

.pocitadlo {
  text-align: right;
  font-size: 13px;
  color: var(--text-3);
  margin-top: var(--mezera-xs);
  font-variant-numeric: tabular-nums;
}
.pocitadlo.blizko { color: var(--chyba); }

.honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================
   9. DETAIL VZKAZU
   ========================================================== */
.stitek {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-3);
  font-size: 13px;
  color: var(--text-2);
}
.vzkaz-text {
  font-family: var(--pismo-text);
  font-size: 16px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: var(--mezera-l) 0;
}
.vzkaz-meta {
  font-size: 13px;
  color: var(--text-3);
  border-top: 1px solid var(--cara);
  padding-top: var(--mezera-m);
  display: grid;
  gap: var(--mezera-xs);
}

/* ==========================================================
   10. HLÁŠENÍ
   ========================================================== */
.hlaseni {
  position: absolute;
  bottom: var(--mezera-l);
  left: 50%;
  transform: translate(-50%, 120%);
  z-index: 900;
  max-width: 90vw;
  padding: 12px var(--mezera-l);
  background: var(--bg-2);
  border: 1px solid var(--cara-2);
  border-radius: var(--r-2);
  box-shadow: var(--stin);
  font-size: 15px;
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
  pointer-events: none;
}
.hlaseni.vidno { transform: translate(-50%, 0); opacity: 1; }
.hlaseni.chyba { border-color: var(--chyba); color: var(--chyba); }

/* Nápověda při umísťování špendlíku */
.pokyn {
  position: absolute;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 550;
  padding: 10px var(--mezera-l);
  background: var(--bg-2);
  border: 1px solid var(--cara-2);
  border-radius: 999px;
  box-shadow: var(--stin);
  font-size: 15px;
  display: none;
}
.pokyn.vidno { display: block; }

/* ==========================================================
   11. MOBIL
   ========================================================== */
@media (max-width: 760px) {
  :root { --panel-w: 100%; }

  .lista {
    top: auto;
    bottom: var(--mezera-m);
    flex-wrap: wrap;
    justify-content: center;
  }
  .znacka { font-size: 15px; padding: 8px 12px; }
  .filtr { order: -1; width: 100%; justify-content: center; overflow-x: auto; }
  .filtr-tl { padding: 6px 10px; font-size: 13px; }
  .pokyn { top: var(--mezera-m); font-size: 14px; }
  .panel { border-left: none; }
}

/* ==========================================================
   12. KURZOR PŘI UMÍSŤOVÁNÍ
   ========================================================== */
.umistuje #mapa,
.umistuje .leaflet-container,
.umistuje .leaflet-grab,
.umistuje .leaflet-interactive {
  cursor: crosshair;
}

/* ==========================================================
   13. PŘÍSTUPNOST
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
