/* ============================================
   Waittime Map — Park Map Visualization
   ============================================ */

.map-header {
  text-align: center;
  padding: 48px 0 24px;
}
.map-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 8px;
}
.map-update {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-family: "Inter", sans-serif;
}
.map-update .live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4caf50;
  margin-right: 4px;
  animation: mapPulse 2s infinite;
}
@keyframes mapPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.map-update--error {
  color: #c44;
  font-weight: 500;
  padding: 6px 12px;
  background: #fff5f5;
  border: 1px solid #f0d0d0;
  border-radius: 6px;
  display: inline-block;
}

/* Park Switch Tabs */
.map-park-switch {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 20px;
}
.map-tab {
  padding: 10px 28px;
  min-height: 44px;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.2s ease;
}
.map-tab:first-child {
  border-radius: 8px 0 0 8px;
}
.map-tab:last-child {
  border-radius: 0 8px 8px 0;
  border-left: none;
}
.map-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.map-tab:hover:not(.active) {
  background: var(--surface);
}

/* Legend */
.map-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 10px 16px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border-light);
}
.map-legend-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-sub);
  margin-right: 4px;
}
.map-legend-items {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.map-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-sub);
  white-space: nowrap;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Map Container */
.map-container {
  position: relative;
  max-width: 600px;
  margin: 0 auto 32px;
}

.park-map {
  position: relative;
  width: 100%;
}

.park-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Area backgrounds */
.area-bg {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 1;
  transition: fill 0.3s ease;
}
.area-bg:hover {
  fill: var(--accent-soft);
}

.area-label {
  font-size: 11px;
  fill: var(--text-muted);
  text-anchor: middle;
  pointer-events: none;
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 400;
}
.area-label--sm {
  font-size: 9px;
}

.entrance-label {
  font-size: 10px;
  fill: var(--text-muted);
  text-anchor: middle;
  font-family: "Noto Sans JP", sans-serif;
}

/* Pins overlay */
.map-pins {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-pin {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  transform: translate(-50%, -50%);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 2;
}
.map-pin:hover,
.map-pin:focus {
  transform: translate(-50%, -50%) scale(1.4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  z-index: 10;
}
.map-pin--closed {
  opacity: 0.5;
}

/* Pin wait time label (visible on desktop) */
.map-pin-label {
  position: absolute;
  top: 50%;
  left: calc(100% + 4px);
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  font-family: "Inter", sans-serif;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff;
}

/* Popup */
.map-popup {
  position: absolute;
  z-index: 100;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  padding: 12px 16px;
  min-width: 180px;
  max-width: 240px;
  pointer-events: auto;
  transform: translate(-50%, calc(-100% - 16px));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.map-popup.visible {
  opacity: 1;
  visibility: visible;
}
.map-popup::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: var(--card);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.popup-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.4;
}
.popup-area {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.popup-wait {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1;
}
.popup-wait small {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-sub);
}
.popup-status {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* No data */
.map-nodata {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.88rem;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border-light);
  margin-bottom: 32px;
}
.map-nodata p {
  margin-bottom: 8px;
}

/* Section */
.map-section {
  margin-bottom: 40px;
}
.map-section-title {
  font-family: "Noto Sans JP", sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

/* Area summary */
.area-summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.area-summary-row:last-child {
  border-bottom: none;
}
.area-summary-name {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 400;
  min-width: 0;
}
.area-summary-avg {
  font-size: 0.9rem;
  font-weight: 600;
  font-family: "Inter", sans-serif;
  min-width: 60px;
  text-align: right;
}
.area-summary-avg small {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-sub);
}
.area-summary-bar-wrap {
  width: 100px;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.area-summary-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* Note */
.map-note {
  padding: 24px 0 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* ── Mobile adjustments ── */
@media (max-width: 600px) {
  .map-header {
    padding: 32px 0 16px;
  }
  .map-tab {
    padding: 10px 20px;
    font-size: 0.82rem;
  }
  .map-legend {
    padding: 8px 12px;
    gap: 6px;
  }
  .map-legend-item {
    font-size: 0.66rem;
  }
  .legend-dot {
    width: 8px;
    height: 8px;
  }
  .map-pin {
    width: 14px;
    height: 14px;
    border-width: 1.5px;
  }
  .map-pin-label {
    font-size: 8px;
  }
  .map-popup {
    min-width: 150px;
    padding: 10px 12px;
  }
  .popup-name {
    font-size: 0.78rem;
  }
  .area-summary-bar-wrap {
    width: 70px;
  }
  .area-summary-name {
    font-size: 0.78rem;
  }
}

@media (max-width: 400px) {
  .map-pin-label {
    display: none;
  }
  .map-legend-items {
    gap: 6px;
  }
}
