/* ═══════════════════════════════════════════════════════
   MOJE ODHALENÁ EVROPA – stylesheet (v3, no header)
   ═══════════════════════════════════════════════════════ */

:root {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface2:    #1e2530;
  --border:      rgba(255,255,255,0.07);
  --gold:        #d4a84b;
  --gold-light:  #f0c96b;
  --gold-dim:    rgba(212,168,75,0.18);
  --teal:        #4ecdc4;
  --text:        #e6edf3;
  --text-muted:  #7d8590;
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --transition:  0.22s cubic-bezier(.4,0,.2,1);
  --shadow:      0 8px 32px rgba(0,0,0,0.55);
  --panel-w:     272px;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Jost', sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ════════════════ MAP (fullscreen) ════════════════ */
.map-wrapper { position: fixed; inset: 0; }
#map { width: 100%; height: 100%; }

.leaflet-control-attribution {
  background: rgba(13,17,23,0.7) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--gold) !important; }
.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover { background: var(--surface2) !important; color: var(--gold) !important; }

/* ════════════════ STATS PANEL ════════════════ */
.stats-panel {
  position: absolute; top: 16px; right: 16px; z-index: 900;
  width: var(--panel-w);
  background: rgba(22,27,34,0.93);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  transition: var(--transition);
  overflow: hidden;
}

/* Collapsed = pouze ikona ✦ */
.stats-panel.collapsed {
  width: 0;
  border-color: transparent;
  pointer-events: none;
  opacity: 0;
}

.stats-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

/* Logo uvnitř panelu */
.stats-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap; overflow: hidden;
}
.stats-logo-icon { color: var(--gold); flex-shrink: 0; }
.stats-logo-text em { color: var(--gold); font-style: normal; }

.stats-collapse {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.1rem; line-height: 1;
  transition: var(--transition); padding: 2px 6px;
  border-radius: 4px; flex-shrink: 0;
}
.stats-collapse:hover { color: var(--text); background: var(--surface2); }

.stats-body {
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100vh - 80px); overflow-y: auto;
}

.stat-row { display: flex; align-items: baseline; gap: 8px; }
.stat-num { font-family: 'Cinzel', serif; font-size: 2rem; font-weight: 700; color: var(--gold); line-height: 1; }
.stat-desc { font-size: 0.78rem; color: var(--text-muted); }

.stats-divider { border: none; border-top: 1px solid var(--border); }

.country-list-label,
.layer-toggle-label { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }

.country-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.country-list li {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem; padding: 4px 8px;
  border-radius: 4px; cursor: pointer; transition: var(--transition);
}
.country-list li:hover { background: var(--gold-dim); color: var(--gold); }
.country-list .country-cnt {
  font-size: 0.7rem; color: var(--text-muted);
  background: var(--surface2); border-radius: 12px; padding: 1px 7px;
}

.filter-select {
  width: 100%; background: var(--surface2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 10px; font-family: 'Jost', sans-serif; font-size: 0.82rem; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--gold); }

.layer-btns { display: flex; gap: 6px; }
.layer-btn {
  flex: 1; padding: 5px 0; font-size: 0.75rem; font-family: 'Jost', sans-serif;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition);
}
.layer-btn.active, .layer-btn:hover { background: var(--gold-dim); color: var(--gold); border-color: rgba(212,168,75,0.4); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem; cursor: pointer; user-select: none;
}
.toggle-row input { display: none; }
.toggle-slider {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  position: relative; transition: var(--transition);
}
.toggle-slider::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-muted); transition: var(--transition);
}
.toggle-row input:checked + .toggle-slider { background: var(--gold-dim); border-color: var(--gold); }
.toggle-row input:checked + .toggle-slider::after { background: var(--gold); left: 19px; }

/* Akční tlačítka uvnitř panelu */
.panel-action-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 8px; font-size: 0.74rem; justify-content: center; }

/* ════════════════ TLAČÍTKO ZNOVUOTEVŘENÍ PANELU ════════════════ */
.panel-reopen {
  position: absolute; top: 16px; right: 16px; z-index: 900;
  width: 42px; height: 42px;
  background: rgba(22,27,34,0.93);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(212,168,75,0.4);
  border-radius: var(--radius-md);
  color: var(--gold);
  font-size: 1.1rem; cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: none; /* skryté dokud panel není collapsed */
  align-items: center; justify-content: center;
}
.panel-reopen:hover {
  background: var(--gold-dim);
  transform: scale(1.08);
}
/* Zobrazí se pouze když má panel třídu collapsed */
.stats-panel.collapsed ~ .panel-reopen {
  display: flex;
}

/* ════════════════ TIMELINE ════════════════ */
.timeline-panel {
  position: absolute; bottom: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 900; width: min(700px, calc(100vw - 32px));
  background: rgba(22,27,34,0.95); backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}
.timeline-panel.hidden { display: none; }
.timeline-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-family: 'Cinzel', serif; font-size: 0.72rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold);
}
.timeline-header button { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1rem; }
.timeline-body { padding: 12px 16px; overflow-x: auto; }
.timeline-track { display: flex; gap: 10px; min-width: max-content; padding-bottom: 4px; }
.timeline-item { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: var(--transition); }
.timeline-item:hover .tl-dot { background: var(--gold); transform: scale(1.2); }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); border: 2px solid var(--bg); transition: var(--transition); }
.tl-line { width: 40px; height: 2px; background: var(--border); margin-top: 4px; }
.tl-name { font-size: 0.68rem; color: var(--text); white-space: nowrap; }
.tl-date { font-size: 0.62rem; color: var(--text-muted); }

/* ════════════════ LOADING ════════════════ */
.map-loading {
  position: absolute; inset: 0; z-index: 800;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; background: var(--bg);
  font-size: 0.85rem; color: var(--text-muted);
  transition: opacity 0.5s;
}
.map-loading.hidden { opacity: 0; pointer-events: none; }
.loading-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════ MODAL ════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: min(480px, 100%);
  box-shadow: var(--shadow);
  animation: slideUp 0.25s cubic-bezier(.4,0,.2,1);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  font-family: 'Cinzel', serif; font-size: 0.85rem;
  letter-spacing: 0.08em; color: var(--gold);
  border-bottom: 1px solid var(--border);
}
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-body label { display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.04em; }
.modal-body input {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
  color: var(--text); font-family: 'Jost', sans-serif; font-size: 0.88rem;
  transition: var(--transition);
}
.modal-body input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-hint { font-size: 0.72rem; color: var(--text-muted); text-align: center; font-style: italic; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; border-top: 1px solid var(--border); }

/* ════════════════ BUTTONS ════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-family: 'Jost', sans-serif; font-size: 0.78rem; font-weight: 500;
  letter-spacing: 0.03em; cursor: pointer; border: none;
  transition: var(--transition); white-space: nowrap;
}
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: rgba(255,255,255,0.15); }
.btn-accent { background: var(--gold); color: #0d1117; font-weight: 600; }
.btn-accent:hover { background: var(--gold-light); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(212,168,75,0.35); }

/* ════════════════ TOOLTIP ════════════════ */
.leaflet-tooltip {
  background: rgba(22,27,34,0.95) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: var(--radius-sm) !important;
  font-family: 'Jost', sans-serif !important;
  font-size: 0.82rem !important;
  padding: 8px 12px !important;
  box-shadow: var(--shadow) !important;
}
.leaflet-tooltip::before { border-right-color: var(--border) !important; }
.tooltip-name { font-family: 'Cinzel', serif; color: var(--gold); font-size: 0.88rem; margin-bottom: 4px; }
.tooltip-row  { font-size: 0.74rem; color: var(--text-muted); }
.tooltip-row span { color: var(--text); }

/* ════════════════ UTILITY ════════════════ */
.hidden-file { display: none; }
.hidden { display: none !important; }

/* ════════════════ ZPĚT NA WEB ════════════════ */
.btn-back {
  position: absolute; top: 16px; left: 16px; z-index: 900;
  background: rgba(22,27,34,0.93);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  padding: 8px 14px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.btn-back:hover {
  color: var(--gold);
  border-color: rgba(212,168,75,0.4);
  background: var(--gold-dim);
}
@media (max-width: 600px) {
  :root { --panel-w: calc(100vw - 32px); }
  .stats-panel { top: auto; bottom: 60px; left: 16px; right: 16px; width: auto; }
  .stats-panel.collapsed { width: 0; }
  .panel-reopen { top: auto; bottom: 60px; right: 16px; }
  .stats-body { max-height: 55vh; }
}
