/* ===== Map page — CondoNow-style sidebar + fullscreen map ===== */

.page-map main { padding: 0; }

.map-page {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - 72px); /* below sticky nav */
  min-height: 640px;
  background: #f5f5f7;
}

/* ---- Sidebar ---- */
.map-sidebar {
  background: #ffffff;
  border-right: 1px solid #e5e5ea;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-sidebar-head {
  padding: 28px 24px 20px;
  border-bottom: 1px solid #f0f0f2;
}
.map-title {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: #1d1d1f;
}
.map-subtitle {
  font-size: 14px;
  color: #6e6e73;
  margin: 0;
  line-height: 1.45;
}

/* ---- Filters ---- */
.map-filters {
  padding: 16px 24px 20px;
  border-bottom: 1px solid #f0f0f2;
  overflow-y: auto;
  max-height: 50%;
}

.map-filter {
  margin-bottom: 14px;
}
.map-filter:last-child { margin-bottom: 0; }

.map-filter label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #6e6e73;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.map-filter input[type="search"],
.map-filter input[type="number"],
.map-filter select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  color: #1d1d1f;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.map-filter input:focus,
.map-filter select:focus {
  outline: none;
  border-color: #2d7cf1;
  box-shadow: 0 0 0 3px rgba(45,124,241,0.16);
}

.chip-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  padding: 7px 14px;
  border: 1px solid #d2d2d7;
  background: #ffffff;
  border-radius: 980px;
  font-size: 13px;
  font-weight: 500;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { border-color: #86868b; }
.chip.is-on {
  background: #1d1d1f;
  border-color: #1d1d1f;
  color: #ffffff;
}

.price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.price-row span { color: #86868b; font-weight: 500; }

.map-filter--actions { margin-top: 4px; }
.map-filter--actions .btn { width: 100%; }

/* ---- Results list ---- */
.map-results {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.map-results-head {
  display: flex;
  gap: 4px;
  padding: 14px 24px;
  font-size: 13px;
  font-weight: 600;
  color: #6e6e73;
  border-bottom: 1px solid #f0f0f2;
  background: #fafafa;
}
#result-count { color: #1d1d1f; }

.map-results-list {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid #f5f5f7;
  cursor: pointer;
  transition: background 0.12s ease;
}
.result-card:hover { background: #fafafa; }
.result-card.is-active { background: #eaf2ff; }

.result-thumb {
  width: 88px;
  height: 72px;
  border-radius: 10px;
  background: #f0f0f2 center/cover no-repeat;
  flex-shrink: 0;
}

.result-body { min-width: 0; }
.result-name {
  font-size: 14px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-meta {
  font-size: 12px;
  color: #6e6e73;
  margin: 0 0 4px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-price {
  font-size: 13px;
  font-weight: 600;
  color: #2d7cf1;
}
.result-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: #6e6e73;
  background: #f5f5f7;
  padding: 2px 8px;
  border-radius: 980px;
  margin-left: 6px;
  text-transform: capitalize;
}
.result-status--now { color: #1d7a3f; background: #e6f5ec; }
.result-status--hot { color: #c41f1f; background: #fde8e8; }

/* ---- Map canvas ---- */
.map-surface {
  position: relative;
  overflow: hidden;
}
.map-canvas {
  width: 100%;
  height: 100%;
  background: #e5e5ea;
}

.map-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #1d1d1f;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  display: flex;
  gap: 14px;
  z-index: 400;
}
.map-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.map-legend .dot--homes { background: #2d7cf1; }
.map-legend .dot--condos { background: #0a3d8a; }
.map-legend .dot--hot { background: #e04a4a; }

/* ---- Custom AAH pins ---- */
.aah-pin {
  background: none !important;
  border: none !important;
}
.aah-pin-inner {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: #2d7cf1;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.aah-pin--condos .aah-pin-inner { background: #0a3d8a; }
.aah-pin--hot .aah-pin-inner { background: #e04a4a; }
.aah-pin-inner:hover {
  transform: rotate(-45deg) scale(1.15);
}

/* ---- Leaflet popup override ---- */
.leaflet-popup-content-wrapper {
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
.leaflet-popup-content {
  margin: 0;
  min-width: 260px;
}
.popup-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 14px 14px 0 0;
  display: block;
  background: #f0f0f2;
}
.popup-body { padding: 14px 16px 16px; }
.popup-title {
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 0 0 4px;
}
.popup-meta {
  font-size: 12px;
  color: #6e6e73;
  margin: 0 0 8px;
}
.popup-price {
  font-size: 14px;
  font-weight: 600;
  color: #2d7cf1;
  margin: 0 0 10px;
}
.popup-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: #2d7cf1;
  text-decoration: none;
}
.popup-link:hover { text-decoration: underline; }

/* ---- Mobile popup sizing: keep card + hero image inside viewport ---- */
@media (max-width: 600px) {
  .leaflet-popup-content-wrapper { max-width: calc(100vw - 40px); }
  .leaflet-popup-content {
    min-width: 0;
    max-width: calc(100vw - 60px);
    width: auto !important;
  }
  .popup-card img { height: 110px; }
  .popup-body { padding: 12px 14px 14px; }
  .popup-title { font-size: 15px; }
}

/* ---- Gesture overlay (mobile two-finger hint) ---- */
.map-gesture-overlay {
  position: absolute;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(29, 29, 31, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.map-gesture-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.map-gesture-overlay span {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 22px;
  background: rgba(0,0,0,0.5);
  border-radius: 980px;
}

/* ---- Mobile ---- */
@media (max-width: 860px) {
  .map-page {
    grid-template-columns: 1fr;
    height: auto;
  }
  .map-sidebar {
    max-height: 60vh;
    border-right: none;
    border-bottom: 1px solid #e5e5ea;
  }
  .map-surface {
    height: 70vh;
    min-height: 480px;
  }
  .map-canvas {
    touch-action: pan-y;
  }
  .map-filters { max-height: none; }
}
