/* =========================================================
   Huisstijl — pas deze variabelen aan om de site exact op de
   schoolhuisstijl (syncope.asg.nl) aan te laten sluiten.
   ========================================================= */
:root {
  /* De site beheert zijn eigen kleuren; voorkom dat browsers (Samsung
     Internet/Chrome "donkere modus op websites") alles inverteren — dat
     maakte o.a. de kaarttegels onzichtbaar. */
  color-scheme: only light;
  /* Kleuren naar de huisstijl van o.b.s. Syncope (syncope.asg.nl):
     teal-groene tinten, donkergrijze tekst en zachte, ronde vormen. */
  --brand: #2ba59a;        /* hoofdkleur (primaire knoppen, accenten) */
  --brand-dark: #228b81;   /* hoverkleur van primaire knoppen */
  --brand-grad: linear-gradient(115deg, #3eb3a7, #76c39c); /* header, zoals de teal-groene cirkel op de schoolsite */
  --brand-contrast: #ffffff;
  --danger: #d34b4b;
  --ink: #3b3b3b;          /* tekstkleur */
  --muted: #6b7572;        /* secundaire tekst */
  --bg: #f6faf9;           /* achtergrond zijbalk */
  --card: #ffffff;
  --line: #e3ecea;         /* randen */
  --radius: 12px;          /* kaarten en invoervelden */
  --radius-pill: 999px;    /* knoppen, zoals de pills op de schoolsite */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Quicksand", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* op mobiel: alleen het écht zichtbare deel (adresbalk telt niet mee) */
  color: var(--ink);
}

.hidden { display: none !important; }

/* --- Header --- */
header {
  background: var(--brand-grad);
  color: var(--brand-contrast);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand { display: flex; align-items: center; gap: 0.65rem; flex: 1; min-width: 0; }

.logo { width: 30px; height: 30px; flex: none; color: var(--brand-contrast); }
.logo-dot { fill: var(--brand); }

header h1 { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.01em; line-height: 1.2; }
header .sub { opacity: 0.8; font-size: 0.78rem; }

#back-link {
  color: var(--brand-contrast);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.95rem;
  white-space: nowrap;
}

#back-link:hover { background: rgba(255, 255, 255, 0.12); }

/* --- Indeling --- */
main { flex: 1; display: flex; min-height: 0; }

#sidebar {
  width: 310px;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

#editor, #route-mode, #rec-mode, #vr-mode { display: flex; flex-direction: column; gap: 1.1rem; }

#sidebar h2 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.hint { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.4rem; line-height: 1.45; }

/* --- Tabbladen --- */
#day-tabs, #mode-tabs { display: flex; gap: 0.3rem; }

.day-tab, .mode-tab {
  flex: 1;
  padding: 0.45rem 0.2rem;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ink);
  transition: background 0.15s, color 0.15s;
}

.day-tab.active, .mode-tab.active { color: #fff; border-color: transparent; }
.mode-tab.active { background: var(--brand); }
.day-tab.active[data-day="1"] { background: #dc2626; }
.day-tab.active[data-day="2"] { background: #2563eb; }
.day-tab.active[data-day="3"] { background: #16a34a; }
.day-tab.active[data-day="4"] { background: #9333ea; }

/* --- Knoppen en invoer --- */
button {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}

button:hover { background: #f1f5f9; }
button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

#save-btn, #login-btn, .primary {
  background: var(--brand);
  color: var(--brand-contrast);
  border-color: transparent;
}
#save-btn:hover, #login-btn:hover, .primary:hover { background: var(--brand-dark); }

.danger { background: var(--danger); color: #fff; border-color: transparent; }
.danger:hover { background: #b91c1c; }

.big { font-size: 1rem; padding: 0.8rem 0.7rem; width: 100%; margin-top: 0.5rem; }

#rec-add { margin-bottom: 0.5rem; }

#delete-btn { color: var(--danger); }

#save-btn, #delete-btn, #login-btn, #gps-start, #gps-stop, #revert-btn {
  width: 100%;
  margin-top: 0.4rem;
}

#vr-team { width: 100%; margin-bottom: 0.4rem; }
#print-btn, #add-team-btn {
  width: 100%;
  margin-top: 0.4rem;
}

input[type="text"], input[type="password"] {
  width: 100%;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

input:focus-visible, select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

#team-name { margin-top: 0.4rem; }

select {
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 0.85rem;
  max-width: 100%;
}

.button-row { display: flex; gap: 0.4rem; }
.button-row button { flex: 1; }

/* --- Panelen en lijsten --- */
#route-info, .route-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.5rem;
}

#distance, #rec-distance { font-size: 1.1rem; }

details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
}

details summary { cursor: pointer; font-weight: 600; font-size: 0.85rem; }
details > *:not(summary) { margin-top: 0.5rem; }

#distance-list, #team-list, #vr-schedule {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#distance-list li, #team-list li, #vr-schedule li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  font-size: 0.87rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

#vr-schedule { margin-top: 0.4rem; }
#vr-schedule li { display: block; }

#team-list button { padding: 0.2rem 0.5rem; font-size: 0.75rem; }

.day-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.route-meta { color: var(--muted); font-size: 0.75rem; }

.warning { color: var(--danger); font-weight: 600; }

.nav-link {
  /* Eigen regel onder de tekst — niet achter de tijden aan plakken. */
  display: block;
  width: fit-content;
  margin-top: 0.45rem;
  background: var(--brand);
  color: var(--brand-contrast);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover { background: var(--brand-dark); }


.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  gap: 0.4rem;
}

.setting-row input[type="number"] {
  width: 4.2rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-right: 0.3rem;
}

#follow-label, .check-label { display: block; margin-top: 0.5rem; font-size: 0.85rem; }

.point-menu { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.2rem; min-width: 180px; }
.point-menu strong { font-size: 0.9rem; }
.point-menu button { font-size: 0.8rem; }

/* --- Kaart --- */
#map-container { flex: 1; position: relative; min-width: 0; }
#map { width: 100%; height: 100%; }

/* Markers (Leaflet divIcons) */
.m-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, sans-serif;
}

.m-diamond {
  width: 20px;
  height: 20px;
  margin: 1px;
  transform: rotate(45deg);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.m-diamond span {
  transform: rotate(-45deg);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: system-ui, sans-serif;
}

.m-dimmed { opacity: 0.35; }

.m-vertex {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #2ba59a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.m-pos {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #4285f4;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.m-pause { width: 26px; height: 26px; background: #0e7490; font-size: 13px; }

.m-arrow { width: 18px; height: 18px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35)); }
.m-arrow svg { display: block; }


.leaflet-popup-content { font-family: inherit; }
.point-menu input, .point-menu textarea {
  width: 100%;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.85rem;
}
.point-menu textarea { min-height: 3.2rem; resize: vertical; }

/* Street View-overlay (Google) */
.sv-overlay { position: fixed; inset: 0; z-index: 3000; background: #000; }
.sv-overlay.hidden { display: none; }
.sv-overlay .sv-pano { width: 100%; height: 100%; }
.sv-overlay .sv-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3001;
  background: #fff;
}

/* --- Mobiel --- */
@media (max-width: 720px) {
  main { flex-direction: column; }
  #sidebar {
    width: 100%;
    max-height: 42vh;
    max-height: 42dvh;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 0.6rem;
    gap: 0.7rem;
  }
  /* De kaart krijgt altijd minstens dit stuk van het scherm. */
  #map-container { min-height: 240px; }

  /* /verkeer: het tijdschema (met navigeerknoppen) volledig en direct
     zichtbaar; de hele pagina scrolt en de kaart staat eronder. */
  body.page-verkeer { height: auto; min-height: 100vh; min-height: 100dvh; }
  body.page-verkeer main { flex: none; }
  body.page-verkeer #sidebar { max-height: none; }
  body.page-verkeer #map-container { height: 70vh; height: 70dvh; }
  #editor, #route-mode, #rec-mode, #vr-mode { gap: 0.7rem; }
  header { padding: 0.5rem 0.75rem; }
  header h1 { font-size: 0.95rem; }
  .logo { width: 26px; height: 26px; }
  button, select { min-height: 42px; }
  #day-tabs .day-tab, #mode-tabs .mode-tab { min-height: 38px; }
}

/* --- Contact --- */
.contact-footer {
  margin-top: auto;
  padding: 0.8rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--card);
}
.contact-footer a, .contact-line a { color: var(--brand); font-weight: 600; }
.contact-line { border-top: 1px solid var(--line); padding-top: 0.7rem; }

/* Richtkruis zodra een kaartklik een punt plaatst (verkeersmodus/pauzepunt);
   markers met een eigen menu houden hun pointer. */
#map.placing.leaflet-container {
  cursor: crosshair;
}

/* Voortgang langs de route (bezoekers met GPS aan): prominente kaart. */
#route-progress {
  margin-top: 0.6rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}
.progress-stats {
  display: flex;
  text-align: center;
  margin-bottom: 0.65rem;
}
.progress-stats > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.progress-stats > div + div { border-left: 1px solid var(--line); }
.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.15;
}
.stat-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
#route-progress .hint { margin: 0.45rem 0 0; text-align: center; }
.progress-track {
  height: 12px;
  background: var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--brand-grad);
  border-radius: var(--radius-pill);
  transition: width 0.6s ease;
}

/* Mededelingenbalk (admin → bezoekers- en verkeerspagina). */
.announce {
  background: #fef3c7;
  color: #92400e;
  border-bottom: 1px solid #fcd34d;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

/* QR-codes in de admin. */
.qr-row { display: flex; gap: 1rem; }
.qr-row figure { flex: 1; text-align: center; }
.qr-row svg { width: 100%; max-width: 140px; height: auto; }
.qr-row .route-meta { display: block; word-break: break-all; margin-top: 0.2rem; }
.qr-row figcaption { font-size: 0.8rem; font-weight: 600; margin-top: 0.25rem; }

#announce-text {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem;
  font-family: inherit;
  font-size: 0.85rem;
}

.gpx-link { color: var(--brand); font-size: 0.75rem; font-weight: 700; text-decoration: none; }

}

.qr-download { margin-top: 0.4rem; font-size: 0.75rem; padding: 0.3rem 0.7rem; }

.announce {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.announce-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  border-radius: var(--radius-pill);
}
.announce-close:hover { background: rgba(0, 0, 0, 0.07); }

/* Dagkeuze + GPS op één compacte regel (bezoekerspagina). */
.button-row select { flex: 1; min-width: 0; border-width: 2px; }
.button-row #gps-start, .button-row #gps-stop { margin-top: 0; }

/* Teamkleur: klikbaar bolletje (native kleurkiezer). */
.team-color {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  vertical-align: middle;
  margin-right: 0.5rem;
}
.team-color::-webkit-color-swatch-wrapper { padding: 0; }
.team-color::-webkit-color-swatch { border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 50%; }
.team-color::-moz-color-swatch { border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 50%; }

/* Teamnaam: ter plekke te bewerken (vlak veld, pas zichtbaar bij focus). */
#team-list .team-name {
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  padding: 0.15rem 0.3rem;
  width: 11rem;
  max-width: 100%;
}
#team-list .team-name:hover { border-color: var(--line); }
#team-list .team-name:focus { border-color: var(--brand); outline: none; background: var(--card); }
#team-list li > span:first-child { display: flex; align-items: center; flex: 1; min-width: 0; }
