/* Map split layout — Airbnb / Idealista style */

.map-page {
  overflow: hidden;
}

.map-page .site-header,
.map-page .site-header-mobile {
  display: none;
}

.map-page .map-main {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

.map-split {
  display: flex;
  height: 100%;
  width: 100%;
  min-height: 0;
  background: #fff;
}

/* —— Panel listado —— */
.map-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  border-right: 1px solid #ebebeb;
  background: #fff;
  z-index: 2;
  position: relative;
  isolation: isolate;
}

@media (min-width: 1024px) {
  .map-panel {
    width: 460px;
    max-width: 460px;
    flex-shrink: 0;
  }
}

@media (min-width: 1280px) {
  .map-panel {
    width: 500px;
    max-width: 500px;
  }
}

.map-panel-toolbar {
  flex-shrink: 0;
  border-bottom: 1px solid #ebebeb;
  background: #fff;
}

.map-panel-toolbar-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
}

.map-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #dddddd;
  border-radius: 50%;
  color: #222;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.map-back-btn:hover {
  border-color: #222;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.map-back-btn svg {
  width: 18px;
  height: 18px;
}

.map-panel-title {
  flex: 1;
  font-size: 15px;
  color: #222;
}

.map-panel-title strong {
  font-weight: 600;
}

.map-mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid #dddddd;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.map-mobile-toggle svg {
  width: 18px;
  height: 18px;
}

@media (min-width: 1024px) {
  .map-mobile-toggle { display: none; }
}

.map-city-scroll {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.map-city-scroll::-webkit-scrollbar { display: none; }

.map-city-chip {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid #dddddd;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  color: #222;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.map-city-chip:hover { border-color: #222; }

.map-city-chip.active {
  background: #222;
  border-color: #222;
  color: #fff;
}

.map-search-details {
  border-top: 1px solid #f0f0f0;
}

.map-search-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #222;
  cursor: pointer;
  list-style: none;
}

.map-search-details summary::-webkit-details-marker { display: none; }

.map-search-details summary svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.map-search-details-body {
  padding: 0 16px 16px;
}

.map-search-bar {
  border-top: 1px solid #f0f0f0;
  padding: 8px 10px 10px;
  background: #fff;
  overflow: hidden;
}

.map-search-bar .abnb-search-meta {
  margin-top: 6px;
  justify-content: flex-start;
}

.map-search-bar .abnb-filters-trigger {
  padding: 5px 10px;
  font-size: 12px;
}

.map-panel-title-sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: #717171;
  margin-top: 2px;
}

.map-list-empty-hint {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 8px !important;
}

/* Barra bbox mapa — esquina inferior, no tapa popups */
.map-bounds-bar {
  position: absolute;
  bottom: 20px;
  left: 16px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #ebebeb;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  font-size: 12px;
  color: #374151;
  max-width: min(420px, calc(100% - 180px));
  flex-wrap: wrap;
}

.map-bounds-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

.map-bounds-toggle input {
  width: 16px;
  height: 16px;
  accent-color: #222;
}

.map-bounds-count {
  font-weight: 600;
  color: #222;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .map-bounds-bar {
    bottom: 80px;
    left: 12px;
    max-width: calc(100% - 24px);
    font-size: 11px;
    padding: 6px 10px;
  }
}

.map-list-item.is-pinned {
  border-color: #222222;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}


.map-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  background: #f4f4f4;
}

.map-list-item {
  display: block;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e8e8e8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  cursor: pointer;
}

.map-list-item:focus-visible {
  outline: 2px solid #222;
  outline-offset: 2px;
}

.map-list-item:last-child { margin-bottom: 0; }

.map-list-item:hover {
  border-color: #c8c8c8;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.map-list-item.is-hovered:not(.is-active) {
  border-color: #b0b0b0;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.07);
}

.map-list-item.is-active {
  border-color: #222222;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.map-list-empty {
  padding: 48px 24px;
  text-align: center;
  color: #717171;
}

.map-list-empty a {
  display: inline-block;
  margin-top: 12px;
  font-weight: 600;
  color: #222;
  text-decoration: underline;
}

/* —— Cards horizontales (Idealista) —— */
.map-card {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px;
  border-radius: 14px;
  background: #ffffff;
  min-height: 130px;
}

.map-card-link {
  flex: 1 1 100%;
  display: block;
  margin-top: 2px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #222;
  color: #fff !important;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s ease;
}

.map-card-link:hover {
  background: #000;
}

.map-list-item:hover .map-card,
.map-list-item.is-active .map-card {
  background: #ffffff;
}

.map-card--featured {
  border-left: 3px solid var(--brand);
}

.map-card-media {
  position: relative;
  flex-shrink: 0;
  width: 128px;
  height: 128px;
  border-radius: 10px;
  overflow: hidden;
  background: #f3f4f6;
}

@media (min-width: 1280px) {
  .map-card-media {
    width: 140px;
    height: 140px;
  }
}

.map-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 12px;
  color: #b0b0b0;
}

.map-card-rating {
  position: absolute;
  left: 6px;
  top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.map-card-rating svg {
  width: 10px;
  height: 10px;
}

.map-card-badge {
  position: absolute;
  right: 6px;
  top: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #fff;
  font-size: 10px;
  font-weight: 600;
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.map-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.map-card-location {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9ca3af;
}

.map-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: #222;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-card-type {
  font-size: 13px;
  color: #717171;
}

.map-card-meta {
  font-size: 13px;
  color: #525252;
  line-height: 1.4;
}

.map-card-extra {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
}

.map-card-amenities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.map-card-amenities span {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 9999px;
  background: #f3f4f6;
  color: #4b5563;
  font-weight: 500;
}

.map-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 6px;
}

.map-card-host {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.map-card-host-avatar {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #222;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.map-card-host-name {
  font-size: 11px;
  color: #525252;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-card-price {
  flex-shrink: 0;
  font-size: 15px;
  color: #222;
  text-align: right;
  line-height: 1.2;
}

.map-card-price strong {
  font-weight: 600;
}

.map-card-price span {
  font-weight: 400;
  color: #717171;
}

/* —— Canvas mapa —— */
.map-canvas-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #e8e8e8;
}

#interactive-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#interactive-map .maplibregl-canvas {
  outline: none;
}

/* Ficha fija al seleccionar (sin popup flotante desincronizado) */
.map-selection-preview {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 6;
  max-width: 380px;
  margin: 0 auto;
  pointer-events: none;
}

@media (min-width: 1024px) {
  .map-selection-preview {
    left: auto;
    right: 68px;
    margin: 0;
  }
}

.map-selection-preview[hidden] {
  display: none !important;
}

.map-selection-preview__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #222;
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  pointer-events: auto;
}

.map-selection-preview__inner {
  pointer-events: auto;
}

.map-selection-preview__card {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 12px;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #ebebeb;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.map-selection-preview__card:hover {
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

.map-selection-preview__img,
.map-selection-preview__placeholder {
  width: 108px;
  height: 108px;
  border-radius: 10px;
  object-fit: cover;
  background: #f3f4f6;
}

.map-selection-preview__placeholder {
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #9ca3af;
}

.map-selection-preview__body {
  min-width: 0;
  padding-right: 28px;
}

.map-selection-preview__meta {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9ca3af;
}

.map-selection-preview__body h3 {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  color: #222;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-selection-preview__facts {
  margin: 4px 0 0;
  font-size: 12px;
  color: #717171;
}

.map-selection-preview__price {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: #222;
}

.map-selection-preview__price span {
  font-weight: 500;
  color: #717171;
}

.map-selection-preview__cta {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand, #3ea35d);
}

.map-controls {
  position: absolute;
  right: 16px;
  bottom: 20px;
  left: auto;
  z-index: 4;
  display: none;
}

@media (max-width: 1023px) {
  .map-controls { display: block; }
}

.map-control-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 9999px;
  background: #222;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.map-control-btn svg {
  width: 16px;
  height: 16px;
}

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #f7f7f7;
  color: #717171;
  font-size: 14px;
  transition: opacity 0.3s ease;
}

.map-loading.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.map-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #ddd;
  border-top-color: #222;
  border-radius: 50%;
  animation: map-spin 0.8s linear infinite;
}

@keyframes map-spin {
  to { transform: rotate(360deg); }
}

/* Marcadores precio */
.maplibregl-marker {
  width: auto !important;
  height: auto !important;
}

.map-price-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  position: relative;
  z-index: 1;
  transform-origin: center bottom;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.map-price-marker__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  max-width: 5.75rem;
  padding: 6px 10px;
  border-radius: 9999px;
  background: #fff;
  color: #222;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  border: 1.5px solid #dddddd;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  box-sizing: border-box;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.map-price-marker:hover .map-price-marker__label,
.map-price-marker.is-hovered:not(.is-active) .map-price-marker__label {
  border-color: #222;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.map-price-marker:hover,
.map-price-marker.is-hovered:not(.is-active) {
  transform: scale(1.06);
  z-index: 5;
}

.map-price-marker.is-active {
  transform: scale(1.08);
  z-index: 10;
}

.map-price-marker.is-active .map-price-marker__label {
  background: #222;
  color: #fff;
  border-color: #222;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
}

.map-price-marker:focus-visible .map-price-marker__label {
  outline: 2px solid #222;
  outline-offset: 2px;
}

/* Popup mapa */
.map-popup.maplibregl-popup {
  z-index: 20;
}

.map-popup .maplibregl-popup-content {
  padding: 0 !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22) !important;
  border: none !important;
  background: #ffffff !important;
}

.map-popup .maplibregl-popup-close-button {
  font-size: 18px;
  padding: 6px 10px;
  color: #222;
  z-index: 2;
}

.map-popup .maplibregl-popup-tip {
  border-top-color: #fff !important;
}

.map-popup-card {
  width: 280px;
  background: #ffffff;
}

.map-popup-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.map-popup-card-body {
  padding: 12px 14px 14px;
  background: #ffffff;
}

.map-popup-type {
  margin-top: 2px;
  font-size: 11px;
  color: #9ca3af;
}

.map-popup-extra {
  margin-top: 2px;
  font-size: 11px;
  color: #9ca3af;
}

.map-popup-host {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f0;
}

.map-popup-host-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #222;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.map-popup-host-name {
  font-size: 12px;
  color: #525252;
  line-height: 1.3;
}

.map-popup-card-body h4 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: #222;
}

.map-popup-card-body p {
  margin-top: 4px;
  font-size: 12px;
  color: #717171;
}

.map-popup-card-body .map-popup-price {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #222;
}

.map-popup-card-body .map-popup-price span {
  font-weight: 400;
  color: #717171;
}

.map-popup-placeholder {
  height: 140px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b0b0b0;
  font-size: 13px;
}

.map-popup-rating {
  margin-top: 4px;
  font-size: 12px;
  color: #717171;
}

.map-popup-card-body a {
  display: block;
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #222;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.map-popup-card-body a:hover {
  background: #000;
}

.map-popup-hint {
  margin-top: 8px !important;
  font-size: 11px !important;
  color: #9ca3af !important;
  text-align: center;
}

/* Controles MapLibre */
.map-canvas-wrap .maplibregl-ctrl-top-right {
  top: 12px;
  right: 12px;
}

.map-canvas-wrap .maplibregl-ctrl-group {
  border-radius: 10px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
  border: 1px solid #ebebeb !important;
  overflow: hidden;
}

.map-canvas-wrap .maplibregl-ctrl-group button {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  font-size: 16px !important;
}

/* Mobile: toggle lista / mapa */
@media (max-width: 1023px) {
  .map-split[data-mobile-view="map"] .map-panel {
    display: none;
  }

  .map-split[data-mobile-view="list"] .map-canvas-wrap {
    display: none;
  }

  .map-split[data-mobile-view="list"] .map-panel {
    width: 100%;
    max-width: none;
  }
}

@media (min-width: 1024px) {
  .map-split .map-panel,
  .map-split .map-canvas-wrap {
    display: flex !important;
  }
}
