/* ── map.css – delt stylesheet for map.html og elevation.html ── */

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #0d1117; color: #e6edf3; font-family: Inter, "Segoe UI", sans-serif; display: flex; flex-direction: column; height: 100vh; }

.topbar {
  height: 50px; background: #161b22; border-bottom: 1px solid #30363d;
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px; flex-shrink: 0;
}
.topbar-brand { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn { height: 32px; padding: 0 12px; border: 1px solid #30363d; border-radius: 8px; background: #21262d; color: #e6edf3; font-size: 12px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; }
.btn:hover { background: #30363d; }
.btn.active { background: #1f6feb; border-color: transparent; }

#map-wrap { flex: 1; display: flex; min-height: 0; }
#map { flex: 1; }

/* ── Route info panel ──────────────────────────────────────── */
#route-panel {
  width: 268px; flex-shrink: 0;
  background: #161b22; border-right: 1px solid #30363d;
  display: none; flex-direction: column; overflow: hidden;
}
#route-panel.visible { display: flex; }

.rp-header { padding: 12px 14px 10px; border-bottom: 1px solid #30363d; flex-shrink: 0; }
.rp-title { font-weight: 800; font-size: 14px; }
.rp-sub   { font-size: 11px; color: #8b949e; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-list  { flex: 1; overflow-y: auto; padding: 6px 0; }

.rp-hop { display: flex; align-items: flex-start; gap: 10px; padding: 6px 14px; cursor: default; }
.rp-hop:hover { background: #1c2128; }

.rp-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; }
.rp-info { min-width: 0; }
.rp-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-name.dim { color: #8b949e; font-style: italic; font-weight: 400; }
.rp-label { font-size: 11px; color: #8b949e; margin-top: 1px; }
.rp-cands { font-size: 10px; color: #a78bfa; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-connector { width: 2px; height: 10px; background: #30363d; margin-left: 27px; flex-shrink: 0; }

.rp-legend { flex-shrink: 0; padding: 10px 14px; border-top: 1px solid #30363d; font-size: 11px; }
.rp-legend-title { font-weight: 700; color: #e6edf3; margin-bottom: 5px; }
.rp-legend-row { display: flex; align-items: center; gap: 7px; margin-top: 3px; color: #8b949e; }
.rp-line-sample { width: 26px; height: 3px; flex-shrink: 0; border-radius: 2px; }

/* ── Legend panel ──────────────────────────────────────────── */
.legend {
  position: fixed; bottom: 20px; left: 16px; z-index: 1000;
  background: #161b22cc; backdrop-filter: blur(6px);
  border: 1px solid #30363d; border-radius: 12px;
  padding: 12px 16px; font-size: 12px; line-height: 2;
  transition: left 0.2s; cursor: default; min-width: 170px;
}
.legend.shift { left: 284px; }
.legend-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; }
.legend-title { font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.legend-collapse-btn { font-size: 11px; color: #8b949e; padding: 0 2px; }
.legend-body { margin-top: 6px; }
.legend-body.hidden { display: none; }
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.legend-section-title { font-size: 10px; font-weight: 700; color: #8b949e; text-transform: uppercase; letter-spacing: .05em; margin: 8px 0 4px; }
.legend-section-title:first-child { margin-top: 0; }
.legend-rep-icon { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 7px; }
.legend-line { width: 24px; height: 3px; flex-shrink: 0; border-radius: 2px; }
.legend-line.dashed { background: repeating-linear-gradient(to right, #79c0ff 0, #79c0ff 4px, transparent 4px, transparent 7px); height: 2px; }
.legend-line.orange { background: #f97316; }
.legend-line.solid-blue { background: #388bfd; }

/* ── Stats panel ───────────────────────────────────────────── */
.stats-panel {
  position: fixed; bottom: 20px; right: 16px; z-index: 1000;
  background: #161b22cc; backdrop-filter: blur(6px);
  border: 1px solid #30363d; border-radius: 12px;
  padding: 12px 16px; font-size: 12px; min-width: 160px;
}
.stats-panel b { font-size: 13px; }

/* ── Leaflet popup ─────────────────────────────────────────── */
.leaflet-popup-content-wrapper { background: #161b22 !important; color: #e6edf3 !important; border: 1px solid #30363d !important; border-radius: 12px !important; }
.leaflet-popup-tip { background: #161b22 !important; }
.popup-name { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.popup-type { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; display: inline-block; margin-bottom: 6px; }
.popup-row { font-size: 12px; color: #8b949e; margin: 2px 0; }
.popup-row span { color: #e6edf3; }
.popup-key { font-family: monospace; font-size: 10px; color: #8b949e; margin-top: 6px; }
.type-REP  { background: rgba(242,204,96,.2);  color: #f2cc60; }
.type-CLI  { background: rgba(88,166,255,.2);  color: #79c0ff; }
.type-ROOM { background: rgba(126,231,135,.2); color: #7ee787; }
.type-SENS { background: rgba(255,166,87,.2);  color: #ffa657; }
.type-NONE { background: rgba(139,148,158,.2); color: #8b949e; }
.type-SELF { background: rgba(63,185,80,.3);   color: #3fb950; }
