/* frontend/styles.css — layout + legibility. Restrained UI so the map/lines lead. */
:root {
  --panel-bg: rgba(255, 255, 255, 0.95);
  --ink: #1e2125;
  --muted: #6b7076;
  --border: #e2e5e9;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
:root[data-theme="dark"] {
  --panel-bg: rgba(24, 27, 31, 0.94);
  --ink: #e6e8eb;
  --muted: #9aa0a6;
  --border: #3a3f45;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); color: var(--ink); }

#map { position: absolute; inset: 0; z-index: 0; background: #eaeaea; }

#panel {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left)); z-index: 1000;
  width: 230px; max-height: calc(100% - 24px); overflow: auto;
  background: var(--panel-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  padding: 12px 14px; font-size: 13px; line-height: 1.35;
  backdrop-filter: blur(3px);
}
#panel h1 { font-size: 15px; margin: 0; letter-spacing: 0.2px; }
#panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#panel-body { margin-top: 8px; }
#panel.collapsed #panel-body { display: none; }
#panel-toggle {
  flex: 0 0 auto; width: 22px; height: 22px; padding: 0; line-height: 1;
  border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 15px;
}
#panel-toggle:hover { color: var(--ink); }

#themebar {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); z-index: 1000;
  background: var(--panel-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  padding: 8px 12px; font-size: 13px; color: var(--ink);
  backdrop-filter: blur(3px);
}

#toggles { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; margin-bottom: 6px; }
.toggle { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }

.legend-group { margin-bottom: 6px; }
.legend-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin: 6px 0 3px; }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.legend-row.muted { color: var(--muted); }
.legend-toggle { cursor: pointer; user-select: none; }
.legend-toggle input { flex: 0 0 auto; margin: 0; }
.swatch { width: 16px; height: 4px; border-radius: 2px; flex: 0 0 auto; }
.swatch-dot { width: 10px; height: 10px; border-radius: 50%; }
.swatch-dash { width: 16px; height: 0; border-top: 3px dashed #475569; border-radius: 0; }
.glyph { width: 16px; text-align: center; flex: 0 0 auto; font-size: 12px; }

#status {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--muted);
}
#status.error { color: #b00020; }

#live { margin-top: 4px; font-size: 11px; }
.live.ok { color: #137333; }
.live.stale { color: #b26a00; }
.live.off { color: #b00020; }

/* Landmark markers */
.landmark-icon { background: none; border: none; }
.landmark-badge {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; font-size: 12px; line-height: 1;
  background: #fff; border: 2px solid #666; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Vehicle markers */
.veh-icon { background: none; border: none; }
.veh-sym { display: block; filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.5)); }
.veh-legend-ico { display: inline-flex; gap: 3px; align-items: center; flex: 0 0 auto; min-width: 34px; }
.veh-legend-sym { display: block; }

/* Enriched tooltips */
.tt { font-size: 12px; line-height: 1.35; }
.tt-title { font-weight: 600; margin-bottom: 2px; }
.tt-row { color: var(--ink); }
.tt-k { display: inline-block; min-width: 52px; color: var(--muted); }

@media (max-width: 520px) {
  #panel { width: 190px; font-size: 12px; }
}

/* --- Dark theme overrides -------------------------------------------------- */
:root[data-theme="dark"] #map { background: #121417; }
:root[data-theme="dark"] .landmark-badge { background: #23272b; }
:root[data-theme="dark"] .leaflet-tooltip {
  background: #23272b; color: var(--ink); border-color: var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
:root[data-theme="dark"] .leaflet-tooltip-top::before { border-top-color: #23272b; }
:root[data-theme="dark"] .leaflet-tooltip-bottom::before { border-bottom-color: #23272b; }
:root[data-theme="dark"] .leaflet-tooltip-left::before { border-left-color: #23272b; }
:root[data-theme="dark"] .leaflet-tooltip-right::before { border-right-color: #23272b; }
