/* Kartensuche fuer "Alle Auftraege" -- Figma "ATZ 2026 - Zukunft", Canvas
   "Kartensuche - Desktop" (138-645) und "Kartensuche - Mobile" (141-645).

   Markup:    web/templates/web/transport_orders.html
   Verhalten: web/static/web/js/orders-map.js

   Ergaenzt web/static/web/css/orders.css, ersetzt es nicht: Kopf, Filter,
   Liste und Blaetterleiste sind dieselben. Hier steht nur, was die
   Kartenansicht dazubringt -- der Umschalter Tabelle/Karte, die Karte samt
   Legende und das Pin-Popup.

   Klassenpraefix `mapv-` ("map view"), damit nichts mit `ord-` (Auftragsliste),
   `atz-` (base.css), `own-`, `dir-`, `rev-`, `fp-`, `chat-`, `cpr-`, `tuk-`
   kollidiert. Die Farben und Radien kommen aus orders.css bzw. base.css.

   Mobile first: die Basisregeln beschreiben das 402px-Layout, die Media-Query
   (>=768px) macht daraus das Desktop-Bild. */

/* ------------------------------------------- Umschalter Tabelle / Karte */

.mapv-views {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--ord-border);
}

.mapv-view {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;
  border-bottom: 2px solid transparent;
  color: var(--ord-muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.mapv-view:hover {
  color: var(--atz-dark);
}

.mapv-view--active {
  border-bottom-color: var(--atz-red);
  color: var(--atz-red);
}

/* Die beiden Reitersymbole des Entwurfs. Als Maske statt als Bild, damit sie
   die Schriftfarbe des Reiters annehmen -- aktiv rot, sonst grau. */
.mapv-view__icon {
  width: 18px;
  height: 18px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.mapv-view__icon--table {
  -webkit-mask-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M3 9h18M9 9v11'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M3 9h18M9 9v11'/%3E%3C/svg%3E");
}

.mapv-view__icon--map {
  -webkit-mask-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M9 4 3 6v14l6-2 6 2 6-2V4l-6 2-6-2z'/%3E%3Cpath d='M9 4v14M15 6v14'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M9 4 3 6v14l6-2 6 2 6-2V4l-6 2-6-2z'/%3E%3Cpath d='M9 4v14M15 6v14'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------- Karte */

.mapv {
  position: relative;
  height: 320px;
  margin: 0 0 16px;
  border: 1px solid var(--ord-border);
  border-radius: var(--ord-radius);
  background-color: var(--ord-shaded);
  overflow: hidden;
}

.mapv__canvas {
  width: 100%;
  height: 100%;
}

/* "In diesem Bereich suchen" -- schwebt ueber der Karte, mittig oben, und
   erscheint erst, wenn die Karte bewegt wurde (orders-map.js). */
.mapv__area {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 96px);
  padding: 9px 16px;
  border: 1px solid var(--ord-border);
  border-radius: 999px;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  color: var(--atz-dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.mapv__area:hover {
  border-color: var(--atz-gray);
}

.mapv__area-icon {
  font-size: 12px;
}

.mapv__legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 7px 12px;
  list-style: none;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
  font-size: 12px;
}

.mapv__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--atz-dark);
}

/* Auf dem Handy hat die Legende nur fuer zwei Eintraege Platz; der Entwurf
   zeigt dort genau Abhol- und Lieferort. */
.mapv__legend-item--wide {
  display: none;
}

.mapv__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.mapv__dot--from {
  background-color: var(--atz-green);
}

.mapv__dot--to {
  background-color: var(--atz-red);
}

.mapv__dot--other {
  background-color: #fff;
  border: 1px solid var(--atz-gray);
}

/* ------------------------------------------------------- Pin-Popup */

.mapv-pop {
  min-width: 232px;
  max-width: 280px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--atz-dark);
}

.mapv-pop__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}

.mapv-pop__badge {
  padding: 2px 8px;
  border-radius: 4px;
  background-color: #E7F5EC;
  color: var(--atz-green-dark);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.mapv-pop__id {
  color: var(--ord-muted);
  font-size: 12px;
}

.mapv-pop__place {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
}

.mapv-pop__place-name {
  font-weight: 700;
}

.mapv-pop__place-kind {
  margin-left: auto;
  color: var(--ord-muted);
  font-size: 12px;
}

.mapv-pop__facts {
  display: flex;
  gap: 14px;
  margin: 12px 0;
  padding-top: 12px;
  border-top: 1px solid var(--ord-line);
}

.mapv-pop__field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mapv-pop__label {
  color: var(--ord-muted);
  font-size: 11px;
}

.mapv-pop__value {
  font-weight: 700;
}

.mapv-pop__price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding-top: 10px;
  border-top: 1px solid var(--ord-line);
  color: var(--ord-muted);
  font-size: 12px;
}

.mapv-pop__price strong {
  color: var(--atz-dark);
  font-size: 17px;
}

.mapv-pop__actions {
  display: flex;
  gap: 8px;
  margin: 0;
}

.mapv-pop__actions .ord-btn {
  flex: 1;
  padding: 9px 12px;
  font-size: 13px;
}

/* Der Weg aus der aufgeklappten Detailkarte der Tabellenansicht zurueck in
   die Karte (web/templates/web/partials/_order_row_detail.html). */
.ord-map__link {
  display: inline-block;
  margin-top: 8px;
  color: var(--atz-red);
  font-size: 13px;
  font-weight: 600;
}

/* ------------------------------------------------------------ Desktop */

@media (min-width: 768px) {
  .mapv-views {
    gap: 8px;
    justify-content: flex-start;
  }

  .mapv-view {
    flex: none;
    padding: 12px 18px;
    font-size: 15px;
  }

  .mapv {
    height: 420px;
  }

  .mapv__legend-item--wide {
    display: inline-flex;
  }
}
