/* Farvetema for vejtjek.dk — alle farver stammer fra logoet.
   Roller: marineblå bærer strukturen, orange bruges KUN til handling,
   grøn/blå er status og detaljer. */

:root {
  --navy: #1c2a4a;
  --navy-deep: #14203a;
  --navy-soft: #26365c;
  --orange: #ee8422;
  --orange-dark: #d67114;
  --green: #2fa84f;
  --green-light: #7cc142;
  --sky: #2b9cd8;
  --asphalt: #3d434d;

  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #1c2a4a;
  --ink-soft: #51607e;
  --line: #e4e9f1;
  --error: #c62828;
  --error-bg: #fdecea;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.hidden { display: none !important; }

/* ---------- ordmærke & knapper (fælles) ---------- */

.wordmark {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--navy);
  text-decoration: none;
  font-size: 1.25rem;
}
.wordmark-dk { color: var(--orange); }

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 650;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid #cfd8e6;
}
.btn-outline:hover { border-color: var(--ink-soft); }
.btn-block { display: block; width: 100%; text-align: center; }

:is(a, button, input, select):focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 2px;
}

.error {
  color: var(--error);
  background: var(--error-bg);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  margin: 0;
}

/* ---------- landingpage ---------- */

.landing {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--surface);
}
.landing main { flex: 1; }

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem clamp(1rem, 5vw, 3rem);
  border-bottom: 1px solid var(--line);
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  max-width: 64rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) clamp(1rem, 5vw, 3rem);
  background:
    radial-gradient(60% 90% at 85% -20%, rgb(43 156 216 / 0.10), transparent 65%),
    radial-gradient(50% 80% at -10% 110%, rgb(47 168 79 / 0.10), transparent 60%);
}

.hero-logo {
  display: block;
  max-height: 240px;
  max-width: min(100%, 22rem);
  width: auto;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
  text-wrap: balance;
}

.hero-tagline {
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 34ch;
  margin: 0 0 1.4rem;
}

.hero-points {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}
.hero-points li { display: flex; align-items: center; gap: 0.6rem; }
.point-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.point-green { background: var(--green); }
.point-orange { background: var(--orange); }
.point-blue { background: var(--sky); }

.login-card {
  padding: 1.6rem 1.5rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--orange);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgb(28 42 74 / 0.10);
}

.login-card form,
#session-state {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.session-user {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: -0.4rem 0 0.2rem;
}
.session-user strong { color: var(--ink); }

.login-card h2 { font-size: 1.1rem; font-weight: 750; margin: 0 0 0.25rem; }

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.login-card input {
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  padding: 0.55rem 0.65rem;
  border: 1px solid #cfd8e6;
  border-radius: 7px;
  background: #fbfcfe;
}

.login-card .btn { margin-top: 0.4rem; font-size: 1rem; padding: 0.65rem; }

.login-note {
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
  margin: 0.2rem 0 0;
}

/* ---------- FØR-LANCERING: slørede tekster ----------
   Marketingteksterne sløres, så man kan se at der er indhold uden at kunne
   læse det. Logo, login-kort og footer forbliver læsbare. Fjernes ved
   officiel lancering sammen med "prelaunch"-klassen på <body> i index.html.
   NB: kun kosmetisk - teksten findes stadig i kildekoden. */

.prelaunch .hero h1,
.prelaunch .hero-tagline,
.prelaunch .hero-points,
.prelaunch .road-divider span,
.prelaunch .feature-card h3,
.prelaunch .feature-card p {
  filter: blur(0.3em);
  user-select: none;
}

/* Asfaltbånd med midterstribe som sektionsskille. */
.road-divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 3.2rem;
  background: var(--asphalt);
}
.road-divider::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto 0;
  height: 3px;
  margin-top: -1.5px;
  background: repeating-linear-gradient(90deg, var(--bg) 0 26px, transparent 26px 52px);
  opacity: 0.85;
}
.road-divider span {
  position: relative;
  background: var(--asphalt);
  color: #cfd6e0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0 1rem;
}

/* Fuldbredde-bånd på den kølige grund; kortene centreres indeni. */
.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 19rem));
  justify-content: center;
  gap: 1.2rem;
  padding: 2rem clamp(1rem, 5vw, 3rem) 2.5rem;
  background: var(--bg);
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.2rem;
}
.feature-card h3 { font-size: 0.95rem; margin: 0 0 0.3rem; }
.feature-card p { font-size: 0.88rem; color: var(--ink-soft); margin: 0; }

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem clamp(1rem, 5vw, 3rem);
  background: var(--navy);
  color: #aab6cf;
  font-size: 0.85rem;
}
.wordmark-footer { color: #fff; font-size: 1rem; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .hero-logo { max-height: 160px; }
  .features { grid-template-columns: 1fr; }
}

/* ---------- kortportal ---------- */

.portal { height: 100vh; overflow: hidden; }

#map {
  position: absolute;
  inset: 52px 0 0 0;
}

#topbar {
  position: absolute;
  inset: 0 0 auto 0;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding: 0 1rem;
  background: var(--navy);
  color: #e8edf6;
  z-index: 10;
}

.wordmark-topbar { color: #fff; font-size: 1.05rem; margin-right: 0.4rem; }

#topbar label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.83rem;
  color: #aab6cf;
}

#topbar select {
  font-size: 0.85rem;
  font-family: inherit;
  padding: 0.3rem 0.5rem;
  color: #e8edf6;
  background: var(--navy-soft);
  border: 1px solid #35476f;
  border-radius: 6px;
}

/* ---------- adressesøgning (DAWA) ---------- */

#address-search { position: relative; }

#address-input {
  font-size: 0.85rem;
  font-family: inherit;
  width: 15rem;
  padding: 0.3rem 0.6rem;
  color: #e8edf6;
  background: var(--navy-soft);
  border: 1px solid #35476f;
  border-radius: 6px;
}
#address-input::placeholder { color: #94a6c5; }

#address-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgb(16 24 43 / 0.22);
  z-index: 20;
}

#address-results button {
  display: block;
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  color: var(--ink);
  background: none;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
}
#address-results button:hover { background: var(--bg); }

#user-name {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

#topbar button {
  font-size: 0.85rem;
  font-family: inherit;
  padding: 0.35rem 0.85rem;
  color: #cdd6e8;
  background: transparent;
  border: 1px solid #435580;
  border-radius: 6px;
  cursor: pointer;
}
#topbar button:hover { background: var(--navy-soft); color: #fff; }

/* ---------- sidepanel: strækningsinfo, filtre, punktliste ---------- */

#side-panel {
  position: absolute;
  top: 52px;
  right: 0;
  bottom: 0;
  width: 340px;
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
  z-index: 5;
}
.panel-open #side-panel { display: flex; }
.panel-open #map { right: 340px; }

#section-info h2 { font-size: 1.05rem; margin: 0 0 0.2rem; }
#section-meta {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0;
}

/* Før/efter: målinger af samme vej (road_id). */
#section-measurements {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
#measurements-label {
  font-size: 0.76rem;
  color: var(--ink-soft);
}
.measurement {
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink);
  padding: 0.2rem 0.6rem;
  background: var(--bg);
  border: 1px solid #cfd8e6;
  border-radius: 99px;
  cursor: pointer;
}
.measurement:hover:not(:disabled) { border-color: var(--sky); color: var(--sky); }
.measurement-current {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  cursor: default;
}

/* Nøgletal: stablet fordeling + god/middel/dårlig-andele. */
#section-stats {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
#stats-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
}
#stats-bar span { min-width: 3px; }
#stats-buckets {
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin: 0;
}

#section-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.panel-action {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  background: var(--bg);
  border: 1px solid #cfd8e6;
  border-radius: 99px;
  cursor: pointer;
}
.panel-action:hover { border-color: var(--sky); color: var(--sky); }

.print-only { display: none; }

#category-filter {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem 0.7rem;
  margin: 0;
}
#category-filter legend {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 0 0.3rem;
}
#category-options { display: flex; flex-direction: column; gap: 0.35rem; }
.category-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
}

#point-list-summary {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 0;
}

#point-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.point-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.point-item:hover { border-color: var(--sky); background: #f0f6fb; }

.point-item-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.8);
  flex: none;
  margin-top: 0.15rem;
}
.point-item-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.point-item-text strong { font-size: 0.85rem; font-weight: 650; }
.point-item-meta { font-size: 0.76rem; color: var(--ink-soft); }
.point-item-note {
  font-size: 0.78rem;
  color: var(--ink-soft);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media (max-width: 720px) {
  #side-panel { width: 100%; border-left: none; }
  .panel-open #map { right: 0; }
}

/* ---------- signaturforklaring (dobler som alvorlighedsfilter) ---------- */

#legend {
  position: absolute;
  left: 10px;
  bottom: 34px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.6rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgb(16 24 43 / 0.16);
}

.legend-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.12rem 0.2rem;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
.legend-row:hover { background: var(--bg); }
.legend-row-off { opacity: 0.35; }
.legend-row-off .legend-dot { background: #cfd8e6 !important; }

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.8);
  flex: none;
}

.legend-hint {
  font-size: 0.66rem;
  color: var(--ink-soft);
  margin-top: 0.2rem;
}

/* ---------- kort-popup ---------- */

.popup {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
  font-size: 0.82rem;
  max-width: 320px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.popup-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 99px;
  padding: 0.2rem 0.6rem;
  background: #fdeeda;
  color: #b05e0d;
}

/* Flere fund pr. punkt (v1.2): badges ombrydes side om side. */
.popup-findings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.popup-meta { color: var(--ink-soft); }
.popup-note { color: var(--ink); }

.popup img {
  max-width: 100%;
  margin-top: 0.25rem;
  border-radius: 6px;
  display: block;
}

/* Fotoet i popuppen er en knap, der åbner lightboxen. */
.popup-photo {
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  max-width: 100%;
}

/* ---------- foto-lightbox ---------- */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: rgb(16 24 43 / 0.88);
}

#lightbox figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  max-width: min(1100px, 100%);
  max-height: 100%;
  min-width: 0;
}

#lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 9rem);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.5);
}

#lightbox figcaption {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: center;
  color: #e8edf6;
  font-size: 0.9rem;
}

#lightbox-counter {
  font-size: 0.8rem;
  color: #aab6cf;
  font-variant-numeric: tabular-nums;
}

#lightbox-note { color: #cdd6e8; }

#lightbox button {
  flex: none;
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  line-height: 1;
  color: #fff;
  background: rgb(255 255 255 / 0.12);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
#lightbox button:hover:not(:disabled) { background: rgb(255 255 255 / 0.25); }
#lightbox button:disabled { opacity: 0.3; cursor: default; }

#lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.maplibregl-popup-content {
  border-radius: 10px;
  box-shadow: 0 14px 34px rgb(16 24 43 / 0.28);
  padding: 12px 14px;
}

/* ---------- print: tilstandsrapport ----------
   "Udskriv rapport" printer sidepanelet som dokument: titel, datoer,
   nøgletal og den aktuelt filtrerede punktliste. Kort og betjening udelades
   (kort-canvas printer upålideligt). */

@media print {
  .portal { height: auto; overflow: visible; }

  #topbar, #map, #legend, #lightbox,
  #section-actions, #category-filter, #section-measurements { display: none !important; }

  #side-panel {
    display: flex !important;
    position: static;
    width: 100%;
    border-left: none;
    overflow: visible;
    padding: 0;
  }

  .print-only {
    display: block;
    font-size: 0.9rem;
    color: var(--ink-soft);
    margin: 0 0 0.6rem;
  }

  .point-item { border-color: #999; break-inside: avoid; }
  .point-item-dot { border-color: #999; }
  #stats-bar { border: 1px solid #999; }

  /* Farver skal med på papir/PDF. */
  #stats-bar span, .point-item-dot, .legend-dot {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
