/* ============================================================================
   "Show on map" popup (_HotelMapModal.cshtml) - the map itself is rendered by
   Google Maps (wwwroot/js/search/hotelMap.js), everything else here is layout/chrome
   for the modal and its side panel.

   .cph-map__list holds exactly ONE hotel card at a time (whichever pin is
   currently selected - hotelSearch.js's focusedMapHotel) despite the name, kept
   from when it held a scrollable list of every hotel; the class name stuck
   because the layout (narrow column, right of the map, scrollable if the one
   card is tall) didn't need to change when that did.

   Scoped the same way HotelSearchResultCards.css already scopes the card itself:
   every selector here is either ".cph-map-*"/".cph-modal*" (shared with that
   file's modal chrome, loaded first) or a descendant of ".cph-map-modal", so
   this can't collide with anything else on the page. The side panel reuses
   .cph-card verbatim (_HotelCard.cshtml, unmodified) - the overrides below just
   force it into its own narrow/stacked layout (the same one
   HotelSearchResultCards.css already switches to under 860px viewport width)
   regardless of actual viewport width, since this column is always narrow even
   on a wide desktop screen.
   ============================================================================ */

.cph-map-modal .modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.cph-map-modal .cph-modal__head {
  flex: 0 0 auto;
}

.cph-map__layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 0; /* let the children scroll instead of overflowing the modal */
  overflow: hidden;
}

.cph-map__canvas {
  flex: 1 1 58%;
  min-width: 0;
  height: 100%;
  background: #e7f2f2;
}

.cph-map__list {
  flex: 0 0 42%;
  max-width: 480px;
  min-width: 320px;
  overflow-y: auto;
  padding: 16px;
  border-left: 1px solid var(--cph-border, #d8e0e0);
  background: #f7fafa;
}

.cph-map__empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--cph-text-muted, #707070);
  font-family: "Lato", "Segoe UI", sans-serif;
  text-align: center;
}

@media (max-width: 860px) {
  .cph-map__layout {
    flex-direction: column;
  }

  .cph-map__canvas {
    flex: 0 0 42vh;
  }

  .cph-map__list {
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
    border-left: 0;
    border-top: 1px solid var(--cph-border, #d8e0e0);
  }
}

/* ---- Force the reused .cph-card into its narrow/stacked layout inside the side list ---- */

.cph-map__list .cph-card {
  grid-template-columns: 1fr;
  min-height: 0;
  margin-bottom: 16px;
}

.cph-map__list .cph-card__media,
.cph-map__list .cph-card__media img {
  min-height: 168px;
  height: 168px;
}

.cph-map__list .cph-card__body {
  padding: 14px;
  border-right: 0;
}

.cph-map__list .cph-card__top {
  flex-direction: column;
}

.cph-map__list .cph-ta {
  align-items: flex-start;
  text-align: left;
}

.cph-map__list .cph-card__name {
  font-size: 18px;
}

.cph-map__list .cph-flight {
  grid-template-columns: 1fr;
}

.cph-map__list .cph-flight__col--end {
  text-align: left;
}

.cph-map__list .cph-flight__path {
  justify-content: flex-start;
}

.cph-map__list .cph-card__aside {
  grid-column: 1 / -1;
  border-top: 1px solid var(--cph-border, #d8e0e0);
}

.cph-map__list .cph-card__aside .cph-btn {
  width: 100%;
  margin-top: 12px;
}

/* ---- Google Maps price-bubble markers (custom OverlayView, hotelMap.js) ---- */
/* The wrapper is positioned at the hotel's exact pixel coordinate by hotelMap.js's draw() -
   .cph-map-pin's translate(-50%, -100%) is what anchors the bubble's bottom point (not its
   box) to that coordinate. */
.cph-map-pin-wrap {
  position: absolute;
  width: 0;
  height: 0;
  overflow: visible;
}

.cph-map-pin {
  position: relative;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  background: #fff;
  color: var(--cph-primary-deep, #104443);
  font-family: "Lato", "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  border: 2px solid var(--cph-primary, #02aaa9);
  box-shadow: 0 2px 8px rgba(16, 68, 67, 0.25);
  transform: translate(-50%, -100%);
  cursor: pointer;
}

.cph-map-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: inherit;
  border-right: 2px solid var(--cph-primary, #02aaa9);
  border-bottom: 2px solid var(--cph-primary, #02aaa9);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 0 0 2px 0;
}

.cph-map-pin small {
  font-weight: 600;
}

.cph-map-pin.is-active,
.cph-map-pin:hover {
  background: var(--cph-primary, #02aaa9);
  color: #fff;
  z-index: 1000;
}

/* ---- Filter sidebar "Show on map" teaser (HotelSearchResult.cshtml) ---- */
/* Thumbnail map (CphHotelMap.preview(), non-interactive) with the button centred on top. */
.cph-map-teaser {
  position: relative;
  flex-shrink: 0;
  height: 150px;
  margin-bottom: 16px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--cph-border, #d8e0e0);
  background: #e7f2f2 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 20h40M20 0v40' stroke='%23d4e6e6' stroke-width='2'/%3E%3C/svg%3E");
}

.cph-map-teaser__map {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cph-map-teaser__btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 0;
  border-radius: 6px;
  background: var(--cph-primary, #02aaa9);
  color: #fff;
  font-family: "Lato", "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(16, 68, 67, 0.3);
  cursor: pointer;
  z-index: 1;
}

.cph-map-teaser__btn svg {
  width: 18px;
  height: 18px;
}

.cph-map-teaser__btn:hover,
.cph-map-teaser__btn:focus-visible {
  background: var(--cph-primary-deep, #104443);
}

/* ---- Pin hover card (hotelMap.js's HoverCard overlay, HTML from hotelSearch.js's
   getMapPopupHtml) - a compact take on .cph-card (HotelSearchResultCards.css): same tokens,
   type and price treatment. hotelMap.js positions it with an inline transform and points the
   arrow at the pin via --arrow-x; .is-below when it has flipped under the pin. ---- */
.cph-map-pop-wrap {
  position: absolute;
  width: 0;
  height: 0;
  z-index: 3000;
}

.cph-map-pop {
  --arrow-x: 50%;
  position: absolute;
  left: 0;
  top: 0;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  width: 340px;
  background: #fff;
  border: 1px solid var(--cph-border, #d8e0e0);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16, 68, 67, 0.22);
  font-family: var(--cph-font, "Lato", "Segoe UI", sans-serif);
  color: var(--cph-text, #3c4e5a);
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  animation: cph-map-pop-in 0.14s ease-out;
}

@keyframes cph-map-pop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Arrow - a rotated square straddling the card's bottom (or top, when flipped) edge. */
.cph-map-pop::after {
  content: "";
  position: absolute;
  left: var(--arrow-x);
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-right: 1px solid var(--cph-border, #d8e0e0);
  border-bottom: 1px solid var(--cph-border, #d8e0e0);
  transform: translateX(-50%) rotate(45deg);
}

.cph-map-pop.is-below::after {
  top: -7px;
  bottom: auto;
  transform: translateX(-50%) rotate(225deg);
}

.cph-map-pop *,
.cph-map-pop *::before,
.cph-map-pop *::after {
  box-sizing: border-box;
}

.cph-map-pop p,
.cph-map-pop h3 {
  margin: 0;
}

.cph-map-pop__media {
  position: relative;
  overflow: hidden;
  border-radius: 11px 0 0 11px;
  background: var(--cph-primary-mist, #def6f5);
}

.cph-map-pop__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cph-map-pop__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
}

.cph-map-pop__name {
  font-family: var(--cph-font-display, "Montserrat", "Lato", sans-serif);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cph-map-pop__name a {
  color: var(--cph-primary, #02aaa9);
  text-decoration: none;
}

.cph-map-pop__name a:hover {
  color: var(--cph-primary-dark, #218887);
}

.cph-map-pop__place {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--cph-text-muted, #707070);
}

.cph-map-pop__stars {
  color: var(--cph-gold, #febb02);
  letter-spacing: 1px;
}

.cph-map-pop__ta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--cph-text-muted, #707070);
}

.cph-map-pop__ta img {
  height: 14px;
  width: auto;
}

.cph-map-pop__board {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--cph-primary-mist, #def6f5);
  color: var(--cph-primary-deep, #104443);
  font-size: 11px;
  font-weight: 700;
}

.cph-map-pop__foot {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--cph-border, #d8e0e0);
  text-align: right;
}

.cph-map-pop__stay {
  font-size: 11px;
  color: var(--cph-text-muted, #707070);
}

.cph-map-pop__price {
  margin-top: 2px !important;
  font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--cph-text, #3c4e5a);
}

.cph-map-pop__price small {
  font-size: 0.6em;
  font-weight: 700;
}

.cph-map-pop__total {
  margin-top: 2px !important;
  font-size: 12px;
  font-weight: 700;
  color: var(--cph-text, #3c4e5a);
}

.cph-map-pop__total small {
  font-size: 1em;
}

.cph-map-pop__total span {
  font-weight: 400;
  color: var(--cph-text-muted, #707070);
}

.cph-map-pop__call {
  margin-top: 2px !important;
  font-family: var(--cph-font-display, "Montserrat", "Lato", sans-serif);
  font-size: 16px;
  font-weight: 800;
  color: var(--cph-primary-deep, #104443);
}

.cph-map-pop__urgency {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px !important;
  font-size: 11px;
  font-weight: 800;
  color: var(--cph-urgency-text, #c23b4a);
}

.cph-map-pop__urgency svg {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
}

@media (max-width: 480px) {
  .cph-map-pop {
    width: 290px;
    grid-template-columns: 96px minmax(0, 1fr);
  }
}
