/* =========================================================
   ODJEZDNÍK – HLAVNÍ STYLESHEET
   Struktura:
   1) Základní layout / typografie
   2) Utility (barvy textu, .hidden)
   3) Chybová hláška
   4) Tabulky (obecné)
   5) Odjezdová řádka (dep-row, line-chip, vozidla, nástupiště)
   6) Hlavička stránky (název zastávky + lupa + čas)
   7) Filtry (mode filter, platformy, nadpisy filtrů)
   8) Hodiny vpravo v řádku (real/sched/delay)
   9) Overlay pro výběr zastávky
   10) Overlay nápovědy
   11) Mapa nástupišť (overlay + Leaflet popup)
   12) Footer
   13) Animace
   14) Responsivita
   15) Hard overrides (pojistky proti staré keši)
   ========================================================= */


/* =========================================================
   1) ZÁKLADNÍ LAYOUT / TYPOGRAFIE
   ========================================================= */

body {
  background-color: #1e2329;
  color: #f1f1f1;
  font-family: "Segoe UI", sans-serif;
  margin: 0;
  padding: 20px;
}

h1, h2, h3, h4 {
  color: #fff;
  margin: 0 0 10px 0;
}

/* Hlavní obsahový kontejner */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}


/* =========================================================
   2) UTILITY TŘÍDY
   ========================================================= */

/* Skrytí libovolného elementu */
.hidden {
  display: none;
}

/* Jednoduché textové barvy ve "tailwind" stylu */
.text-gray-300 { color: #c7c7c7; }
.text-gray-500 { color: #6b7280; }
.text-yellow-400 { color: #facc15; }
.text-red-500 { color: #ef4444; }


/* =========================================================
   3) CHYBOVÁ HLÁŠKA
   ========================================================= */

#error-message {
  text-align: center;
  color: #ccc;
  background: #2a2a2a;
  padding: 20px;
  border-radius: 10px;
  margin-top: 20px;
  font-size: 1rem;
}


/* =========================================================
   4) TABULKY – OBECNÝ STYL
   (Použitelné i mimo hlavní odjezdovou tabulku)
   ========================================================= */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}

th {
  text-align: left;
  background-color: #2a2f36;
  color: #d0d0d0;
  font-weight: 600;
  padding: 10px 12px;
}

td {
  background-color: #252a31;
  padding: 10px 12px;
  border-top: 1px solid #2f343c;
  border-bottom: 1px solid #2f343c;
  color: #e6e6e6;
  vertical-align: middle;
  transition: background-color 0.3s ease;
}

tr:hover td {
  background-color: #2f353e;
}


/* =========================================================
   5) ODJEZDOVÁ ŘÁDKA (dep-row) + LINKY + VOZIDLA + NÁSTUPIŠTĚ
   ========================================================= */

/* Kontejner pro seznam odjezdů */
#departures {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 1rem;
  transition: opacity 0.4s ease-in-out;
}

/* Jedna odjezdová řádka */
.dep-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #252528;
  border-radius: 10px;
  padding: 10px 14px;
  border: 1px solid #303034;
  transition: background 0.15s;
}

.dep-row:hover {
  background: #2d2d31;
}

.dep-row[role="button"] {
  cursor: pointer;
}

.dep-row[role="button"]:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

/* Efekt při novém vykreslení */
.dep-row.fade-in {
  animation: fadeInRow 0.4s ease-in-out;
}

/* Vizuální "odjetý" stav */
.dep-row.departed {
  opacity: 0.45;
  filter: grayscale(0.8);
  transition: opacity 0.3s;
}

/* Sub-layout řádky */
.dep-row .left {
  flex-shrink: 0;
  margin-right: 1rem;
}

.dep-row .main {
  flex: 1;
  min-width: 0;
}

.dep-row .right {
  display: flex;
  align-items: center;
  gap: .8rem;
  flex-shrink: 0;
}

/* Cílová / hlavička linky v řádku */
.dep-row .headsign {
  font-size: 1rem;
  font-weight: 600;
  color: #f1f1f1;
}

/* Druhý řádek pod názvem (poslední zastávka, poznámka…) */
.dep-row .subinfo {
  font-size: 0.8rem;
  color: #a1a1aa;
  margin-top: 2px;
  min-height: 1em;
}

/* Chip s číslem vozidla */
.dep-row .vehicle-chip {
  background: #3a3a3f;
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 0.9rem;
  color: #fff;
  font-weight: 600;
}

/* Historické hooky – necháno kvůli případným JS selektorům */
.dep-row .sched {}
.dep-row .delay {}

/* Číslo/linka – základní vzhled, barva se řeší v JS pomocí inline stylu */
.line-chip {
  display: inline-block;
  border-radius: 999px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  background-color: #3b82f6; /* fallback */
}

/* Line chip v hlavní tabuli odjezdů */
.dep-row .line-chip {
  font-size: 0.95em;
  padding: 4px 10px;
  min-width: 38px;
}

/* Line chip v popupu nástupiště (menší varianta) */
.platform-popup .line-chip {
  font-size: 0.85em;
  padding: 2px 8px;
  min-width: 30px;
}

/* Zvýraznění náhradní dopravy / X linek */
.line-chip--replacement {
  box-shadow: inset 0 0 0 2px #f59e0b;
}

/* Ikona vozidla vedle čipu linky */
.vehicle-icon {
  width: auto;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  margin-left: 4px;
  margin-top: -6px;
  border-radius: 4px;
}

/* Chip nástupiště přímo v řádku/tabulce */
.platform-label {
  display: inline-block;
  background: #3b3b40;
  color: #eee;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 6px;
  line-height: 1.2;
  vertical-align: middle;
}

/* Nástupiště u odjetých spojů lehce zeslabíme */
.dep-row.departed .platform-label {
  opacity: 0.6;
}


/* =========================================================
   6) HLAVIČKA: NÁZEV ZASTÁVKY + LUPA + ČAS
   ========================================================= */

/* Wrapper pro název zastávky a ovládání času */
#stop-title {
  display: flex;
  flex-direction: column;   /* vždy 2 řádky pod sebou */
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.5em;
}

/* 1. řádek – název zastávky */
.stop-title-main {
  font-size: 1.2em;
  line-height: 1;
  word-break: break-word;   /* dlouhé názvy se prostě zalomí */
  margin-bottom: 10px;
}

/* 2. řádek – vlevo akce, vpravo čas */
.stop-title-row2 {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

/* Vlevo: lupa + nápověda */
.stop-title-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Základní ikonové tlačítko (bez konkrétního vzhledu) */
.btn-icon {
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Lupa (změna zastávky) */
/* Kompaktní ikonové "div-tlačítko" */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 32px;
  height: 32px;

  background: #2a2f36;
  border-radius: 8px;

  cursor: pointer;
  user-select: none;

  transition: background 0.2s ease, opacity 0.2s ease;
}

.btn-icon:hover {
  background: #3a3f46;
  opacity: 1;
}

/* Ikona */
.btn-icon img {
  width: 22px;
  height: 22px;
  opacity: 0.8;
  pointer-events: none; /* aby klik byl vždy na div */
  filter: invert(1);
}
.change-stop-btn img {
  width: 18px;
  height: 18px;
}

.btn-icon:hover img {
  opacity: 1;
}

/* Lupa – lehce vyšší základní viditelnost */
.change-stop-btn, .help-btn {
  opacity: 0.8;
}

.change-stop-btn:hover,
.help-btn:hover {
  opacity: 1;
}

/* Čas + +/- tlačítka v hlavičce */
#clock-container {
  margin-left: auto;      /* klíčové pro zarovnání doprava */
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Zobrazený čas */
#clock {
  font-family: monospace;
  font-size: 1.2rem;
  cursor: pointer;
  color: #eee;
  width: 6rem;
  text-align: center;
}

#clock.clock-manual {
  color: #facc15;
}

/* === Časová tlačítka: stejné jako btn-icon === */
#time-minus,
#time-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 32px;
  height: 32px;

  background: #2a2f36;
  border-radius: 8px;

  border: none;
  cursor: pointer;
  user-select: none;

  color: white;               /* barva symbolu */
  font-size: 20px;            /* pěkný, kompaktní symbol */
  font-weight: 100;
  line-height: 1;
  padding: 0;

  transition: background 0.2s ease, opacity 0.2s ease;
}

#time-minus:hover,
#time-plus:hover {
  background: #3a3f46;
  opacity: 1;
}


/* =========================================================
   7) FILTRY – MÓDY DOPRAVY, NÁSTUPIŠTĚ, HLAVIČKY FILTRŮ
   ========================================================= */

/* Obecný kontejner pro filtry (použitelné i mimo módy) */
.filter-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
  margin-bottom: 0.6rem;
}

/* Kontejner čistě pro módy dopravy (metro/tram/bus…) */
#mode-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
  margin-bottom: 0.8rem;
}

/* Základní stav "chipu" pro druh dopravy */
.mode-chip {
  --mode-color: #ffffff; /* fallback, reálná barva jde z JS */
  /* druhá barva pro metro – nepovinná, když není, použije se první */
  --mode-color2: var(--mode-color);

  position: relative;
  overflow: hidden;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 4px 6px;
  border-radius: 10px;
  cursor: pointer;

  background: #252a31; /* neutrální pozadí */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);

  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
}

.mode-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}

/* Spodní barevná linka – u všech módů */
.mode-chip::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--mode-color);
  opacity: 0.95;
}

/* U metra je spodní linka gradient (A/B nebo B/C atd.) */
.mode-chip[data-mode="metro"]::after {
  background: linear-gradient(
    to right,
    var(--mode-color) 0%,
    var(--mode-color) 40%,
    var(--mode-color2) 60%,
    var(--mode-color2) 100%
  );
}

/* Ikona uvnitř chipu – maskovaná SVG, default světle šedá */
.mode-icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  background-color: #e5e7eb; /* světle šedá ikona v neaktivním stavu */
  -webkit-mask-image: var(--mode-icon-url);
  mask-image: var(--mode-icon-url);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  opacity: 0.9;
}

/* Na hover se ikonka vybarví barvou módu */
.mode-chip:hover .mode-icon {
  background-color: var(--mode-color);
}

/* U metra na hover použijeme gradient i uvnitř ikony */
.mode-chip[data-mode="metro"]:hover .mode-icon {
  background: linear-gradient(
    to right,
    var(--mode-color) 0%,
    var(--mode-color) 40%,
    var(--mode-color2) 60%,
    var(--mode-color2) 100%
  );
}

/* Aktivní stav chipu – celý barevný, ikona bílá */
.mode-chip.active {
  background-color: var(--mode-color);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
  filter: brightness(0.9); /* jemné ztmavení */
}

/* Aktivní metro – gradient i v pozadí */
.mode-chip.active[data-mode="metro"] {
  background: linear-gradient(
    to right,
    var(--mode-color) 0%,
    var(--mode-color) 40%,
    var(--mode-color2) 60%,
    var(--mode-color2) 100%
  );
  filter: brightness(0.9);
}

.mode-chip.active .mode-icon {
  background-color: #ffffff;
  opacity: 1;
}

/* "Mapa" jako speciální mód – šedý chip ve stejné logice */
.mode-chip.mode-chip--map {
  --mode-color: #9ca3af; /* šedá, ne barva konkrétního módu */
}

/* Ikonka mapy v chipu "mode-chip--map" */
.mode-chip.mode-chip--map .map-icon {
  width: 20px;
  height: 20px;
  display: block;
  filter: invert(0.9); /* světle šedá / skoro bílá */
  opacity: 0.9;
}

/* Hlavička nad blokem filtrů (např. "Nástupiště") */
.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.8;
}

/* Kontejner pro chips s nástupišti (flex řádek) */
.platform-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ID varianta – kdy chceš mít kontejner přímo cílený (#platform-filter) */
#platform-filter {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* Původní platform-filter (např. nad tabulkou) */
.platform-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
  margin-bottom: 0.8rem;
}

/* Jeden chip nástupiště ve filtru */
.platform-chip {
  background: #2a2a2d;
  color: #ccc;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.platform-chip:hover {
  background: #4f4f4f;
}

.platform-chip.active {
  background: #6366f1;
  color: #fff;
}

/* Štítek nástupiště někde nadepsaný (např. v mapě) */
.platform-tag {
  padding: 4px 8px;
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
  display: inline-block;
  margin-right: 4px;
}


/* =========================================================
   8) PRAVÝ SLOUPEC V ŘÁDCE: REAL TIME / SCHED / DELAY
   ========================================================= */

/* Reálný čas odjezdu – hlavní číslo vpravo v řádku */
.real {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1;
  color: #e5e7eb;                 /* skoro bílá */
  padding-bottom: 1px;
  border-bottom: 2px solid transparent; /* případný barevný underline */
}

/* Vertikální stack pro real / sched / delay */
.time-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  line-height: 1.1;
  gap: 0;
  min-width: 4.6em; /* stabilní šířka pro zarovnání vpravo */
}

/* JŘ čas */
.time-stack .sched {
  font-size: 0.88rem;
  color: #9ca3af;
  font-weight: 600;
  line-height: 1;
}

/* Text zpoždění (monospace ±mm:ss) */
.time-stack .delay {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    "Liberation Mono",
    "Courier New",
    monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.05px;
  line-height: 1;
  margin-top: 0.05rem;
}

/* Rozsahy a barvy zpoždění (podle CSS třídy) */
.delay--ontime { color: #8995a5; } /* -59 … +59 s – šedá */
.delay--early  { color: #16a34a; } /* předjetí 60+ s – zelená */
.delay--minor  { color: #eab308; } /* +60 … +119 s – žlutá */
.delay--major  { color: #f97316; } /* +120 … +359 s – oranžová */
.delay--huge   { color: #ef4444; } /* +360+ s – červená */

/* Případný barevný underline pro .real se dá zprovoznit odkomentováním:*/
.real.delay--ontime {color: white; /*border-bottom-color: #8995a5;*/}
.real.delay--early  {color: white; /*border-bottom-color: #16a34a;*/}
.real.delay--minor  {color: white; /*border-bottom-color: #eab308;*/}
.real.delay--major  {color: white; /*border-bottom-color: #f97316;*/}
.real.delay--huge   {color: white; /*border-bottom-color: #ef4444;*/}
*/


/* =========================================================
   9) OVERLAY PRO VÝBĚR ZASTÁVKY
   ========================================================= */

/* Základní overlay (černé pozadí přes celou obrazovku) */
.overlay,
#stop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
}

/* Skrytí overlaye */
.overlay.hidden,
#stop-overlay.hidden {
  display: none;
}

/* Vnitřní box s obsahem overlaye */
.overlay-box {
  background: #222;
  color: #fff;
  padding: 24px 28px;
  border-radius: 12px;
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

.overlay-box h3,
.overlay-box h4 {
  margin-top: 0;
}

/* Input pro vyhledání zastávky */
#overlay-input {
  width: calc(100% - 4px);
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #333;
  background: #2c2c2c;
  color: #eee;
  border-radius: 6px;
  margin-bottom: 12px;
  font-family: "Segoe UI", sans-serif;
}

/* Seznam našeptávače */
#overlay-suggestions {
  list-style: none;
  margin: 0 0 10px 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  border-radius: 6px;
  background: #1f1f1f;
}

#overlay-suggestions li {
  padding: 6px 8px;
  cursor: pointer;
}

#overlay-suggestions li:hover {
  background: #333;
}

/* Aktivní (vybraný) řádek našeptávače */
#overlay-suggestions li.active {
  background: #333;
  color: #fff;
}

/* Scrollbar uvnitř overlaye (Webkit) */
#overlay-suggestions::-webkit-scrollbar {
  width: 6px;
}

#overlay-suggestions::-webkit-scrollbar-thumb {
  background: #666;
  border-radius: 3px;
}

#overlay-suggestions::-webkit-scrollbar-track {
  background: #222;
}

/* Naposledy navštívené zastávky */
.recent-stops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.recent-stops div {
  background: #333;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

.recent-stops div:hover {
  background: #555;
}

/* Zavírací tlačítko overlaye */
#overlay-close {
  width: 100%;
  background: #444;
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

#overlay-close:hover {
  background: #666;
}


/* =========================================================
   10) OVERLAY NÁPOVĚDY
   ========================================================= */

/* Celoplošný overlay pro nápovědu */
.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}
.help-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 32px;
  height: 32px;
  border-radius: 10px;

  transform: scale(0.8);
  transform-origin: left center;

  margin-right: 6px;
}

.help-chip img {
  width: 22px;
  height: 22px;
  filter: invert(1);
  pointer-events: none;
}


/* Schování nápovědy */
.help-overlay.hidden {
  display: none;
}

/* Panel s textem nápovědy */
.help-panel {
  background: #1f242b;
  border-radius: 12px;
  padding: 18px 20px;
  max-width: 380px;
  width: calc(100% - 40px);
  color: #f1f1f1;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  font-size: 0.9rem;
}

/* Header panelu – titulek + křížek */
.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.help-title {
  font-size: 1.1rem;
  font-weight: 600;
}

/* "X" pro zavření nápovědy */
.help-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #2a2f36;
  cursor: pointer;
  user-select: none;
  opacity: 0.8;
  transition: background 0.2s ease, opacity 0.2s ease, transform 0.1s ease;
}

.help-close:hover {
  background: #3a3f46;
  opacity: 1;
  transform: translateY(-1px);
}

/* Obsah nápovědy – seznamy */
.help-body ul {
  margin: 0;
  padding-left: 18px;
}

.help-body ul ul {
  margin-top: 4px;
}


/* =========================================================
   11) MAPA NÁSTUPIŠŤ (OVERLAY + LEAFLET POPUP)
   ========================================================= */

/* Celý overlay mapy nástupišť */
#platform-map-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

/* Zatmavené pozadí za dialogem s mapou */
.platform-map-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

/* Dialog (box) s mapou a titulkem */
.platform-map-dialog {
  position: absolute;
  inset: 10% 5%;
  background: #111;
  color: #fff;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  max-width: 720px;
  margin: 0 auto;
}

/* Header dialogu – titulek + zavírací tlačítko */
.platform-map-header {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 500;
}

.platform-map-close {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.1rem;
}

/* Tělo dialogu (mapa + popisky) */
.platform-map-body {
  padding: 10px 12px 12px;
  flex: 1;
}

/* Wrapper pro samotnou mapu */
.platform-map {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 260px;
  border-radius: 8px;
  overflow: hidden;
}

/* "Piny" nástupišť v pseudo-maps režimu */
.platform-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: #2a2a2a;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

/* Bublina s detailem nástupiště (nad dotem) */
.platform-bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  background: #181818;
  border-radius: 8px;
  padding: 8px 10px;
  max-width: 240px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
  font-size: 12px;
  z-index: 10;
}

.platform-bubble-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.platform-bubble-desc {
  margin-bottom: 6px;
}

/* Tlačítko "použít toto nástupiště" v bublině */
.platform-bubble-apply {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: #2b2b2b;
  color: #fff;
  cursor: pointer;
}

/* Pozadí leaflet mapy (dark theme fallback) */
.leaflet-container {
  background: #111;
}

/* "Štítky" nástupišť přímo na Leaflet mapě */
.platform-marker span {
  display: inline-block;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

/* Leaflet popup – wrapper (tmavé pozadí) */
.platform-leaflet-popup .leaflet-popup-content-wrapper {
  background: #181818;
  color: #fff;
  border-radius: 8px;
}

/* Titulek popupu */
.platform-popup-title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 12px;
}

/* Popisek popupu */
.platform-popup-desc {
  margin-bottom: 6px;
  font-size: 11px;
}

/* Tlačítko uvnitř popupu ("použít") */
.platform-popup-apply {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: #2b2b2b;
  color: #fff;
  cursor: pointer;
}

/* Jedna řádka v popupu – line chip + šipka + cílovka */
.popup-line-row {
  font-size: 11px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.popup-line-row .line-chip {
  display: inline-block;
}

/* Text, když na nástupišti nic nejezdí */
.popup-line-row-empty {
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: 4px;
}

/* Šipka mezi linkou a cílovou */
.popup-line-arrow {
  opacity: 0.9;
}

/* Cílová zastávka v popupu */
.popup-line-dest {
  opacity: 0.95;
}

/* Leaflet ovladače nad obsahem overlaye */
#platform-map-overlay .leaflet-top,
#platform-map-overlay .leaflet-bottom {
  z-index: 6000;
}

/* Čitelnost přepínače vrstev v dark UI */
#platform-map-overlay .leaflet-control-layers {
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
}

#platform-map-overlay .leaflet-control-layers label {
  color: #fff;
}

/* =========================================================
   12) FOOTER
   ========================================================= */

footer {
  text-align: center;
  margin-top: 40px;
  padding-bottom: 20px;
  font-size: 0.9rem;
  color: #999;
}

footer a {
  color: #aaa;
  text-decoration: none;
  margin-right: 10px;
}

footer a:hover {
  color: #ccc;
  text-decoration: underline;
}

footer .version {
  color: #666;
  font-style: italic;
  font-size: small;
}


/* =========================================================
   13) ANIMACE
   ========================================================= */

@keyframes fadeInRow {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* =========================================================
   14) RESPONSIVITA
   ========================================================= */

@media (max-width: 640px) {
  /* Pravý časový sloupec trochu zmenšíme */
  .real {
    font-size: 1.0rem;
  }

  .time-stack .sched {
    font-size: .82rem;
  }

  .time-stack .delay {
    font-size: .74rem;
  }

  /* Odjezdová řádka pod sebou místo do řádku */
  .dep-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .dep-row .right {
    margin-top: 4px;
    align-self: flex-end;
  }

  /* Stop-title-actions / clock-container necháme jako na desktopu */
  .stop-title-actions {
    justify-content: flex-start;
    width: auto;
  }

  #clock-container {
    margin-left: auto;      /* klíčové pro zarovnání doprava */
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
  }

  .departure-detail-panel {
    width: calc(100% - 12px);
    max-height: calc(100vh - 12px);
    border-radius: 12px;
  }

  .departure-detail-body {
    padding: 12px 12px 20px;
    max-height: calc(100vh - 12px);
  }

  .departure-detail-error,
  .departure-detail-stop-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .departure-detail-stop-platform,
  .departure-detail-stop-time-cell {
    width: 100%;
    text-align: left;
  }
}


/* =========================================================
   15) HARD OVERRIDES – POJISTKY PROTI STARÉ KEŠI
   (Pokud by se v budoucnu smazaly, chování by mělo být stejné
    jako v sekci 8; tady jen jistota pomocí !important.)
   ========================================================= */

.time-stack {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  line-height: 1.1 !important;
  gap: 0 !important;
  min-width: 4.6em !important;
}

.time-stack span {
  display: block !important;
}

#stop-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;

  display: flex !important;
  align-items: center;
  justify-content: center;

  z-index: 9998 !important;
  background: rgba(0, 0, 0, 0.7) !important;
  backdrop-filter: blur(3px) !important;
}

#stop-overlay.hidden {
  display: none !important;
}

body.departure-detail-open {
  overflow: hidden;
}

.departure-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 10010;
  display: flex;
  align-items: center;
  justify-content: center;
}

.departure-detail-overlay.hidden {
  display: none;
}

.departure-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}

.departure-detail-panel {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid #30343b;
  background: #1f242b;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.departure-detail-body {
  padding: 14px 14px 22px;
  overflow-y: auto;
  max-height: calc(100vh - 24px);
  scrollbar-width: thin;
  scrollbar-color: rgba(156, 163, 175, 0.28) transparent;
}

.departure-detail-body::-webkit-scrollbar {
  width: 8px;
}

.departure-detail-body::-webkit-scrollbar-track {
  background: transparent;
}

.departure-detail-body::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.22);
  border-radius: 999px;
}

.departure-detail-body::-webkit-scrollbar-thumb:hover {
  background: rgba(156, 163, 175, 0.32);
}

.departure-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.departure-detail-header.compact {
  margin-bottom: 0.35rem;
}

.departure-detail-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.08rem;
  font-weight: 700;
  flex-wrap: wrap;
}

.departure-detail-headsign {
  font-size: 0.98rem;
}

.departure-detail-subtitle {
  margin-top: 0.1rem;
  color: #9ca3af;
  font-size: 0.82rem;
}

.departure-detail-close {
  border: none;
  background: #2a2f36;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}

.departure-detail-close:hover {
  background: #3a3f46;
}

.departure-detail-section {
  margin-top: 1rem;
}

.departure-detail-section.compact {
  margin-top: 0;
}

.departure-detail-section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
}

.departure-detail-loading,
.departure-detail-message,
.departure-detail-error {
  background: #252a31;
  border: 1px solid #313742;
  border-radius: 10px;
  padding: 14px;
  color: #d1d5db;
}

.departure-detail-note {
  margin-bottom: 0.7rem;
  color: #9ca3af;
  font-size: 0.88rem;
}

.departure-detail-vehicle {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #30353d;
  color: #cbd5e1;
  font-size: 0.76rem;
  font-weight: 600;
}

.departure-detail-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.departure-detail-retry {
  border: none;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.departure-detail-retry:hover {
  background: #1d4ed8;
}

.departure-detail-stops {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.departure-detail-stops.compact {
  gap: 0.12rem;
  padding-bottom: 26px;
}

.departure-detail-stop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 5px 8px;
  min-height: 28px;
}

.departure-detail-stop-row.is-current {
  background: rgba(250, 204, 21, 0.08);
}

.departure-detail-stop-row.is-past {
  opacity: 0.45;
}

.departure-detail-stop-row.is-future {
  background: rgba(255, 255, 255, 0.02);
}

.departure-detail-stop-main {
  min-width: 0;
  flex: 1;
}

.departure-detail-stop-name {
  font-weight: 600;
  color: #f3f4f6;
  line-height: 1.2;
  font-size: 0.94rem;
}

.departure-detail-stop-time-cell {
  min-width: 5.9rem;
  flex-shrink: 0;
  color: #d1d5db;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.1;
}

.departure-detail-stop-predicted {
  color: #9ca3af;
  font-size: 0.78rem;
  margin-right: 0.25rem;
}

.departure-detail-stop-scheduled {
  color: #f3f4f6;
}

.departure-detail-stop-platform {
  flex-shrink: 0;
  min-width: 2rem;
  text-align: right;
}

.departure-detail-platform-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #30353d;
  color: #9ca3af;
  font-size: 0.68rem;
  font-weight: 600;
}
