/* Map block: full width; legend overlays on the map. */
.travel-map-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 0 0;
}

.travel-map {
  width: 100%;
  /* Fill the box height; the outer page section decides viewport sizing. */
  height: 100%;
  max-height: none;
  min-height: 420px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #e8eef5;
}

@media (max-width: 768px) {
  .travel-map {
    height: 100%;
    min-height: 420px;
  }
}

/* Leaflet fills the box (avoids “map only on one side” when parent width settles late) */
.travel-map.leaflet-container,
#travel-map.leaflet-container {
  width: 100% !important;
  min-height: 420px;
}

/* Legend overlay (bottom-left) */
.travel-map-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 600;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.85rem;
  color: #1f2937;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(6px);
}

/*
 * Modal overlay. Important: do NOT set display:flex on the base selector — it overrides
 * the [hidden] attribute (browser default display:none), so the overlay stayed “open”
 * invisibly and blocked clicks (including Close).
 */
.travel-map-popup {
  position: fixed;
  inset: 0;
  z-index: 100000;
  padding: 1rem;
  box-sizing: border-box;
}

.travel-map-popup[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.travel-map-popup:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.travel-map-popup__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: rgba(15, 23, 42, 0.4);
  cursor: pointer;
}

.travel-map-popup__dialog {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: min(420px, 100%);
  max-height: min(72vh, 480px);
  border-radius: 12px;
  background: var(--global-bg-color, #fff);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.travel-map-popup__toolbar {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  padding: 0.4rem 0.4rem 0;
}

.travel-map-popup__close {
  position: relative;
  z-index: 3;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  color: #333;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.travel-map-popup__close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.travel-map-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 1.15rem 1.15rem;
  -webkit-overflow-scrolling: touch;
}

.travel-map-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  line-height: 1.3;
}

.travel-map-panel__meta {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.88rem;
  color: #666;
}

.travel-map-panel .travel-city-list {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.travel-map-panel p {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--global-text-color, #3a3a3a);
}

.travel-map-panel .travel-trip {
  margin: 0 0 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.travel-map-panel .travel-trip:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.travel-map-panel .travel-trip dt {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
  margin: 0 0 0.2rem;
}

.travel-map-panel .travel-trip dd {
  margin: 0;
  font-size: 0.95rem;
}

.travel-map-panel .travel-journals {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.travel-map-panel .travel-journals li {
  margin: 0.35rem 0 0;
}

.travel-map-panel .travel-journals a {
  text-decoration: none;
}

.travel-map-panel .travel-journals a:hover {
  text-decoration: underline;
}

.travel-map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.travel-map-legend i {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.travel-map-legend .swatch-visited {
  background: #2a6f97;
}

.travel-map-legend .swatch-other {
  background: #cfe2f3;
}

.travel-map-legend .swatch-city {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e63946;
  border: 1px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}
