/* Motoplaner 2.0 – M1: Karte fuellt fast den ganzen Bildschirm,
   schlanke Statusleiste oben. */
html, body { height: 100%; margin: 0; font-family: system-ui, sans-serif; }

#map {
  position: absolute;
  inset: 44px 0 0 0;           /* unter der Statusleiste */
  background: #aad3df;
}

#topbar {
  position: absolute;
  inset: 0 0 auto 0;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  background: #1f2937;
  color: #f9fafb;
  z-index: 1000;
}

#brand { font-weight: 700; white-space: nowrap; flex: 0 0 auto; }

/* M6: Suchfeld darf schrumpfen, damit die Buttons bei schmalem Fenster
   immer sichtbar bleiben (klickbar). M7.1: min-width weiter reduziert,
   da der Modus-Schalter zusaetzliche Breite braucht. */
#searchbox { flex: 0 1 230px; min-width: 90px; }
#search { width: 100%; box-sizing: border-box; }

#status { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: #d1d5db; }
#status.error { color: #fca5a5; font-weight: 600; }

#distance {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  /* M7.1: feste Breite, damit das Anzeigen der Distanz nachberechnete
     Button-Positionen (Import/Export/Reset) nicht verschiebt. */
  flex: 0 0 70px;
  font-size: 16px;
  text-align: right;
}

#reset {
  padding: 7px 14px;
  font-size: 14px;
  border: 0;
  border-radius: 6px;
  background: #3b82f6;
  color: #fff;
  cursor: pointer;
}
#reset:hover { background: #2563eb; }
#reset[disabled] { background: #4b5563; cursor: default; }

#export {
  padding: 7px 14px;
  font-size: 14px;
  border: 0;
  border-radius: 6px;
  background: #15803d;
  color: #fff;
  cursor: pointer;
}
#export:hover { background: #166534; }
#export[disabled] { background: #4b5563; cursor: default; }

/* Start-/Zielmarker als beschriftete Pinnwade (CSS statt Bild-Assets) */
.pin {
  width: 26px; height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.pin > span {
  display: block;
  transform: rotate(45deg);
  text-align: center;
  line-height: 22px;
  font-weight: 700;
  color: #fff;
  font-size: 13px;
}
.pin.start { background: #15803d; }
.pin.goal  { background: #b91c1c; }
.pin.way   { background: #0e7490; }

/* M5: Routinglinie ist direkt greifbar – Cursor-Signal beim Ueberfahren,
   grabbing waehrend des Drags (Karten-Panning ist auf der Linie blockiert) */
.leaflet-container.route-grabbable { cursor: grab; }

/* M7.1: kompakter Umschalter Strasse/Luftlinie fuer die naechste Verbindung */
#modebox {
  display: flex;
  flex: 0 0 auto;
  border: 1px solid #374151;
  border-radius: 6px;
  overflow: hidden;
}
#modebox button {
  padding: 5px 8px;
  font-size: 12.5px;
  border: 0;
  background: #111827;
  color: #9ca3af;
  cursor: pointer;
}
#modebox button + button { border-left: 1px solid #374151; }
#modebox button.active { background: #3b82f6; color: #fff; font-weight: 600; }

/* M7: Kontextmenue fuer den Routingmodus einer Verbindung */
#segmenu {
  position: fixed;
  z-index: 2500;
  background: #1e2430;
  border: 1px solid #3a4354;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
}
#segmenu button {
  background: transparent;
  border: 0;
  color: #dbe2ee;
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
}
#segmenu button:hover { background: #2a3446; }
#segmenu button.active { background: #34507a; color: #fff; }
.leaflet-container.route-dragging { cursor: grabbing; }
.leaflet-container.route-dragging * { cursor: grabbing !important; }

/* M4: kompaktes Suchfeld mit Ergebnisliste */
#searchbox { position: relative; }
#search {
  /* Breite folgt dem Suchfeld (Zeile oben: width:100%), damit das Input
     bei schmalem Fenster nicht aus dem Searchbox herausragt und
     nachfolgende Buttons ueberdeckt. */
  padding: 7px 10px;
  font-size: 14px;
  border: 0;
  border-radius: 6px;
  background: #374151;
  color: #f9fafb;
}
#search::placeholder { color: #9ca3af; }
#search:focus { outline: 2px solid #3b82f6; }

#results {
  position: absolute;
  top: 40px;
  left: 0;
  width: 340px;
  max-height: 60vh;
  overflow-y: auto;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.55);
  z-index: 1100;
}
#results .result {
  padding: 8px 10px;
  font-size: 13px;
  color: #e5e7eb;
  cursor: pointer;
}
#results .result b { color: #fff; }
#results .result:hover, #results .result.active { background: #1d4ed8; }
#results .noresult { padding: 8px 10px; font-size: 13px; color: #9ca3af; }

/* M6: GPX-Import – Button + kompakte Objektauswahl */
#import {
  padding: 7px 14px;
  font-size: 14px;
  border: 0;
  border-radius: 6px;
  background: #7c3aed;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
#import:hover { background: #6d28d9; }

#importResults {
  position: absolute;
  top: 40px;
  left: 0;
  width: 360px;
  max-height: 60vh;
  overflow-y: auto;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.55);
  z-index: 1100;
}
#importResults .result {
  padding: 8px 10px;
  font-size: 13px;
  color: #e5e7eb;
  cursor: pointer;
}
#importResults .result b { color: #fff; }
#importResults .result:hover { background: #6d28d9; }
