html, body {
  margin: 0;
  height: 100%;
  font-family: Arial, sans-serif;
}

/* Kaart */
#map {
  height: 100%;
  width: 100%;
}

/* Legenda */
#legend {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.legend-item {
  cursor: pointer;
  margin: 3px 0;
  user-select: none;
}

.legend-item.active {
  font-weight: bold;
  text-decoration: underline;
}

.dot {
  font-weight: bold;
  margin-right: 4px;
}

.dot.green { color: green; }
.dot.orange { color: orange; }
.dot.red { color: red; }

/* Statusbox (tijd + link) */
#statusbox {
  position: absolute;
  bottom: 25px;
  right: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
  text-align: right;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

#timestamp {
  margin: 0 0 0 0;
}

#uitleg-link {
  text-decoration: none;
  color: #001fff;
}

#uitleg-link:hover {
  text-decoration: underline;
}

/* ===================== */
/* Stijlen voor uitlegpagina */
/* ===================== */

.uitleg-container {
  max-width: 700px;
  margin: 3rem auto;
  padding: 2rem;
  font-family: Arial, sans-serif;
  line-height: 1.6;
}

.uitleg-container h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.uitleg-container h2 {
  margin-top: 2rem;
  font-size: 1.2rem;
}

.uitleg-container ul {
  margin-top: 1rem;
  padding-left: 1.2rem;
}

.uitleg-container li {
  margin-bottom: 0.5rem;
}

.uitleg-container a {
  color: #0066cc;
  text-decoration: none;
}

.uitleg-container a:hover {
  text-decoration: underline;
}

.uitleg-container .terug-link {
  display: inline-block;
  margin-top: 2rem;
}

#dynamic-legend {
  margin-top: 1rem;
  background: rgba(240, 240, 240, 0.7);
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
}

/* ===================== */
/* Donkere modus via media query */
/* ===================== */

body {
  background-color: white;
  color: black;
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: #121212;
    color: #f0f0f0;
  }

  #map {
    filter: brightness(0.8);
  }

  #legend,
  #statusbox,
  #loading {
    background: rgba(30, 30, 30, 0.9);
    color: #f0f0f0;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.2);
  }

  .dot.green { color: #6ccf6c; }
  .dot.orange { color: #ffc658; }
  .dot.red { color: #ff6666; }

  a {
    color: #66aaff;
  }

  #uitleg-link {
    color: #66aaff;
  }

  .uitleg-container {
    background-color: #121212;
  }

  #dynamic-legend {
    background: rgba(40, 40, 40, 0.7);
  }
}

/* ====== TOOLTIP STANDAARD ====== */
.leaflet-tooltip.marker-label {
  font-size: 12px;
  padding: 2px 6px;
  font-weight: bold;
  border-radius: 4px;
  border: 1px solid #ccc;
  background-color: rgba(255, 255, 255, 0.9);
  color: #333;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}
.tooltip-speed {
  font-size: 12px;
  font-weight: bold;
  line-height: 1.2;
}

.tooltip-location {
  font-size: 10px;
  font-weight: normal;
  color: #000;
  margin-top: 2px;
}

/* ====== KLEUR OP BASIS VAN SNELHEID ====== */
.leaflet-tooltip.marker-label-red {
  color: #c40000;
  border-color: #c40000;
}

.leaflet-tooltip.marker-label-orange {
  color: #d57700;
  border-color: #d57700;
}

.leaflet-tooltip.marker-label-green {
  color: #2e7d32;
  border-color: #2e7d32;
}

/* ====== EXCESSEN (≥160 km/u) ====== */
.leaflet-tooltip.marker-label-excess {
  background-color: white;
  color: #c40000;
  border-color: #c40000;
}

/* ====== DARK MODE ====== */
@media (prefers-color-scheme: dark) {
  .leaflet-tooltip.marker-label {
    background-color: rgba(30, 30, 30, 0.9);
    border-color: #444;
    color: #f0f0f0;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.2);
  }

  .leaflet-tooltip.marker-label-red {
    color: #ff6b6b;
    border-color: #ff6b6b;
  }

  .leaflet-tooltip.marker-label-orange {
    color: #ffc658;
    border-color: #ffc658;
  }

  .leaflet-tooltip.marker-label-green {
    color: #6ccf6c;
    border-color: #6ccf6c;
  }

  .leaflet-tooltip.marker-label-excess {
    background-color: #fff;
    color: #c40000;
    border-color: #c40000;
  }
  
  .tooltip-location {
    color: #ccc;
  }
}

@media (prefers-color-scheme: dark) {
  #loading div:last-child {
    color: #eee;
  }
}