/* Collector map page (collector_maps/show). Colors come from the --lr-* tokens in theme.css. */

.app-shell .lr-cmap-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 1rem;
  padding: 12px 16px;
  border-radius: var(--lr-radius-card);
  background: var(--lr-navy-soft);
  color: var(--lr-ink);
  font-size: 0.875rem;
}

.app-shell .lr-cmap-note svg {
  flex: none;
  margin-top: 1px;
  color: var(--lr-navy);
}

.app-shell .lr-cmap-date .form-control {
  border: 0;
  background-color: transparent;
  box-shadow: none;
}

.app-shell .lr-cmap {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
}

.app-shell .lr-cmap-list {
  flex: 1 1 300px;
  max-width: 360px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-shell .lr-cmap-list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 4px;
}

.app-shell .lr-cmap-collectors {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-shell .lr-cmap-collector {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: var(--lr-tap);
  padding: 14px;
  border: 1.5px solid var(--lr-line);
  border-radius: var(--lr-radius-card);
  background: #ffffff;
  color: var(--lr-ink);
  text-decoration: none;
}

.app-shell .lr-cmap-collector:hover {
  border-color: var(--lr-navy);
  color: var(--lr-ink);
  text-decoration: none;
}

.app-shell .lr-cmap-collector.is-active {
  border-color: var(--lr-navy);
  background: var(--lr-navy-soft);
}

.app-shell .lr-cmap-avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
}

.app-shell .lr-cmap-collector-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.app-shell .lr-cmap-collector-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.app-shell .lr-cmap-collector-name {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell .lr-cmap-collector-line {
  font-size: 0.8125rem;
  color: var(--lr-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-shell .lr-cmap-badge {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.app-shell .lr-cmap-badge--fresh { background: var(--lr-success-bg); color: var(--lr-success); }
.app-shell .lr-cmap-badge--recent { background: var(--lr-warning-bg); color: var(--lr-warning-text); }
.app-shell .lr-cmap-badge--stale { background: #eef1f5; color: var(--lr-muted); }

.app-shell .lr-cmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 8px 4px;
  font-size: 0.75rem;
  color: var(--lr-muted);
}

.app-shell .lr-cmap-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.app-shell .lr-cmap-legend-title {
  flex-basis: 100%;
  font-weight: 600;
  color: var(--lr-ink);
}

.app-shell .lr-cmap-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.app-shell .lr-cmap-dot--fresh { background: var(--lr-success); }
.app-shell .lr-cmap-dot--recent { background: #b45309; }
.app-shell .lr-cmap-dot--stale { background: #8a94a6; }

.app-shell .lr-cmap-main {
  flex: 999 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.app-shell .lr-cmap-map-card {
  position: relative;
  overflow: hidden;
}

.app-shell .lr-cmap-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--lr-line);
}

.app-shell .lr-cmap-canvas {
  height: 560px;
  background: #eef1f5;
  z-index: 0; /* keeps Leaflet's panes under the sidebar dropdowns and toasts */
}

.app-shell .lr-cmap-loading {
  margin: 0;
  padding: 24px;
  color: var(--lr-muted);
  font-size: 0.875rem;
}

.app-shell .lr-cmap-empty {
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translate(-50%, -50%);
  z-index: 500;
  margin: 0;
  padding: 10px 16px;
  border-radius: var(--lr-radius-control);
  background: #ffffff;
  color: var(--lr-ink);
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(15, 29, 51, 0.15);
}

.app-shell .lr-cmap-route-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--lr-line);
}

.app-shell .lr-cmap-route-empty {
  margin: 0;
  padding: 24px 20px;
  color: var(--lr-muted);
  font-size: 0.875rem;
}

.app-shell .lr-cmap-stop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 26px;
  height: 26px;
  border: 2px solid var(--stop-color, var(--lr-navy));
  border-radius: 50%;
  background: #ffffff;
  color: var(--stop-color, var(--lr-navy));
  font-size: 0.75rem;
  font-weight: 700;
}

/* Leaflet markers (divIcon). Leaflet's default icon box is reset so only our markup shows. */
.lr-cmap-stop-icon,
.lr-cmap-pin-icon {
  background: none;
  border: 0;
}

.lr-cmap-pin-icon {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.lr-cmap-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 3px solid #ffffff;
  border-radius: 50% 50% 50% 0;
  background: var(--pin-color, #003479);
  box-shadow: 0 3px 10px rgba(15, 29, 51, 0.28);
  transform: rotate(-45deg);
  cursor: pointer;
}

.lr-cmap-pin > span {
  transform: rotate(45deg);
  color: #ffffff;
  font: 700 12px Inter, system-ui, sans-serif;
}

.lr-cmap-pin--stale:not(.is-selected) {
  opacity: 0.6;
}

/* .leaflet-tooltip in the selector: leaflet.css loads after this file. */
.leaflet-tooltip.lr-cmap-tooltip {
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: #0f1d33;
  color: #ffffff;
  font: 400 12px/1.4 Inter, system-ui, sans-serif;
  box-shadow: 0 4px 12px rgba(15, 29, 51, 0.2);
}

.leaflet-tooltip-top.lr-cmap-tooltip::before {
  border-top-color: #0f1d33;
}

.lr-cmap-popup {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font: 400 13px/1.4 Inter, system-ui, sans-serif;
}

.lr-cmap-popup-title {
  color: #56637a;
  font-size: 12px;
}

@media (max-width: 767.98px) {
  .app-shell .lr-cmap-list {
    max-width: none;
  }

  /* Phone: the map and the selected route come first, the collector list after. */
  .app-shell .lr-cmap-main {
    order: -1;
  }

  .app-shell .lr-cmap-canvas {
    height: 420px;
  }
}

.app-shell .lr-cmap-route {
  overflow: hidden;
}
