/* Map view specific styling, layered on top of vendored Leaflet CSS */

.map-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: var(--sp-4);
  height: calc(100vh - var(--header-h) - var(--sp-6) * 2 - 92px);
  min-height: 560px;
}
@media (max-width: 980px) {
  .map-layout { grid-template-columns: 1fr; height: auto; }
}

.map-sidebar {
  display: flex; flex-direction: column; gap: var(--sp-3);
  overflow-y: auto;
}
.map-stage {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--ink-100);
  box-shadow: var(--shadow-sm);
  min-height: 420px;
}
#leaflet-map { width: 100%; height: 100%; min-height: 420px; background: #dce7ea; }

.map-toolbar {
  position: absolute; top: var(--sp-3); inset-inline-start: var(--sp-3); z-index: 500;
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.map-legend {
  position: absolute; bottom: var(--sp-3); inset-inline-start: var(--sp-3); z-index: 500;
  background: rgba(255,255,255,0.96); border: 1px solid var(--ink-100); border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4); font-size: var(--fs-xs); box-shadow: var(--shadow-sm);
  max-width: 240px;
}
.map-legend h4 { font-size: var(--fs-xs); margin-bottom: 6px; }
.map-legend .legend-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.legend-swatch.origin { background: var(--primary-600); }
.legend-swatch.unmapped { background: var(--ink-300); }
.legend-line { width: 18px; height: 0; border-top: 2px dashed var(--amber-600); }

.map-tile-error {
  position: absolute; inset: 0; z-index: 600;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-3);
  background: rgba(244,246,247,0.97); text-align: center; padding: var(--sp-6);
}
.map-tile-error.show { display: flex; }

.station-marker-label {
  background: var(--surface); border: 1px solid var(--ink-150); border-radius: var(--radius-sm);
  padding: 2px 8px; font-size: var(--fs-2xs); font-weight: 700; color: var(--ink-700);
  box-shadow: var(--shadow-sm); white-space: nowrap;
}
.leaflet-popup-content-wrapper { border-radius: var(--radius-md); direction: rtl; font-family: var(--font-ui); }
.leaflet-popup-content { margin: 12px 14px; font-size: var(--fs-sm); min-width: 200px; }
.map-popup h5 { margin: 0 0 4px; font-size: var(--fs-sm); }
.map-popup .pop-row { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-2xs); color: var(--ink-500); margin-top: 2px; }
.map-popup .pop-row b { color: var(--ink-900); direction: ltr; unicode-bidi: isolate; }
.map-attribution-note {
  font-size: var(--fs-2xs); color: var(--ink-500); margin-top: var(--sp-2); line-height: 1.6;
}

.unmapped-list { max-height: 220px; overflow-y: auto; }
.unmapped-list .um-row { display: flex; justify-content: space-between; gap: var(--sp-2); padding: 6px 0; border-bottom: 1px dashed var(--ink-100); font-size: var(--fs-xs); }
.unmapped-list .um-row:last-child { border-bottom: none; }
