/* ==========================================================================
   Akce Roztoky - Stylopis pro interaktivní mapu událostí (Protomaps OSM)
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --sidebar-width: 420px;
  --header-height: 64px;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-family);
  color: var(--text-main);
  background-color: var(--bg-main);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Hlavní layout aplikace */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Horní lišta / Header */
.app-header {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 20;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand-text h1 {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-icon {
  padding: 0.5rem;
}

/* Hlavní plocha (boční panel + mapa) */
.main-content {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Boční panel s událostmi */
.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: #ffffff;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 15;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-md);
  /* celý panel se rolují jako jeden celek; nahoře zůstává jen vyhledávání (.sidebar-search) */
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.sidebar > * {
  flex: 0 0 auto;
}

.sidebar.closed {
  transform: translateX(-100%);
  position: absolute;
}

/* Přepínač hlavních záložek v bočním panelu (Akce na mapě vs Obecní zprávy) */
.sidebar-tabs {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
  padding: 0.35rem 0.5rem 0;
  gap: 0.35rem;
}

.sidebar-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.sidebar-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.5);
}

.sidebar-tab.active {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--border-color);
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.03);
}

.tab-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: #e2e8f0;
  color: var(--text-secondary);
}

.sidebar-tab.active .tab-badge {
  background: var(--primary-light);
  color: var(--primary);
}

/* Přepínání obsahu záložek */
.tab-content {
  display: none;
  flex-direction: column;
}

.tab-content.active {
  display: flex;
}

/* Karta obecní zprávy */
.zprava-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.zprava-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.zprava-card.is-important {
  border-left: 4px solid #ef4444;
  background: #fffdfd;
}

.badge-important {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
}

.zprava-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.zprava-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.zprava-date svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.zprava-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.zprava-desc {
  font-size: 0.84375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.zprava-docs-box {
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.zprava-docs-title {
  font-size: 0.71875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.zprava-docs-title svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

/* Vyhledávací pole přilepené nahoře při rolování panelu */
.sidebar-search {
  position: sticky;
  top: 0;
  z-index: 6;
  padding: 0.75rem 1.25rem;
  background: #fafafa;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-search .search-box {
  margin-bottom: 0;
}

/* Vyhledávání a filtry */
.sidebar-controls {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  background: #fafafa;
}

.search-box {
  position: relative;
  margin-bottom: 0.75rem;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  padding: 0.6rem 2.2rem 0.6rem 2.2rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: #ffffff;
  transition: all 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-clear {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: none;
}

.search-clear.visible {
  display: block;
}

/* Přepínač pro zobrazení historických akcí */
.history-toggle-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding: 0.45rem 0.65rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.history-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  touch-action: manipulation;
}

.history-toggle-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.history-toggle-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
  background-color: #cbd5e1;
  border-radius: 9999px;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.history-toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.history-toggle-checkbox:checked + .history-toggle-switch {
  background-color: var(--primary);
}

.history-toggle-checkbox:checked + .history-toggle-switch::after {
  transform: translateX(14px);
}

.history-toggle-caption {
  font-size: 0.8125rem;
  color: var(--text-main);
}

.history-count-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #64748b;
  background: #f1f5f9;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
}

/* Filtrační štítky */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.filter-pill {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.filter-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.filter-pill-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.35rem;
}

/* Seznam událostí */
.events-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

.events-list {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Karta události v seznamu */
.event-card, .zprava-card {
  scroll-margin-top: 70px; /* aby je přilepené vyhledávání nepřekrylo při doscrollování */
}

.event-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.event-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.event-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2), var(--shadow-md);
  background-color: #fbfdff;
}

.event-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-status {
  background: #f1f5f9;
  color: var(--text-secondary);
}

.badge-status-probiha {
  background: #fee2e2;
  color: #991b1b;
}

.badge-status-planovano {
  background: #fef3c7;
  color: #92400e;
}

.badge-status-priprava {
  background: #e0f2fe;
  color: #075985;
}

.badge-status-historie {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.event-card.is-history {
  border-left: 4px solid #94a3b8;
  background: #fcfcfd;
}

.event-card-group-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.event-card-group-pill svg {
  width: 12px;
  height: 12px;
  color: #94a3b8;
}

.event-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.event-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.info-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.info-item svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.event-card-annotation {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 0.25rem;
}

.event-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.35rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.docs-count {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--primary);
}

.docs-count svg {
  width: 14px;
  height: 14px;
}

/* Prázdný stav při nenalezení */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  color: #cbd5e1;
}

.empty-state h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

/* Kontejner mapy */
.map-container {
  flex: 1;
  position: relative;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  background-color: #e2e8f0;
}

/* Plovoucí ovládací prvky na mapě */
.map-overlay-tools {
  position: absolute;
  /* vedle (vlevo od) ovládání zoomu MapLibre v pravém horním rohu, aby se nepřekrývaly */
  top: 10px;
  right: 56px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 10;
}

.map-tool-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.map-tool-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.map-tool-btn svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Vlaječka / Vlastní marker na mapě
   DŮLEŽITÉ:
   Vnější obal .map-flag-marker-anchor je absolutně pozicován pomocí MapLibre GL
   inline stylem 'transform: translate(...)'. NIKDY zde nesmí být CSS transition
   ani transform v hoveru, jinak marker při zoomování a posunu mapy plave/ujíždí!
   ========================================================================== */
.map-flag-marker-anchor {
  width: 32px;
  height: 42px;
  pointer-events: none;
  user-select: none;
}

/* Vnitřní prvek vlaječky - zajišťuje hover zvětšení a klikání */
.flag-inner {
  width: 32px;
  height: 42px;
  position: relative;
  cursor: pointer;
  pointer-events: auto;
  /* Pata stožáru je přesně na [16px, 42px] */
  transform-origin: 16px 42px;
  transition: transform 0.16s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  -webkit-tap-highlight-color: transparent;
}

.flag-inner:hover {
  transform: scale(1.22);
}

.map-flag-marker-anchor.active .flag-inner {
  transform: scale(1.3);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}

.flag-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Pulsující tečka pod stožárem */
.flag-pulse-point {
  position: absolute;
  bottom: 0px;
  left: 14px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--marker-color, #e53e3e);
  pointer-events: none;
}

/* Počet událostí na sloučené lokalitě (badge na vlaječce) */
.flag-count-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9999px;
  background: #0f172a;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  border: 1.5px solid #ffffff;
  pointer-events: none;
}

.map-flag-marker-anchor.active .flag-pulse-point::after {
  content: "";
  position: absolute;
  top: -5px;
  left: -5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--marker-color, #e53e3e);
  animation: pulse-ring 1.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  80%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* MapLibre Popup úprava */
.maplibregl-popup {
  max-width: 400px !important;
  width: 380px;
  z-index: 100;
}

.maplibregl-popup-content {
  padding: 0 !important;
  border-radius: var(--radius-lg) !important;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid var(--border-color);
  background: #ffffff;
}

.maplibregl-popup-close-button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  right: 12px;
  top: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 10;
  touch-action: manipulation;
}

.maplibregl-popup-close-button:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

/* Obsah vyskakovacího okna (Popup) */
.event-popup {
  display: flex;
  flex-direction: column;
}

.popup-header {
  padding: 1.15rem 1.25rem 0.75rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  border-left: 6px solid var(--marker-color, var(--primary));
  padding-right: 3rem;
}

.popup-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.popup-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
}

/* Lišta přepínání ročníků v téže lokalitě */
.popup-edition-bar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem 1.15rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

.popup-edition-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.popup-edition-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.edition-tab {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  touch-action: manipulation;
}

.edition-tab:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.edition-tab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.popup-body {
  padding: 0.9rem 1.15rem 1.15rem;
  background: #ffffff;
  max-height: 55vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  -webkit-overflow-scrolling: touch;
}

.popup-info-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
}

.popup-info-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.popup-info-row strong {
  color: var(--text-main);
  min-width: 58px;
}

.popup-info-row svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  margin-top: 2px;
  flex-shrink: 0;
}

.popup-description {
  font-size: 0.84375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Přílohy jsou součástí popisu akce (jeden posuvný celek) */
.popup-documents {
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.documents-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.documents-heading svg {
  width: 15px;
  height: 15px;
  color: var(--primary);
}

.documents-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.doc-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  touch-action: manipulation;
  min-height: 48px;
}

.doc-item:hover, .doc-item:active {
  background: var(--primary-light);
  border-color: #bfdbfe;
}

.doc-badge-col {
  flex-shrink: 0;
  padding-top: 1px;
}

.doc-entry {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.doc-pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  margin-left: 0.85rem;
  padding: 0.35rem 0.5rem;
  min-height: 32px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #b91c1c;
  text-decoration: none;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
}

.doc-pdf-link:hover, .doc-pdf-link:active {
  background: #fee2e2;
  text-decoration: underline;
}

.doc-icon-badge-mini {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 0.1rem 0.3rem;
  font-size: 0.6rem;
}

.doc-icon-badge {
  font-size: 0.6875rem;
  font-weight: 800;
  padding: 0.25rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.04em;
  display: inline-block;
}

.doc-type-pdf .doc-icon-badge {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.doc-type-doc .doc-icon-badge,
.doc-type-docx .doc-icon-badge {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.doc-type-xls .doc-icon-badge,
.doc-type-xlsx .doc-icon-badge {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.doc-text-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
}

.doc-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: anywhere;
}

.doc-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.doc-size {
  color: var(--text-muted);
}

.doc-action-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--primary);
  background: #ffffff;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.doc-item:hover .doc-action-link,
.doc-item:active .doc-action-link {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Tlačítko pro mobil v hlavičce */
.btn-mobile-list {
  display: none;
}

/* Mobilní hlavička v bočním panelu (skryta na desktopu) */
.sidebar-mobile-header {
  display: none;
}

/* Ztmavlé pozadí za mobilním panelem */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.visible {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Plovoucí tlačítko na mapě pro otevření seznamu */
.mobile-sidebar-toggle {
  display: none;
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  background: #1e293b;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.65rem 1.15rem;
  border-radius: 9999px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  font-weight: 600;
  font-size: 0.84375rem;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mobile-sidebar-toggle:hover, .mobile-sidebar-toggle:active {
  background: var(--primary);
  transform: translateX(-50%) scale(1.04);
}

/* ==========================================================================
   Responzivní přizpůsobení pro mobilní zařízení (max-width: 900px)
   ========================================================================== */
@media (max-width: 900px) {
  .app-header {
    height: 52px;
    padding: 0 0.65rem;
  }

  .brand {
    gap: 0.45rem;
  }

  .brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
  }

  .brand-icon svg {
    width: 16px;
    height: 16px;
  }

  .brand-text h1 {
    font-size: 0.875rem;
    white-space: nowrap;
  }

  .brand-sub {
    display: none;
  }

  .header-actions {
    gap: 0.3rem;
  }

  .header-actions .btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.71875rem;
  }

  .btn-mobile-list {
    display: inline-flex;
    background: #f1f5f9;
  }

  /* Boční panel se mění na moderní Bottom Sheet (ve výchozím stavu na mobilu zavřený) */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    max-height: 80vh;
    height: auto;
    border-radius: 20px 20px 0 0;
    border-right: none;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
    z-index: 40;
    transform: translateY(105%);
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar.open {
    transform: translateY(0);
    pointer-events: auto;
  }

  .sidebar-mobile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem 0.25rem;
    background: #fafafa;
    border-bottom: 1px solid var(--border-color);
    border-radius: 20px 20px 0 0;
  }

  .drawer-handle {
    width: 36px;
    height: 4px;
    border-radius: 9999px;
    background: #cbd5e1;
    margin-bottom: 0.35rem;
  }

  .drawer-title-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .drawer-title-row h3 {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-main);
  }

  .btn-close-drawer {
    background: #f1f5f9;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
  }

  .sidebar-controls {
    padding: 0.75rem 1rem 0.5rem;
  }

  .events-list {
    padding: 0.75rem 1rem;
  }

  .sidebar-mobile-header {
    position: sticky;
    top: 0;
    z-index: 7;
  }

  /* hledání se přilepí pod mobilní záhlaví panelu */
  .sidebar-search {
    top: var(--drawer-header-h, 50px);
    padding: 0.6rem 1rem;
  }

  .mobile-sidebar-toggle {
    display: inline-flex;
  }

  /* Na mobilních zařízeních se popup ukotví do čisté spodní karty (Mobile Bottom Card) */
  .maplibregl-popup {
    position: fixed !important;
    top: auto !important;
    bottom: 10px !important;
    left: 10px !important;
    right: 10px !important;
    transform: none !important;
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    z-index: 100 !important;
  }

  .maplibregl-popup-tip {
    display: none !important;
  }

  .maplibregl-popup-content {
    border-radius: 16px !important;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.35) !important;
    max-height: 62vh !important;
  }

  /* Mobil: hlavička, ročníky, popis i přílohy se posouvají společně */
  .event-popup {
    max-height: 62vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .popup-body {
    max-height: none !important;
    overflow: visible;
    padding: 0.75rem 1rem 1rem;
  }

  .popup-header {
    padding: 0.85rem 1rem 0.65rem;
  }

  .popup-title {
    font-size: 0.9375rem;
  }
}

@media (max-width: 480px) {
  .header-actions #layerSelect {
    max-width: 85px;
    font-size: 0.7rem;
    padding: 0.35rem 0.35rem;
  }

  .header-actions #btnResetBounds span {
    display: none;
  }

  .header-actions #btnResetBounds {
    padding: 0.4rem 0.45rem;
  }
}


/* Desktop: popup se vejde do mapy (výšku nastavuje app.js přes --popup-max-h), celý obsah se posouvá jako jeden celek */
@media (min-width: 901px) {
  .event-map-popup .event-popup {
    max-height: var(--popup-max-h, 70vh);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .event-map-popup .popup-body {
    max-height: none;
    overflow: visible;
  }
}

/* ===== Prohlížeč obrázků (lightbox) ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.92);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  padding-top: max(0.6rem, env(safe-area-inset-top));
  color: #fff;
}

.lightbox-title {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-download {
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.45rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-sm);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.lightbox-close {
  appearance: none;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  width: 44px;
  height: 44px;
  cursor: pointer;
  border-radius: 50%;
}

.lightbox-close:hover, .lightbox-close:focus-visible {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  overflow: auto;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  touch-action: pinch-zoom;
  border-radius: 4px;
  background: #fff;
}

body.lightbox-open {
  overflow: hidden;
}
