/* Farby su prevzate z appky (MapScreen): pozadie #121214, karty #1C1C1E,
   ruzova #F06292 pre partnera, modra #64B5F6 pre vlastnu polohu. */
:root {
  --bg: #121214;
  --card: #1c1c1e;
  --card-2: #232326;
  --pink: #f06292;
  --blue: #64b5f6;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.82);
  --muted-strong: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

/* Styri stavy podkladu. Filtre bezia v prehliadaci nad tymi istymi
   dlazdicami z OSM — ziadny dalsi poskytovatel map, ziadne spojenie navyse.

   Pri zapnutej trase ide mapa do sivej zamerne: OSM kresli dialnice ruzovou
   a vodu modrou, takze farebna trasa splynula s podkladom bez ohladu na to,
   ako bola hruba. Na sivom podklade je trasa jedina farba na obrazovke. */
.leaflet-tile-pane {
  filter: brightness(0.92) saturate(0.95);
  transition: filter 0.25s ease;
}
body.history-on .leaflet-tile-pane {
  filter: grayscale(1) brightness(0.6) contrast(1.1);
}
body.dark-map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.85) saturate(0.5);
}
body.dark-map.history-on .leaflet-tile-pane {
  filter: grayscale(1) invert(1) brightness(0.92) contrast(0.78);
}

.leaflet-container { background: var(--bg); }
.leaflet-control-attribution {
  background: rgba(18, 18, 20, 0.75) !important;
  color: var(--muted) !important;
}
.leaflet-control-attribution a { color: var(--muted-strong) !important; }

/* --- prihlasenie --- */
.gate {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.gate[hidden] { display: none; }

.gate-box {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border-radius: 20px;
  padding: 28px 24px 24px;
}
.gate-box h1 {
  margin: 0 0 22px;
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  color: var(--pink);
}
.gate-step[hidden] { display: none; }

/* --- QR prihlasenie --- */
.qr-wrap {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: #ffffff;
  border-radius: 14px;
}
.qr-image {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
}
.qr-hint {
  margin: 16px 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted-strong);
  text-align: center;
}
.link-button {
  display: block;
  margin: 16px auto 0;
  padding: 6px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.error {
  margin: 12px 0 0;
  color: var(--pink);
  font-size: 13px;
  text-align: center;
}
.error[hidden] { display: none; }

/* --- panel s kartami --- */
.panel {
  position: absolute;
  z-index: 900;
  left: 12px;
  bottom: 12px;
  width: 430px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: 14px 16px 12px;
  background: rgba(20, 20, 22, 0.96);
  backdrop-filter: blur(12px);
  border-radius: 18px;
}
.panel[hidden] { display: none; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.distance { font-size: 15.5px; font-weight: 500; color: var(--muted-strong); }
.icon-button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
}

.cards { display: flex; flex-direction: column; gap: 10px; }

.person {
  display: flex;
  gap: 13px;
  padding: 13px 14px;
  background: var(--card-2);
  border-radius: 14px;
  border-left: 4px solid transparent;
}
.person.is-me { border-left-color: var(--blue); }
.person.is-partner { border-left-color: var(--pink); }
.person.stale { opacity: 0.6; }

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 600;
}
.person.is-me .avatar { color: var(--blue); }
.person.is-partner .avatar { color: var(--pink); }

.person-body { min-width: 0; flex: 1; }
.person-name {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.badge {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 1px 6px;
}
.person-line {
  font-size: 15.5px;
  color: var(--muted-strong);
  margin-top: 6px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-line.dim { color: var(--muted); }
.person-line.stack { white-space: normal; }

.panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.action {
  flex: 1;
  min-width: 92px;
  padding: 11px 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: rgba(255, 255, 255, 0.14);
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.action:hover { background: rgba(255, 255, 255, 0.14); }
.action.on { background: var(--pink); }
.action.ghost { color: var(--muted); background: none; flex: none; min-width: 0; }

.status {
  margin: 10px 2px 0;
  font-size: 13.5px;
  color: var(--muted);
  min-height: 14px;
}
.status.bad { color: var(--pink); }

.expand {
  position: absolute;
  z-index: 900;
  left: 12px;
  bottom: 12px;
  padding: 10px 16px;
  font-size: 15px;
  color: var(--text);
  background: rgba(28, 28, 30, 0.95);
  border: none;
  border-radius: 14px;
  cursor: pointer;
}
.expand[hidden] { display: none; }

/* --- markery --- */
.pin {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.pin.me { background-color: var(--blue); }
.pin.partner { background-color: var(--pink); }

@media (max-width: 520px) {
  .panel { width: auto; right: 12px; }
}

/* --- tlacidlo trasy na karte --- */
/* Farba tlacidla je farba trasy (`--track`), aby bolo bez legendy jasne,
   ktora ciara na mape patri komu. */
.card-action {
  margin-top: 10px;
  padding: 7px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--track);
  background: none;
  border: 1.5px solid var(--track);
  border-radius: 9px;
  cursor: pointer;
  opacity: 0.75;
}
.card-action:hover { opacity: 1; }
.card-action.watch {
  margin-right: 6px;
  color: #fff;
  background: #ec4899;
  border-color: #ec4899;
  opacity: 1;
}
.card-action.on {
  color: #000;
  background: var(--track);
  border-color: var(--track);
  opacity: 1;
}

/* --- legenda trasy --- */
.legend {
  display: none;
  align-items: center;
  gap: 14px;
  margin: 12px 2px 0;
  font-size: 13.5px;
  color: var(--muted-strong);
}
body.history-on .legend { display: flex; }
.legend span { display: flex; align-items: center; gap: 8px; }
.legend i {
  width: 24px;
  height: 6px;
  border-radius: 3px;
  display: inline-block;
  flex: none;
}
.legend-note { color: var(--muted); font-size: 12.5px; }
