/**
 * Map Styles
 *
 * Styles for the Leaflet map and station markers.
 * Marker size: 25px diameter per README.
 */

/* Hide footer on map page - sidebar contains footer info */
.footer {
  display: none;
}

/* Map container - account for sidebar */
.map-container {
  position: fixed;
  top: 60px; /* Header height */
  left: 0;
  right: 300px; /* Sidebar width */
  bottom: 0;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 60px;
  right: 0;
  bottom: 0;
  width: 350px;
  background-color: var(--color-bg);
  border-left: 1px solid var(--color-border);
  overflow-y: auto;
  z-index: var(--z-sidebar, 100);
}

.sidebar__content {
  padding: var(--spacing-md);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.sidebar__header {
  margin-bottom: var(--spacing-lg);
  position: relative;
}

.sidebar__title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--spacing-xs);
}

.sidebar__close {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color 0.2s ease;
}

.sidebar__close:hover {
  color: var(--color-text);
}

.sidebar__date {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.sidebar__section {
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-border-light, #eee);
}

.sidebar__section:last-of-type {
  border-bottom: none;
}

.sidebar__section--info {
  flex-grow: 1;
}

.sidebar__subtitle {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar__stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--spacing-xs);
}

.sidebar__stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.sidebar__stat-value {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-text);
}

.sidebar__stat-value--severe {
  color: var(--color-delay-red);
}

/* Legend */
.sidebar__legend {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.sidebar__legend-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.sidebar__legend-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Pie chart delay level colors (legend) */
.sidebar__legend-color--puntual {
  background-color: #22c55e;
}

.sidebar__legend-color--menor {
  background-color: #eab308;
}

.sidebar__legend-color--medio {
  background-color: #f97316;
}

.sidebar__legend-color--mayor {
  background-color: #ef4444;
}

.sidebar__legend-color--severo {
  background-color: #1a1a1a;
}

/* Network summary station-level colors */
.sidebar__legend-color--green {
  background-color: var(--color-delay-green);
}

.sidebar__legend-color--yellow {
  background-color: var(--color-delay-yellow);
}

.sidebar__legend-color--orange {
  background-color: var(--color-delay-orange);
}

.sidebar__legend-color--red {
  background-color: var(--color-delay-red);
}

.sidebar__legend-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  flex-grow: 1;
}

.sidebar__legend-value {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

/* Empty state text */
.sidebar__empty {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-style: italic;
}

/* Category statistics table */
.categoria-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.categoria-table__header {
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: left;
  padding: var(--spacing-xs) var(--spacing-xs);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-xs);
  white-space: nowrap;
}

.categoria-table__header--number {
  text-align: right;
}

.categoria-table__cell {
  padding: var(--spacing-xs) var(--spacing-xs);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border-light, #eee);
}

.categoria-table__cell--name {
  font-weight: 500;
}

.categoria-table__cell--number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Info section */
.sidebar__info {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.sidebar__info--compact {
  margin: 0;
}

.sidebar__info a {
  color: var(--color-primary);
  text-decoration: underline;
}

.sidebar__info a:hover {
  color: var(--color-primary-dark);
}

/* Footer inside sidebar */
.sidebar__footer {
  margin-top: auto;
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border-light, #eee);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.sidebar__footer p {
  margin-bottom: var(--spacing-xs);
}

.sidebar__footer p:last-child {
  margin-bottom: 0;
}

.sidebar__footer a {
  color: var(--color-primary);
}

/* Sidebar toggle button - only visible on mobile */
.sidebar__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 999;
  transition: transform 0.3s ease-in-out;
}

.sidebar__toggle:hover {
  background-color: var(--color-bg-secondary);
}

.sidebar__toggle svg {
  transition: transform 0.3s ease-in-out;
  color: var(--color-text-muted);
}

/* Rotate arrow when sidebar is open */
.sidebar--open + .map-container .sidebar__toggle svg,
.map-container .sidebar__toggle.sidebar--open svg {
  transform: rotate(180deg);
}

#map {
  width: 100%;
  height: 100%;
}

/* Station marker wrapper — Leaflet DivIcon container */
.station-marker-wrapper {
  background: none !important;
  border: none !important;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

/* Pie chart SVG inside marker */
.station-marker-svg {
  display: block;
}

/* Hover effect handled via JS (scale 1.2x, drop-shadow, z-index 1000) */

/* Leaflet popup customization */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
  margin: var(--spacing-sm) var(--spacing-md);
  font-family: var(--font-family);
}

/* Tooltip content — inline layout with delay breakdown */
.station-tooltip .leaflet-tooltip-content {
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

/* Map controls */
.leaflet-control-zoom {
  border-radius: var(--radius-md) !important;
  border: none !important;
  box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
  color: var(--color-text) !important;
  border-radius: var(--radius-sm) !important;
}

.leaflet-control-zoom a:hover {
  background-color: var(--color-bg-alt) !important;
}

/* Map attribution */
.leaflet-control-attribution {
  background-color: rgba(255, 255, 255, 0.8) !important;
  font-size: var(--font-size-xs);
}
