/* ============================================================
   utrechtriders — Dark theme styles
   ============================================================ */

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: #000;
  color: #e0e0e0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.85);
  border-bottom: 1px solid #222;
  z-index: 10;
  flex-shrink: 0;
}

#title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
}

#title span {
  color: #888;
  font-weight: 400;
  font-size: 14px;
  margin-left: 8px;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- Map container ---- */
#map {
  flex: 1;
  width: 100%;
}

/* ---- Timeline bar ---- */
#timeline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.9);
  border-top: 1px solid #222;
  flex-shrink: 0;
  z-index: 10;
}

#time-display {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  min-width: 52px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

#timeline-slider {
  flex: 1;
  accent-color: #4fc3f7;
  cursor: pointer;
}

#play-pause {
  background: #333;
  border: 1px solid #555;
  color: #fff;
  border-radius: 4px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 14px;
  min-width: 60px;
}
#play-pause:hover { background: #444; }

#speed-label {
  font-size: 12px;
  color: #888;
}

#speed-select {
  background: #222;
  border: 1px solid #444;
  color: #ccc;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 13px;
  cursor: pointer;
}

/* ---- Stats panel ---- */
#stats {
  position: absolute;
  top: 54px;
  right: 12px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 10px 14px;
  min-width: 160px;
  z-index: 5;
  font-size: 13px;
}

#stats h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 8px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}

.stat-label { color: #aaa; }
.stat-value { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- Legend panel ---- */
#legend {
  position: absolute;
  top: 54px;
  left: 12px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 10px 14px;
  max-width: 220px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  z-index: 5;
  font-size: 12px;
  display: none;
}

#legend.visible { display: block; }

#legend h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  cursor: default;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-route-name {
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Icon buttons ---- */
.icon-btn {
  background: rgba(30, 30, 30, 0.85);
  border: 1px solid #444;
  color: #ccc;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: #333; color: #fff; }
.icon-btn.active { border-color: #4fc3f7; color: #4fc3f7; }

/* ---- Modal ---- */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
#modal-overlay.visible { display: flex; }

#modal {
  background: #111;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 24px;
  max-width: 420px;
  width: 90%;
  color: #ddd;
  position: relative;
}

#modal h2 {
  font-size: 18px;
  color: #fff;
  margin-bottom: 16px;
}

#modal p, #modal a {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 10px;
}

#modal a { color: #4fc3f7; text-decoration: none; }
#modal a:hover { text-decoration: underline; }

#modal hr { border: none; border-top: 1px solid #333; margin: 14px 0; }

#modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: #888;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}
#modal-close:hover { color: #fff; }

/* ---- MapLibre popup overrides ---- */
.maplibregl-popup-content {
  background: rgba(15, 15, 15, 0.92) !important;
  color: #e0e0e0 !important;
  border: 1px solid #333 !important;
  border-radius: 6px !important;
  padding: 10px 12px !important;
  font-size: 12px;
  min-width: 160px;
}

.maplibregl-popup-tip { border-top-color: rgba(15, 15, 15, 0.92) !important; }

.popup-title {
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  font-size: 13px;
}

.popup-row {
  display: flex;
  gap: 6px;
  margin-bottom: 2px;
}

.popup-key { color: #888; }
.popup-val { color: #ccc; }

.popup-color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
