/* ── Full-screen map ────────────────────────────────────────────────────── */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ── Controls overlay ───────────────────────────────────────────────────── */
#controls {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  max-width: 280px;
  min-width: 220px;
  z-index: 10;
  font-size: 13px;
  transition: max-width 0.2s;
}

#controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
}

.controls-title {
  font-weight: 600;
  font-size: 14px;
  color: #222;
}

#controls-toggle {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #666;
  padding: 0 4px;
  line-height: 1;
}

#controls.collapsed #controls-body {
  display: none;
}

#controls-body {
  padding: 10px 12px;
}

.control-group {
  margin-bottom: 12px;
}

.control-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  color: #333;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── Device selector ────────────────────────────────────────────────────── */
#device-select {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.device-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  background: #f2f2f2;
  user-select: none;
  transition: background 0.15s;
  color: var(--chip-color, #333);
}

.device-chip.active {
  border-color: currentColor;
  background: #fff;
}

.device-chip .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: var(--chip-color, #333);
}

.device-empty {
  font-size: 11px;
  color: #999;
}

/* ── Time slider ────────────────────────────────────────────────────────── */
#time-slider {
  margin: 6px 12px 2px 12px;
  height: 4px;
}

#time-slider .noUi-connect {
  background: #3374c4;
}

#time-slider .noUi-handle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #3374c4;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  cursor: grab;
  right: -10px;
  top: -9px;
}

#time-slider .noUi-handle::before,
#time-slider .noUi-handle::after {
  display: none;
}

.time-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #666;
  margin: 6px 12px 0;
}

/* ── Preset buttons ─────────────────────────────────────────────────────── */
.presets {
  display: flex;
  gap: 4px;
}

.preset-btn {
  flex: 1;
  padding: 4px 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fafafa;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s;
}

.preset-btn:hover {
  background: #e8e8e8;
}

.preset-btn.active {
  background: #3374c4;
  color: #fff;
  border-color: #3374c4;
}

/* ── Legend ─────────────────────────────────────────────────────────────── */
#legend {
  margin-top: 4px;
}

.legend-title {
  font-weight: 600;
  font-size: 12px;
  color: #333;
  margin-bottom: 3px;
}

.legend-gradient {
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(to right, rgba(0,0,0,0.15), rgba(0,0,0,0.85));
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #888;
  margin-top: 2px;
}

/* ── Point count ────────────────────────────────────────────────────────── */
#point-count {
  font-size: 11px;
  color: #999;
}

/* ── Admin panel ────────────────────────────────────────────────────────── */
#admin-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  min-width: 160px;
  max-width: 240px;
  z-index: 10;
  font-size: 13px;
}

#admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: default;
}

.admin-title {
  font-weight: 600;
  font-size: 13px;
  color: #444;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#admin-toggle {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #666;
  padding: 0 4px;
  line-height: 1;
}

#admin-body {
  display: none;
  padding: 0 12px 10px;
  border-top: 1px solid #e8e8e8;
}

.admin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 0 6px;
}

.admin-links a {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #f0f0f0;
  color: #3374c4;
  text-decoration: none;
  border: 1px solid #ddd;
  white-space: nowrap;
}

.admin-links a:hover {
  background: #e0eaf8;
  border-color: #3374c4;
}

.admin-device-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-top: 2px;
}

.admin-device-table td {
  padding: 2px 0;
  vertical-align: middle;
}

.admin-device-table td:last-child {
  text-align: right;
  color: #888;
  padding-left: 8px;
  white-space: nowrap;
}

.admin-swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  flex-shrink: 0;
}

.admin-loading,
.admin-empty,
.admin-error {
  font-size: 11px;
  color: #999;
  display: block;
  padding: 2px 0;
}

.admin-error {
  color: #c0392b;
}

/* ── MapLibre overrides ─────────────────────────────────────────────────── */
.maplibregl-ctrl-attrib {
  font-size: 10px !important;
  background: rgba(255,255,255,0.7) !important;
}
