/* Trail Safety Map — race-director dashboard.
   Dark, high-contrast UI so colored dots read at a glance in daylight. */

:root {
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;

  --bg-panel: rgba(17, 24, 39, 0.88);
  --fg: #f9fafb;
  --fg-muted: #9ca3af;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ---- Typography role system (use these, never ad-hoc font-size) ---- */
.t-title { font-size: 1rem; font-weight: 600; line-height: 1.2; margin: 0; }
.t-meta { font-size: 0.8125rem; font-weight: 400; line-height: 1.3; margin: 0; color: var(--fg-muted); }
.t-label { font-size: 0.8125rem; font-weight: 500; line-height: 1.2; }

* { box-sizing: border-box; }

/* The hidden attribute must win over our display:grid/flex rules below. */
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
}

#map {
  position: absolute;
  inset: 0;
  background: #0b0f17;
}

/* ---- Floating panels ---- */
.panel,
.legend {
  position: absolute;
  z-index: 1000;
  background: var(--bg-panel);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  padding: 0.625rem 0.875rem;
}

.panel { top: 0.75rem; left: 0.75rem; display: grid; gap: 0.25rem; min-width: 12rem; }
.panel .t-title { letter-spacing: 0.01em; }

.legend { bottom: 0.75rem; left: 0.75rem; display: grid; gap: 0.375rem; }
.legend-row { display: flex; align-items: center; gap: 0.5rem; }

.dot { width: 0.75rem; height: 0.75rem; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }
.dot-neutral { background: var(--fg-muted); }

/* Checkpoint legend swatch — rounded square, matches the map marker shape. */
.cp-swatch {
  width: 0.8rem; height: 0.8rem; flex: none;
  border-radius: 3px;
  background: var(--fg-muted);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.legend-divider { height: 1px; background: var(--border); margin: 0.125rem 0; }

/* Status dot inline with the "Updated Ns ago" line. */
#status::before {
  content: "";
  display: inline-block;
  width: 0.5rem; height: 0.5rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--green);
  vertical-align: middle;
}
#status.is-stale::before { background: var(--red); }

/* ---- Dashboard-not-updating banner (dashboard health, not node health) ---- */
.dashboard-stale {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 1100;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  justify-content: center;
  padding: 0.5rem 1rem;
  background: var(--red);
  color: #fff;
  text-align: center;
}
.dashboard-stale .t-meta { color: rgba(255, 255, 255, 0.85); }

/* ---- Empty state ---- */
.empty {
  position: absolute;
  z-index: 1000;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.25rem 1.75rem;
  display: grid;
  gap: 0.375rem;
}

/* ---- Node labels (permanent tooltips) ---- */
.node-label {
  background: rgba(17, 24, 39, 0.82);
  color: var(--fg);
  border: none;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: none;
}
.node-label::before { display: none; } /* hide tooltip arrow */

/* Checkpoint map marker — rounded square, freshness-colored, white border. */
.cp-glyph {
  display: block;
  width: 13px; height: 13px;
  border-radius: 3px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-content { font-size: 0.8125rem; line-height: 1.4; }
.leaflet-popup-content .popup-label { font-weight: 600; }
