/* ============================================================
   SEARCH PAGE MAP - Airbnb Style Side Map
   ============================================================ */

/* Two-column layout when map is visible */
.search-page__panel--stays-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0px;
  grid-template-rows: auto 1fr;
  gap: 0 0;
  align-items: start;
  /* No width/column transition: a 0-width window during the animation would
     break MapLibre's init (the map needs a sized container to fire 'load').
     The reveal is animated via the map-wrap's opacity/transform instead. */
}

.search-page__panel--stays-layout.has-map {
  grid-template-columns: minmax(0, 1fr) min(500px, 48%);
  gap: 0 24px;
}

/* Section heading spans both columns */
.search-page__panel--stays-layout .search-page__section-heading {
  grid-column: 1 / -1;
}

/* Cards area */
.search-page__cards-wrap {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

/* Map area */
.search-page__map-wrap {
  grid-column: 2;
  grid-row: 2;
  position: sticky;
  top: 100px;
  height: calc(100dvh - 120px);
  overflow: hidden;
  border-radius: 20px;
  background: #e8edf3;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  opacity: 0;
  transform: translateX(24px) scale(0.98);
  transition:
    opacity 0.4s cubic-bezier(0.22,1,0.36,1),
    transform 0.4s cubic-bezier(0.22,1,0.36,1);
  pointer-events: none;
  overflow: hidden;
  width: 0;
}

.search-page__panel--stays-layout.has-map .search-page__map-wrap {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  width: auto;
}

#searchPageMap {
  width: 100%;
  height: 100%;
}

/* Loading skeleton for map */
.search-page__map-wrap:before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #dde4ec 25%, #e8edf3 50%, #dde4ec 75%);
  background-size: 400% 400%;
  animation: searchMapSkeleton 2s ease infinite;
  z-index: 0;
  border-radius: inherit;
}

.search-page__map-wrap.is-loaded:before {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

@keyframes searchMapSkeleton {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Price markers on the search map.
   ROOT (.search-map__marker) is a bare positioning anchor — MapLibre owns
   its inline transform. All visuals + pop-in animation + hover live on the
   inner pill (.search-map__pill), or markers collapse to the map origin. */
.search-map__marker {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  line-height: 0;
}

.search-map__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 999px;
  background: #fff;
  color: #222;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.14);
  transition: transform 0.16s cubic-bezier(0.22,1,0.36,1), box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
  /* `backwards` (not `both`): a persisted `forwards`/`both` fill keeps the 100%
     keyframe's transform:scale(1) applied forever, which overrides the hover /
     selected scale(1.06). backwards only applies the entrance frame pre-start. */
  animation: searchMarkerPopIn 0.36s cubic-bezier(0.22,1,0.36,1) backwards;
  transform-origin: bottom center;
}

.search-map__marker:hover .search-map__pill,
.search-map__marker:focus-visible .search-map__pill {
  transform: scale(1.06);
  box-shadow: 0 2px 5px rgba(0,0,0,0.24), 0 6px 18px rgba(230,30,77,0.42);
}

.search-map__marker.is-selected {
  z-index: 10;
}

.search-map__marker.is-selected .search-map__pill {
  background: #222;
  color: #fff;
  border-color: #222;
  transform: scale(1.06);
}

/* Card hover -> its marker pops (Airbnb-style linked highlight) */
.search-map__marker.is-linked {
  z-index: 11;
}
.search-map__marker.is-linked .search-map__pill {
  background: #222;
  color: #fff;
  border-color: #222;
  transform: scale(1.14);
  box-shadow: 0 3px 8px rgba(0,0,0,0.3), 0 8px 22px rgba(0,0,0,0.26);
}

/* Marker hover -> its card is highlighted on the left */
.search-stay-card.is-map-hover {
  box-shadow: 0 0 0 2px #222 inset, 0 8px 24px rgba(0,0,0,0.14);
  border-radius: 16px;
  transition: box-shadow 0.16s ease;
}
:root[data-theme=night] .search-stay-card.is-map-hover {
  box-shadow: 0 0 0 2px #f0f6ff inset, 0 8px 24px rgba(0,0,0,0.4);
}

@keyframes searchMarkerPopIn {
  0%   { opacity: 0; transform: scale(0.5) translateY(8px); }
  70%  { transform: scale(1.06) translateY(-1px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* MapLibre controls */
.search-page__map-wrap .maplibregl-ctrl-top-right,
.search-page__map-wrap .maplibregl-ctrl-top-left,
.search-page__map-wrap .maplibregl-ctrl-bottom-right {
  display: none;
}

/* Dark mode */
:root[data-theme=night] .search-page__map-wrap {
  background: #0c1420;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

:root[data-theme=night] .search-page__map-wrap:before {
  background: linear-gradient(135deg, #0e1826 25%, #141f2e 50%, #0e1826 75%);
}

:root[data-theme=night] .search-map__pill {
  background: #1a2130;
  color: #f0f6ff;
  border-color: rgba(255,255,255,0.10);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

:root[data-theme=night] .search-map__marker.is-selected .search-map__pill {
  background: #f0f6ff;
  color: #111;
  border-color: #f0f6ff;
}

/* Mobile: hide side map, show below search (already full width) */
@media (max-width: 1000px) {
  .search-page__panel--stays-layout.has-map {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-page__map-wrap {
    display: none;
  }
}

/* TOP (Cribond host offer): the same orange pill as the home map. */
.search-map__marker--top {
  z-index: 5;
}

.search-map__marker--top:not(.is-selected) .search-map__pill {
  background: linear-gradient(90deg, #f5a524, #f97316);
  color: #fff;
  border-color: transparent;
}

/* Day and night: the same white pill as the globe; selected / linked to the
   hovered card = the Cribond pink (map-price-markers.css says why). */
.search-map__pill {
  border-color: rgba(0, 0, 0, 0.1);
}
:root[data-theme=night] .search-map__pill {
  background: #fff;
  color: #222;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55), 0 4px 14px rgba(0, 0, 0, 0.45);
}
.search-map__marker.is-selected .search-map__pill,
.search-map__marker.is-linked .search-map__pill,
:root[data-theme=night] .search-map__marker.is-selected .search-map__pill,
:root[data-theme=night] .search-map__marker.is-linked .search-map__pill {
  background: #e61e4d;
  color: #fff;
  border-color: #e61e4d;
}
.search-stay-card.is-map-hover,
:root[data-theme=night] .search-stay-card.is-map-hover {
  box-shadow: 0 0 0 2px #e61e4d inset, 0 8px 24px rgba(0, 0, 0, 0.18);
}
