/* ==========================================================================
   Mapa RP zon - SafeZone / MidZona / PD zona
   Pouziva ji jak samostatna pracovni stranka (pages/mapa-zon.html), tak sekce
   v pravidlech (pages/rules.html). Chovani je v assets/js/mapa-zon.js.
   ========================================================================== */

:root {
  --z-safe: #22c55e;
  --z-mid:  #f59e0b;
  --z-pd:   #3b82f6;
}

/* ---- ramec mapy ---- */
.zmap-wrap { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .zmap-wrap { grid-template-columns: minmax(0,1fr) 22rem; } }

/* Vlozena v pravidlech ma mapa uzsi sloupec (sidebar bere 17rem). Na postranni
   panel uz nezbyva rozumna sirka, takze mapa jde pres celou sirku a detail se
   seznamem se poskladaji pod ni vedle sebe. */
.zmap-wrap.is-embed { grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .zmap-wrap.is-embed .zside { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
}
/* Na telefonu je mapa v karte pravidel zbytecne uzka - necha se presahnout
   pres odsazeni karty, aby zbyla rozumna plocha na cteni. */
@media (max-width: 640px) {
  .zmap-wrap.is-embed .zmap-viewport { margin-left: -.75rem; margin-right: -.75rem; border-radius: .6rem; }
}

.zmap-viewport {
  position: relative; overflow: hidden;
  background: #0a1420;
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 1rem;
  touch-action: none;
  cursor: grab;
}
.zmap-viewport.is-panning { cursor: grabbing; }
.zmap-viewport.is-drawing { cursor: crosshair; }

/* Priblizeni se nedela transformaci, ale skutecnou velikosti (nastavuje ji JS).
   Diky tomu prohlizec prekresluje SVG i obrazek v cilovem rozliseni, misto aby
   zvetsoval hotovou bitmapu - popisky zon zustanou ostre v kazdem priblizeni.
   Transformace zbyva jen na posun, ktery je levny a nevynucuje prepocet. */
.zmap-stage {
  position: absolute; top: 0; left: 0;
  width: 1000px; height: 1000px;
  transform-origin: 0 0;
}
.zmap-img {
  display: block; position: absolute; top: 0; left: 0;
  width: 1000px; height: 1000px;
  transform-origin: 0 0;
  user-select: none; -webkit-user-drag: none;
}
.zmap-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* ---- tvary zon ---- */
.zone-shape { cursor: pointer; transition: fill-opacity .15s; outline: none; }
.zone-shape:focus-visible { stroke-dasharray: 6 4; }

.zone-label {
  font-weight: 700; fill: #fff; text-anchor: middle;
  paint-order: stroke; stroke: rgba(2,6,23,.85); stroke-linejoin: round;
  pointer-events: none; user-select: none;
}

/* ---- ovladaci prvky nad mapou ---- */
.zmap-tools {
  position: absolute; top: .75rem; right: .75rem; z-index: 5;
  display: flex; flex-direction: column; gap: .35rem;
}
.zmap-btn {
  width: 2.25rem; height: 2.25rem; display: grid; place-items: center;
  background: rgba(15,23,42,.9); color: #e2e8f0;
  border: 1px solid rgba(148,163,184,.3); border-radius: .55rem;
  font-size: .85rem; cursor: pointer; transition: all .2s;
}
.zmap-btn:hover { color: #00ebfc; border-color: #00ebfc; }

.zmap-hint {
  position: absolute; left: .75rem; bottom: .75rem; z-index: 5;
  background: rgba(15,23,42,.85); border: 1px solid rgba(148,163,184,.25);
  border-radius: .55rem; padding: .3rem .6rem;
  font-size: .7rem; color: #94a3b8; letter-spacing: .02em;
  pointer-events: none;
}

/* ---- legenda ---- */
.zlegend { display: flex; flex-wrap: wrap; gap: .5rem; }
.zlegend-item {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .45rem .8rem; border-radius: 999px; cursor: pointer;
  background: rgba(15,23,42,.7); border: 1px solid rgba(148,163,184,.25);
  font-size: .8rem; font-weight: 600; color: #cbd5e1; transition: all .2s;
}
.zlegend-item:hover { border-color: currentColor; }
.zlegend-item.is-off { opacity: .4; }
.zlegend-dot { width: .7rem; height: .7rem; border-radius: 3px; flex: none; }

/* ---- postranni sloupec ---- */
.zside { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.zpanel {
  background: rgba(17,43,59,.35); border: 1px solid rgba(148,163,184,.2);
  border-radius: .9rem; padding: 1rem;
}
.zlist { display: flex; flex-direction: column; gap: .25rem; max-height: 20rem; overflow-y: auto; }
.zlist-item {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .5rem .6rem; border-radius: .5rem; text-align: left;
  background: transparent; border: 0; color: #cbd5e1; font-size: .85rem;
  cursor: pointer; transition: background .15s, color .15s;
}
.zlist-item:hover { background: rgba(0,235,252,.08); color: #fff; }
.zlist-item.is-active { background: rgba(0,235,252,.14); color: #fff; font-weight: 600; }
.zlist-dot { width: .6rem; height: .6rem; border-radius: 3px; flex: none; }
.zlist-empty { color: #64748b; font-size: .8rem; padding: .5rem .6rem; }

/* ---- detail zony ---- */
.zbadge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .2rem .6rem; border-radius: 999px;
  font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
/* pre-line: v popisu zony se drzi zalomeni radku tak, jak ho autor napsal */
.zdesc { white-space: pre-line; }
.zrules { margin-top: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.zrule { display: flex; gap: .5rem; font-size: .85rem; color: #cbd5e1; line-height: 1.5; }
.zrule i { margin-top: .35rem; flex: none; font-size: .5rem; }

/* ---- karty typu zon ---- */
.ztype-grid { display: grid; gap: 1rem; }
@media (min-width: 768px) { .ztype-grid { grid-template-columns: repeat(3, 1fr); } }
.ztype-card {
  border-left: 4px solid; border-radius: .9rem; padding: 1.25rem;
  background: rgba(17,43,59,.35);
  border-top: 1px solid rgba(148,163,184,.15);
  border-right: 1px solid rgba(148,163,184,.15);
  border-bottom: 1px solid rgba(148,163,184,.15);
}
.ztype-card h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: .1rem; }
.ztype-card .ztype-sub { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; margin-bottom: .75rem; }
.ztype-card p:last-child { font-size: .875rem; color: #cbd5e1; }

/* ---- editor (jen na pracovni strance) ---- */
.zfield { display: block; margin-bottom: .6rem; }
.zfield span { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; margin-bottom: .25rem; }
.zinput {
  width: 100%; background: rgba(2,6,23,.6); color: #e2e8f0;
  border: 1px solid rgba(148,163,184,.3); border-radius: .5rem;
  padding: .45rem .6rem; font-size: .85rem; font-family: inherit;
}
.zinput:focus { outline: none; border-color: #00ebfc; }
textarea.zinput { min-height: 7rem; font-family: ui-monospace, Consolas, monospace; font-size: .75rem; resize: vertical; }
.zmode-btn {
  flex: 1; padding: .45rem .3rem; border-radius: .5rem; font-size: .78rem; font-weight: 600;
  background: rgba(2,6,23,.6); color: #94a3b8;
  border: 1px solid rgba(148,163,184,.25); cursor: pointer; transition: all .2s;
}
.zmode-btn:hover { color: #e2e8f0; }
.zmode-btn.is-on { background: rgba(0,235,252,.15); color: #00ebfc; border-color: #00ebfc; }
.zbtn {
  padding: .45rem .8rem; border-radius: .5rem; font-size: .8rem; font-weight: 600;
  background: rgba(0,235,252,.12); color: #00ebfc;
  border: 1px solid rgba(0,235,252,.4); cursor: pointer; transition: all .2s;
}
.zbtn:hover { background: rgba(0,235,252,.22); }
.zbtn-danger { background: rgba(239,68,68,.12); color: #f87171; border-color: rgba(239,68,68,.4); }
.zbtn-danger:hover { background: rgba(239,68,68,.22); }

/* non-scaling-stroke: bez nej by obrys pri priblizeni prerostl samotny uchyt
   a ten by vypadal jako tmavy puntik */
.vertex-handle { fill: #fff; stroke: #0f172a; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: move; }
.radius-handle { fill: #00ebfc; stroke: #0f172a; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: ew-resize; }
