/* Interactive Vector & High-Res Map Styling */

.map-wrapper {
  position: relative;
  width: 100%;
  height: 640px;
  background: #f8fafc;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.map-layer {
  position: absolute;
  inset: 0;
  display: none;
}

.map-layer.active {
  display: block;
}

/* Schematic SVG Layer */
.transit-svg-canvas {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  will-change: transform;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.transit-line-path {
  transition: opacity 0.3s ease, stroke-width 0.2s ease, filter 0.2s ease;
  cursor: pointer;
}

.transit-line-path:hover {
  stroke-width: 8px;
  filter: url(#glow);
}

.transit-line-path.dimmed {
  opacity: 0.15;
}

.transit-line-path.highlighted {
  opacity: 1;
  stroke-width: 7px;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.3));
}

.transit-line-path.route-active {
  opacity: 1;
  stroke-width: 8px;
  stroke-dasharray: 8, 4;
  animation: dashAnimation 1.5s linear infinite;
}

@keyframes dashAnimation {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}

/* SVG Station Nodes */
.station-node circle {
  transition: transform 0.2s ease, fill 0.2s ease, stroke 0.2s ease;
}

.station-node:hover circle {
  transform: scale(1.35);
}

.station-node:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 4px;
}

.station-node:focus-visible circle {
  stroke: var(--primary);
  stroke-width: 4px;
}

.station-node.dimmed {
  opacity: 0.2;
}

.station-node.highlighted, .station-node.route-active {
  opacity: 1;
}

.station-node.route-active circle {
  fill: #f59e0b;
  stroke: #b45309;
  stroke-width: 3px;
  animation: pulseNode 1s infinite alternate;
}

@keyframes pulseNode {
  from { transform: scale(1); }
  to { transform: scale(1.4); }
}

.hub-ring-pulse {
  animation: pulseHubRing 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  transform-origin: center;
}

@keyframes pulseHubRing {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 0.2; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.station-svg-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  fill: #1e293b;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.9), 0 0 2px rgba(255, 255, 255, 1);
  pointer-events: none;
}

.station-svg-label.hub-label {
  font-size: 12.5px;
  font-weight: 800;
  fill: #0f172a;
}

/* Official Map Pan-Zoom Layer */
.panzoom-container {
  width: 100%;
  height: 100%;
  cursor: grab;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0f172a;
}

.official-map-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  will-change: transform;
  transition: transform 0.1s ease-out;
  pointer-events: none;
  user-select: none;
}

/* Floating Map Controls */
.map-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 10;
}

.map-ctrl-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease;
}

.map-ctrl-btn:hover {
  background: #f8fafc;
  color: var(--primary);
  transform: scale(1.05);
}

.map-ctrl-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.view-switch-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Map View Switcher Pill */
.map-view-switcher {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 0.35rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex;
  gap: 0.25rem;
  z-index: 10;
}

.view-switch-btn {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.813rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.view-switch-btn.active {
  background: var(--primary);
  color: white;
}

/* Facility Chips in Modal */
.facility-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.transfer-item, .nearby-item {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-main);
  list-style: none;
}

.transfer-item::before {
  content: '⇄';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 800;
}

.nearby-item::before {
  content: '📍';
  position: absolute;
  left: 0;
  font-size: 0.75rem;
}

@media (max-width: 768px) {
  .map-wrapper {
    height: 480px;
  }
  .map-view-switcher {
    left: 0.5rem;
    top: 0.5rem;
    scale: 0.9;
    transform-origin: top left;
  }
  .map-controls {
    right: 0.5rem;
    top: 0.5rem;
  }
}
