/* Map container, markers, popups and MapLibre control placement. */

.map {
  position: fixed;
  inset: 0;
  background: var(--bg);
}

/* Keep controls clear of the top search panel and the bottom sheet on mobile. */
.maplibregl-ctrl-top-right {
  top: calc(var(--panel-h) + var(--safe-top) + 8px);
  right: var(--safe-right);
  transition: top 0.3s var(--ease);
}

.maplibregl-ctrl-bottom-right,
.maplibregl-ctrl-bottom-left {
  bottom: calc(var(--sheet-h) + var(--safe-bottom));
  transition: bottom 0.3s var(--ease);
}

.maplibregl-ctrl-bottom-left {
  left: var(--safe-left);
}

.maplibregl-ctrl-group {
  border-radius: 12px !important;
  box-shadow: var(--shadow-sm) !important;
  overflow: hidden;
}

.maplibregl-ctrl-group button {
  width: 40px !important;
  height: 40px !important;
}

.maplibregl-ctrl-attrib {
  font-size: 11px;
}

.maplibregl-ctrl-scale {
  border-color: var(--text-muted);
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

@media (prefers-color-scheme: dark) {
  .maplibregl-ctrl-group {
    background: var(--surface);
  }

  .maplibregl-ctrl-group button + button {
    border-top-color: var(--border);
  }

  .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
    filter: invert(1) hue-rotate(180deg);
  }
}

/* ---------- Markers ---------- */

.marker {
  cursor: grab;
}

.marker:active {
  cursor: grabbing;
}

.marker--origin {
  width: 24px;
  height: 24px;
  background: #fff;
  border: 6px solid var(--origin);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.marker--destination {
  width: 34px;
  height: 44px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35));
}

.marker--destination svg {
  width: 34px;
  height: 44px;
  stroke: none;
}

.marker--user {
  position: relative;
  width: 20px;
  height: 20px;
  background: var(--route);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.marker--user::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--route) 30%, transparent);
  animation: user-pulse 2s ease-out infinite;
}

@keyframes user-pulse {
  from { transform: scale(0.4); opacity: 1; }
  to { transform: scale(1.6); opacity: 0; }
}

/* ---------- Popup: choose start or destination ---------- */

.lalu-popup .maplibregl-popup-content {
  padding: 12px;
  color: var(--text);
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.lalu-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.lalu-popup.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.lalu-popup.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: var(--surface);
}

.lalu-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.lalu-popup.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.lalu-popup.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: var(--surface);
}

.lalu-popup .maplibregl-popup-close-button {
  width: 28px;
  height: 28px;
  font-size: 18px;
  color: var(--text-muted);
}

.choice {
  display: grid;
  gap: 6px;
  min-width: 190px;
}

.choice__coords {
  padding-right: 24px;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.choice__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  padding: 0 12px;
  font-weight: 600;
  text-align: left;
  background: var(--surface-2);
  border: 0;
  border-radius: var(--radius-sm);
}

.choice__btn:hover {
  background: var(--surface-hover);
}

.choice__btn .field__dot {
  margin-right: 0;
}
