/* ==========================================================================
   Leaflet theming — controls, attribution and custom markers must follow
   the application theme. Map TILES stay provider-styled on purpose; the
   basemap choice is independent from the light/dark appearance.
   ========================================================================== */

.leaflet-container {
  font: inherit;
  background: var(--surface-muted);
}

.leaflet-control-zoom {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-m) !important;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

/* The zoom bar's right edge lines up with the #map-fit button column above
   (both 12px off the pane edge); Leaflet's default margin is 10px. */
.leaflet-bottom.leaflet-right .leaflet-control-zoom {
  margin-inline-end: 12px;
}

.leaflet-control-zoom a {
  background: var(--surface-elevated) !important;
  color: var(--foreground) !important;
  border-block-end: 1px solid var(--border) !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 30px !important;
}

.leaflet-control-zoom a:last-child { border-block-end: none !important; }
.leaflet-control-zoom a:hover { background: var(--surface-hover) !important; }

.leaflet-control-attribution {
  background: color-mix(in srgb, var(--surface-elevated) 86%, transparent) !important;
  color: var(--foreground-faint) !important;
  font-size: 10.5px !important;
  padding: 2px 7px !important;
  border-start-start-radius: var(--radius-s);
}

.leaflet-control-attribution a { color: var(--foreground-muted) !important; }

.leaflet-control-scale-line {
  background: color-mix(in srgb, var(--surface-elevated) 80%, transparent) !important;
  border-color: var(--border-strong) !important;
  color: var(--foreground-muted) !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--surface-elevated);
  color: var(--foreground);
  box-shadow: var(--shadow-1);
}

.leaflet-popup-content { margin: 10px 14px; font: inherit; }

/* Sector boundary handles ---------------------------------------------------- */

.map-handle-icon { background: none; border: none; touch-action: none; }

.map-handle {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: var(--handle-color, var(--accent));
  border: 2.5px solid var(--map-handle-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.map-handle:active { cursor: grabbing; }

/* Enlarged invisible hit area for touch. */
.map-handle::after {
  content: "";
  position: absolute;
  inset: -14px;
}

.map-handle-grip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
}

.leaflet-marker-icon.map-handle-icon:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Hover dot (profile ⇄ map sync) --------------------------------------------- */

.hover-dot-icon { background: none; border: none; }

.hover-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--map-handle-border);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Waypoints (GPX <wpt>) ------------------------------------------------------- */

.map-waypoint-icon { background: none; border: none; }

.map-waypoint {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--waypoint-color, var(--accent));
  border: 2.5px solid var(--map-handle-border);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Enlarged invisible hit area for touch, so the tooltip is reachable. */
.map-waypoint::after {
  content: "";
  position: absolute;
  inset: -12px;
}

/* Cooperative-gestures hint (touch devices): one finger scrolls the page,
   two fingers move the map. Purely informational — never blocks touches. */

.map-gesture-hint {
  position: absolute;
  inset-block-start: 50%;
  inset-inline: 0;
  margin-inline: auto;
  transform: translateY(-50%);
  width: fit-content;
  max-width: min(88%, 320px);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  color: var(--foreground);
  font-size: 13px;
  font-weight: 550;
  pointer-events: none;
}

.map-gesture-hint[hidden] { display: none; }

.map-gesture-hint .icon { width: 16px; height: 16px; color: var(--accent); flex: none; }
