/* ===== RESET & CSS VARIABLES ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #F5F0E8;
  --bg-surface: #EDE8DE;
  --bg-elevated: #E5DFD5;
  --together: #C0392B;
  --ryan: #4A90D9;
  --becca: #8E44AD;
  --text: #2C1A1A;
  --text-muted: #7A5C5C;
  --border: rgba(0,0,0,0.1);
}

/* ===== BODY ===== */
body {
  background: #F5F0E8;
  color: #2C1A1A;
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  overflow: hidden;
}

/* ===== NAVIGATION ===== */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 52px;
  background: rgba(245,240,232,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
}

.nav-brand {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  font-weight: 700;
  color: #8B1A1A;
  letter-spacing: 0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  background: none;
  border: none;
  color: #2C1A1A;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: background 0.15s;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(0,0,0,0.07);
}

.nav-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #F5F0E8;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 220px;
  max-height: 70vh;
  overflow-y: auto;
  display: none;
  z-index: 200;
}

.dropdown-menu.open {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 0.6rem 1rem;
  text-align: left;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: #2C1A1A;
  cursor: pointer;
  transition: background 0.12s;
}

.dropdown-item:hover {
  background: rgba(0,0,0,0.05);
}

.dropdown-item .dropdown-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* ===== MAP PAGE ===== */
#map-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: 52px;
  padding-bottom: 48px;
}

#map-page.hidden {
  display: none;
}

.map-title {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  color: #8B1A1A;
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 3rem);
  padding: 0.5rem 1rem 0.25rem;
  line-height: 1.1;
  flex-shrink: 0;
}

#world-map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#world-map-svg {
  width: 100%;
  height: 100%;
  cursor: grab;
  display: block;
}

#world-map-svg:active {
  cursor: grabbing;
}

/* ===== MAP COUNTRIES ===== */
.country {
  fill: #C8D5B5;
  stroke: #9aaa8a;
  stroke-width: 0.4;
  transition: fill 0.15s;
}

.country.visited {
  fill: #7DB87D;
}

.country:hover {
  fill: #9dd49d;
}

/* ===== MAP PINS ===== */
.map-pin {
  cursor: pointer;
  transform-origin: center;
  transition: transform 0.2s;
}

.map-pin:hover {
  transform: scale(1.4);
}

/* ===== CITY DOTS ===== */
.city-dot {
  cursor: pointer;
}

.city-dot:hover circle {
  filter: brightness(1.3);
}

/* ===== TRIP LINES (ZOOMED ONLY) ===== */
.trip-line-zoomed {
  fill: none;
  stroke-width: 1.8;
  stroke-dasharray: 6 4;
  opacity: 0.75;
  pointer-events: none;
}

.trip-line-zoomed.both {
  stroke: #C0392B;
}

.trip-line-zoomed.ryan {
  stroke: #4A90D9;
}

.trip-line-zoomed.becca {
  stroke: #8E44AD;
}

.trip-line-zoomed.mixed {
  stroke: #C0392B;
}

/* ===== MAP TOOLTIP ===== */
#map-tooltip {
  position: fixed;
  background: #F5F0E8;
  border: 1px solid rgba(0,0,0,0.12);
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  border-radius: 8px;
  font-size: 0.82rem;
  pointer-events: none;
  z-index: 300;
  white-space: nowrap;
  padding: 0.4rem 0.65rem;
  opacity: 0;
  transition: opacity 0.12s;
}

#map-tooltip.visible {
  opacity: 1;
}

.tt-name {
  font-weight: 600;
  color: #2C1A1A;
}

.tt-sub {
  color: #7A5C5C;
  font-size: 0.78rem;
  margin-top: 0.1rem;
}

/* ===== ZOOM BACK BUTTON ===== */
#zoom-back {
  position: fixed;
  top: 68px;
  left: 1.5rem;
  z-index: 60;
  background: #F5F0E8;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: #2C1A1A;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: background 0.15s;
}

#zoom-back:hover {
  background: #EDE8DE;
}

#zoom-back.visible {
  display: flex;
}

/* ===== TRIP INFO PANEL ===== */
.trip-info-panel {
  position: fixed;
  top: 68px;
  right: 1.5rem;
  z-index: 60;
  background: #F5F0E8;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  max-width: 260px;
  display: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.trip-info-panel.visible {
  display: block;
}

.trip-info-panel .panel-trip-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: #2C1A1A;
}

.panel-date {
  font-size: 0.78rem;
  color: #7A5C5C;
  margin-bottom: 0.2rem;
}

.panel-hint {
  font-size: 0.78rem;
  color: #7A5C5C;
  margin-top: 0.15rem;
}

.panel-note-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(192,57,43,0.1);
  border: 1px solid rgba(192,57,43,0.25);
  color: #C0392B;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  margin-top: 0.5rem;
}

.panel-legend {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.panel-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #2C1A1A;
}

.panel-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== STATS BAR ===== */
#stats-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(245,240,232,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(0,0,0,0.1);
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.5rem 1rem;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #C0392B;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.7rem;
  color: #7A5C5C;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== MAP LEGEND ===== */
.map-legend {
  position: fixed;
  bottom: 3.5rem;
  left: 1rem;
  z-index: 50;
  background: #F5F0E8;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #2C1A1A;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot.together {
  background: #C0392B;
}

.legend-dot.ryan {
  background: #4A90D9;
}

.legend-dot.becca {
  background: #8E44AD;
}

.legend-dot.home {
  background: transparent;
  border: 2px solid #C0392B;
}

/* ===== PHOTO MODAL ===== */
#photo-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(245,240,232,0.97);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#photo-modal.open {
  display: flex;
}

.modal-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.modal-title {
  font-family: 'Caveat', cursive;
  font-size: 1.8rem;
  font-weight: 700;
  color: #8B1A1A;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: #7A5C5C;
  margin-top: 0.2rem;
}

.modal-close {
  background: none;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
  color: #2C1A1A;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.modal-close:hover {
  background: rgba(0,0,0,0.06);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  overflow-y: auto;
  flex: 1;
}

.photo-thumb {
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  background: #EDE8DE;
}

.photo-thumb:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}

.photo-empty {
  text-align: center;
  color: #7A5C5C;
  padding: 3rem 1rem;
  font-size: 0.9rem;
}

/* ===== LIGHTBOX ===== */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0,0,0,0.92);
  display: none;
  align-items: center;
  justify-content: center;
}

#lightbox.open {
  display: flex;
}

#lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: white;
  font-size: 1.6rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: background 0.15s;
}

.lightbox-nav:hover {
  background: rgba(255,255,255,0.28);
}

.lightbox-nav.prev {
  left: 1rem;
}

.lightbox-nav.next {
  right: 1rem;
}

/* ===== TRIP DISAMBIGUATION MODAL ===== */
#trip-select-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
}

#trip-select-modal.open {
  display: flex;
}

.trip-select-box {
  background: #F5F0E8;
  border-radius: 14px;
  padding: 1.5rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.trip-select-box h3 {
  font-family: 'Caveat', cursive;
  color: #8B1A1A;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.trip-select-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background 0.12s;
}

.trip-select-card:hover {
  background: rgba(0,0,0,0.04);
}

.trip-select-cancel {
  margin-top: 0.5rem;
  width: 100%;
  padding: 0.5rem;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  color: #7A5C5C;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  transition: background 0.12s;
}

.trip-select-cancel:hover {
  background: rgba(0,0,0,0.04);
}

/* ===== TRIPS PAGE ===== */
#trips-page {
  background: #F5F0E8;
  padding-top: 52px;
  display: none;
  min-height: 100vh;
  overflow-y: auto;
  padding-bottom: 60px;
}

#trips-page.active {
  display: block;
}

.trips-hero {
  background: #EDE8DE;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
}

.trips-hero-title {
  font-family: 'Caveat', cursive;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  color: #8B1A1A;
}

.trips-hero-sub {
  font-size: 0.95rem;
  color: #7A5C5C;
  margin-top: 0.4rem;
}

.trips-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ===== TRIP CARDS ===== */
.trip-card {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 3rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  background: #F5F0E8;
  border: 1px solid rgba(0,0,0,0.07);
}

.trip-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.trip-card-header.both {
  background: rgba(192,57,43,0.06);
  border-left: 4px solid #C0392B;
}

.trip-card-header.ryan {
  background: rgba(74,144,217,0.06);
  border-left: 4px solid #4A90D9;
}

.trip-card-header.becca {
  background: rgba(142,68,173,0.06);
  border-left: 4px solid #8E44AD;
}

.trip-card-header.mixed {
  background: rgba(192,57,43,0.04);
  border-left: 4px solid #C0392B;
}

.trip-card-name {
  font-family: 'Caveat', cursive;
  font-size: 1.35rem;
  font-weight: 700;
  color: #2C1A1A;
  margin-bottom: 0.15rem;
}

.trip-card-date {
  font-size: 0.82rem;
  color: #7A5C5C;
}

.special-note-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(192,57,43,0.1);
  color: #C0392B;
  border: 1px solid rgba(192,57,43,0.25);
  border-radius: 20px;
  font-size: 0.78rem;
  padding: 0.25rem 0.75rem;
  margin-top: 0.5rem;
}

.trip-card-body {
  background: #F5F0E8;
  padding: 1.25rem 1.5rem;
}

.trip-card-cities {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.city-chip {
  background: #EDE8DE;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 20px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  color: #2C1A1A;
  cursor: pointer;
  transition: background 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.city-chip:hover {
  background: #E5DFD5;
}

.city-chip .chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.trip-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.trip-photo-thumb {
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.15s;
  background: #EDE8DE;
}

.trip-photo-thumb:hover {
  transform: scale(1.04);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 640px) {
  .nav-brand {
    font-size: 1.1rem;
  }

  .map-title {
    font-size: 1.4rem;
    padding: 0.3rem 0.75rem 0.1rem;
  }

  #stats-bar {
    gap: 1.25rem;
  }

  .stat-value {
    font-size: 1.1rem;
  }

  .trip-info-panel {
    max-width: 200px;
    right: 0.75rem;
    top: 62px;
    padding: 0.75rem 1rem;
  }

  #zoom-back {
    top: 62px;
    left: 0.75rem;
  }

  .map-legend {
    bottom: 3.2rem;
    left: 0.75rem;
    padding: 0.4rem 0.65rem;
  }

  .trips-content {
    padding: 1.25rem 1rem;
  }

  .trip-card-header,
  .trip-card-body {
    padding: 1rem 1.1rem;
  }
}

@media (max-width: 420px) {
  .site-nav {
    padding: 0 0.75rem;
  }

  .nav-brand {
    font-size: 0.95rem;
  }

  .stat-value {
    font-size: 1rem;
  }

  .stat-label {
    font-size: 0.62rem;
  }

  #stats-bar {
    gap: 0.9rem;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  .trip-photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
}
