/* ==========================================================================
   Global Travel Globe & AI Itinerary Planner — Custom Styles
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.7);
}

::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.7);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.75);
}

.scrollbar-none::-webkit-scrollbar {
  display: none;
}
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Globe Container Starfield & Strict Stacking Context Isolation */
#globe-stage-column {
  isolation: isolate;
  z-index: 10;
}

#globe-viewport {
  background: radial-gradient(circle at 50% 50%, #0b192c 0%, #050b14 58%, #020409 100%);
  position: relative;
  isolation: isolate;
  z-index: 1;
}

#destination-modal {
  z-index: 999999 !important;
}

/* Completely hide 3D globe / 2D map floating markers when destination modal is open */
body.modal-open .globe-pin-wrapper,
body.modal-open .globe-pin-origin,
body.modal-open .leaflet-marker-pane,
body.modal-open .leaflet-popup-pane {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#globe-viewport::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,0.65) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 28% 72%, rgba(125,211,252,0.55) 50%, transparent 100%),
    radial-gradient(1px 1px at 64% 22%, rgba(255,255,255,0.5) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 82% 48%, rgba(16,185,129,0.5) 50%, transparent 100%),
    radial-gradient(1px 1px at 43% 85%, rgba(255,255,255,0.6) 50%, transparent 100%),
    radial-gradient(1px 1px at 91% 14%, rgba(255,255,255,0.5) 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 18% 54%, rgba(255,255,255,0.4) 50%, transparent 100%);
  opacity: 0.75;
  z-index: 1;
}

/* Floating 3D Globe HTML Pin Markers */
.globe-pin-wrapper {
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  transform: translate(-50%, -100%);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
}

.globe-pin-wrapper:hover {
  transform: translate(-50%, -106%) scale(1.08);
  z-index: 99999 !important;
}

.globe-pin-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 8px;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.85), 0 0 14px rgba(56, 189, 248, 0.4);
  border: 1px solid rgba(56, 189, 248, 0.6);
  background: rgba(5, 15, 29, 0.94);
  color: #f8fafc;
  min-width: 104px;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.globe-pin-details {
  display: none;
}

.globe-pin-wrapper:hover .globe-pin-details,
.globe-pin-card.pin-selected .globe-pin-details {
  display: flex;
}

.globe-pin-card.pin-selected {
  border-color: #f97316;
  background: rgba(12, 23, 42, 0.98);
  box-shadow: 0 0 28px rgba(249, 115, 22, 0.8), 0 8px 24px rgba(0,0,0,0.9);
}

.globe-pin-card.pin-over-budget {
  border-color: rgba(245, 158, 11, 0.65);
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.75), 0 0 12px rgba(245, 158, 11, 0.3);
}

.globe-pin-stem {
  width: 2px;
  height: 8px;
  margin: 0 auto;
  background: linear-gradient(to bottom, #38bdf8, transparent);
}

.globe-pin-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  margin: -2px auto 0;
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8, 0 0 20px #0284c7;
  animation: pulseGlow 2s infinite ease-in-out;
}

.globe-pin-dot.dot-amber {
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b, 0 0 18px #fbbf24;
}

.globe-pin-origin {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(3, 105, 161, 0.95);
  border: 1.5px solid #38bdf8;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.85);
  white-space: nowrap;
}

/* Ultra-Compact 2D Map Pill Markers (Name + Price Only, Small Font) */
.map2d-pin-wrapper {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -100%);
  cursor: pointer;
  user-select: none;
  transition: transform 0.14s ease;
}

.map2d-pin-wrapper:hover {
  transform: translate(-50%, -105%) scale(1.12);
  z-index: 99999 !important;
}

.map2d-pin-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1.5px 5px;
  border-radius: 5px;
  background: rgba(6, 20, 34, 0.88);
  border: 1px solid rgba(16, 185, 129, 0.75);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
  font-size: 9px;
  line-height: 1.15;
  white-space: nowrap;
  color: #f8fafc;
}

.map2d-pin-pill.pin-over-budget {
  border-color: rgba(245, 158, 11, 0.75);
}

.map2d-pin-name {
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.01em;
}

.map2d-pin-price {
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
  color: #34d399;
}

.map2d-pin-pill.pin-over-budget .map2d-pin-price {
  color: #fbbf24;
}

.map2d-pin-dot {
  width: 5px;
  height: 5px;
  border-radius: 9999px;
  margin-top: 1px;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.map2d-pin-dot.dot-amber {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

.map2d-origin-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(30, 58, 138, 0.92);
  border: 1px solid #60a5fa;
  color: #eff6ff;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.65);
  transform: translate(-50%, -50%);
}

@keyframes pulseGlow {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.45);
    opacity: 0.78;
  }
}

/* Range Input Styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid #334155;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #38bdf8;
  border: 2px solid #0f172a;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  margin-top: -6px;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #7dd3fc;
}

/* Leaflet 2D Map Custom Dark Overrides */
.leaflet-container {
  background: #060d18 !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
}

/* Custom Range Slider with Sunset Gradient */
.sunset-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #f97316 0%, #ec4899 50%, #1e293b 50%);
  outline: none;
}

.sunset-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: #ffffff;
  border: 3px solid #ec4899;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.6);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sunset-slider::-webkit-slider-thumb:hover {
  transform: scale(1.18);
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.8);
}

.sunset-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: #ffffff;
  border: 3px solid #ec4899;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.6);
  cursor: pointer;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7) !important;
}

/* Custom Select styling to prevent OS default white popup background & clipping */
select option,
select optgroup {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

select optgroup {
  font-weight: 700;
  color: #fb923c !important;
}

/* Print Friendly Itinerary */
@media print {
  body {
    background: #ffffff !important;
    color: #0f172a !important;
    overflow: visible !important;
    height: auto !important;
  }
  header,
  #left-filter-panel,
  #globe-stage-column,
  #right-matches-column,
  #mobile-bottom-nav,
  .no-print {
    display: none !important;
  }
  #destination-modal {
    position: static !important;
    display: block !important;
    background: #ffffff !important;
    padding: 0 !important;
  }
  #destination-modal-card {
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }
}

/* ==========================================================================
   Responsive Mobile-First Bottom Nav & Drawer Layout
   ========================================================================== */
@media (max-width: 1023px) {
  /* On mobile / small tablet, left filter and right picks panels act as full-screen slide-up drawers */
  body.mobile-mode #left-filter-panel,
  body:not(.desktop-forced) #left-filter-panel {
    position: absolute;
    inset: 0;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 40;
    padding-bottom: 120px !important; /* Extra bottom breathing room for iPhone 15 / modern safe area */
    background: rgba(11, 19, 36, 0.98);
    backdrop-filter: blur(16px);
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body.mobile-mode #right-matches-column,
  body:not(.desktop-forced) #right-matches-column {
    position: absolute;
    inset: 0;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 40;
    padding-bottom: 120px !important;
    background: rgba(11, 19, 36, 0.98);
    backdrop-filter: blur(16px);
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* When hidden via setMobileTab or inline style, enforce hiding */
  body:not(.desktop-forced) #left-filter-panel.mobile-hidden,
  body:not(.desktop-forced) #right-matches-column.mobile-hidden {
    display: none !important;
  }

  /* When desktop mode is forced on mobile via toggle, allow horizontal scrolling of the 3 columns */
  body.desktop-forced .main-workspace-container {
    overflow-x: auto !important;
    min-width: 1100px !important;
  }
  body.desktop-forced #mobile-bottom-nav {
    display: none !important;
  }
}

/* Bottom navigation bar safe padding for modern notched phones (iPhone 15 dynamic island / home indicator) */
#mobile-bottom-nav {
  padding-bottom: max(0.85rem, env(safe-area-inset-bottom, 24px));
}
