/* css/map.css */

/* Map wrapper so we can overlay the control */
.map-wrap {
  position: relative;
}

/* Map */
#map-canvas {
  height: var(--map-h);
  width: 100%;
  background: var(--surface);
  position: relative; /* for modal overlay */
}

/* Fullscreen expand mode */
#map-canvas.is-expanded {
  position: relative;
  left: 50%;
  transform: translateX(-50%);

  width: 100vw;          /* fill viewport width */
  max-width: 100vw;

  height: calc(100vh - 120px);

  border-radius: 14px;
  border-left: none;
  border-right: none;

  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  z-index: 5;
}

/* Prevent page scroll when map is expanded */
body.map-expanded {
  overflow: hidden;
  height: 100%;
}

/* Floating map control */
.map-toggle--floating {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 10;
}

/* Keep it subtle + readable */
.map-toggle {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: rgba(255, 255, 255, 0.85);
  color: #111827;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}
.map-toggle:hover {
  background: rgba(255, 255, 255, 0.95);
}

@media (prefers-color-scheme: dark) {
  .map-toggle {
    background: rgba(17, 24, 39, 0.8);
    color: #e8eaf0;
  }
  .map-toggle:hover {
    background: rgba(17, 24, 39, 0.92);
  }
}

/* =========================
   LASSP custom InfoWindow
   Works for main map + mini map
   ========================= */

:root {
  --iw-bg: var(--surface);
  --iw-text: var(--page-text);
  --iw-border: var(--surface-border);
}

@media (prefers-color-scheme: dark) {
  :root {
    --iw-bg: #1c202a;
    --iw-text: #e8eaf0;
    --iw-border: rgba(255, 255, 255, 0.12);
  }
}

/* Remove Google default styling */
.gm-style .gm-style-iw-c {
  padding: 0 !important;
  background: transparent !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35) !important;
}

/* Prevent scroll container clipping */
.gm-style .gm-style-iw-d {
  overflow: hidden !important;
  max-height: none !important;
}

/* Hide Google close button */
.gm-style button.gm-ui-hover-effect {
  display: none !important;
}

/* Match pointer color */
.gm-style .gm-style-iw-tc::after {
  background: var(--iw-bg) !important;
}

/* 🚨 CRITICAL: override Google dark-mode text overrides */
.gm-style .gm-style-iw,
.gm-style .gm-style-iw *,
.gm-style .gm-style-iw-d,
.gm-style .gm-style-iw-d * {
  color: var(--iw-text) !important;
}

/* Panel */
.lassp-iw {
  background: var(--iw-bg);
  color: var(--iw-text);
  min-width: 240px;
  max-width: 320px;
  border-radius: 16px;
}

/* Header */
.lassp-iw__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--iw-border);
}

.lassp-iw__title {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
}

/* Close */
.lassp-iw__close {
  appearance: none;
  border: 0;
  background: transparent;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lassp-iw__close:hover {
  background: rgba(127, 127, 127, 0.15);
}

/* Body */
.lassp-iw__body {
  padding: 12px 14px 14px;
  font-size: 15px;
  line-height: 1.35;
}

.lassp-iw__body > div + div {
  margin-top: 6px;
}

/* =========================
   LASSP InfoWindow tables
   (reduces crowding)
   ========================= */

/* Slightly smaller + tighter for the "table" variant */
.lassp-iw__body table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;          /* key: stable columns */
  margin: 0;
  font-size: 14px;              /* down from body default */
  line-height: 1.25;
}

/* Column proportions: label / value / value */
.lassp-iw__body table td:first-child { width: 42%; }
.lassp-iw__body table td:nth-child(2) { width: 29%; }
.lassp-iw__body table td:nth-child(3) { width: 29%; }

.lassp-iw__body table td {
  padding: 6px 8px;
  vertical-align: top;
}

/* Make label column readable but compact */
.lassp-iw__body table td:first-child {
  font-weight: 650;
  opacity: 0.92;
  white-space: normal;
}

/* Numeric columns: right align + prevent ugly wraps */
.lassp-iw__body table td:nth-child(2),
.lassp-iw__body table td:nth-child(3) {
  text-align: right;
  white-space: nowrap;          /* keep "158,576,459 mi" together */
  font-variant-numeric: tabular-nums;
}

/* Row separation without making it busy */
.lassp-iw__body table tr + tr td {
  border-top: 1px solid var(--iw-border);
}

/* Give the description some breathing room (when present) */
.lassp-iw__body table + * {
  margin-top: 10px;
}

/* Keep the overall bubble from getting too wide */
.lassp-iw {
  max-width: 360px;             /* tweak as desired */
}

/* On small screens, let labels take more width */
@media (max-width: 520px) {
  .lassp-iw { max-width: 320px; }
  .lassp-iw__body table td:first-child { width: 48%; }
  .lassp-iw__body table td:nth-child(2),
  .lassp-iw__body table td:nth-child(3) { width: 26%; }
}

/* If any cell content is still too long, allow graceful clipping */
.lassp-iw__body table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================
   Enable scrolling in InfoWindow
   ========================= */

/* Allow the Google wrapper to scroll */
.gm-style .gm-style-iw-d {
  overflow-y: auto !important;
  overflow-x: hidden;
  max-height: 260px; /* prevents bubble from growing too tall */
  padding-right: 4px; /* avoids scrollbar overlap */
}

/* Make our content respect the height */
.lassp-iw__body {
  max-height: 220px;
  overflow-y: auto;
}

/* Improve scrollbar appearance (optional but nice) */
.lassp-iw__body::-webkit-scrollbar,
.gm-style .gm-style-iw-d::-webkit-scrollbar {
  width: 8px;
}

.lassp-iw__body::-webkit-scrollbar-thumb,
.gm-style .gm-style-iw-d::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
}

@media (prefers-color-scheme: dark) {
  .lassp-iw__body::-webkit-scrollbar-thumb,
  .gm-style .gm-style-iw-d::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.25);
  }
}