/* ==========================================================================
   Mapa de propiedades: mapa grande + pantalla partida con fichas
   Usa las variables de marca del sitio (--primary-pink, etc.)
   ========================================================================== */

.pmap {
  --pmap-list-w: 440px;
  --pmap-rent: #2563eb;
  --pmap-sale: var(--primary-pink, #d6006e);
  --pmap-radius: 14px;
  position: relative;
  height: calc(100dvh - var(--pmap-offset, 120px));
  min-height: 520px;
  background: #eef1f5;
  overflow: hidden;
}

.pmap-stage {
  display: flex;
  height: 100%;
}

/* ---------- Lista lateral ---------- */
.pmap-list {
  flex: 0 0 0;
  width: 0;
  max-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #f7f8fa;
  border-right: 1px solid rgba(15, 17, 21, 0.08);
  transition: flex-basis 0.3s ease, max-width 0.3s ease, width 0.3s ease;
}

.pmap[data-view="split"] .pmap-list {
  flex-basis: var(--pmap-list-w);
  width: var(--pmap-list-w);
  max-width: var(--pmap-list-w);
}

.pmap-list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  background: #fff;
  border-bottom: 1px solid rgba(15, 17, 21, 0.07);
  min-width: var(--pmap-list-w);
}

.pmap-list-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-dark, #23272a);
  line-height: 1.2;
  margin: 0;
}

.pmap-list-count {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted, #718096);
}

.pmap-list-count strong {
  color: var(--text-dark, #23272a);
}

.pmap-icon-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(15, 17, 21, 0.1);
  background: #fff;
  color: var(--text-dark, #23272a);
  cursor: pointer;
  transition: background 0.2s;
}

.pmap-icon-btn:hover {
  background: #f1f3f6;
}

.pmap-list-scroll {
  position: relative;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  min-width: var(--pmap-list-w);
  scrollbar-width: thin;
}

.pmap-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Ficha ---------- */
.pmap-card {
  background: #fff;
  border-radius: var(--pmap-radius);
  border: 1px solid rgba(15, 17, 21, 0.06);
  box-shadow: 0 1px 2px rgba(15, 17, 21, 0.04);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.pmap-card[hidden] {
  display: none;
}

.pmap-card:hover,
.pmap-card.is-active {
  box-shadow: 0 10px 28px rgba(15, 17, 21, 0.12);
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--pmap-sale) 35%, transparent);
}

.pmap-card-link {
  display: grid;
  grid-template-columns: 150px 1fr;
  color: inherit;
  text-decoration: none;
  min-height: 150px;
}

.pmap-card-media {
  position: relative;
  background: #e5e7eb;
}

.pmap-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.pmap-card:hover .pmap-card-media img {
  transform: scale(1.05);
}

.pmap-card-op {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--pmap-sale);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.pmap-card-op--alquiler {
  background: var(--pmap-rent);
}

.pmap-card-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 13px 15px 14px;
  min-width: 0;
}

.pmap-card-type {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #718096);
}

.pmap-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-dark, #23272a);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pmap-card-loc {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted, #718096);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pmap-card-loc i {
  color: var(--pmap-sale);
  margin-right: 3px;
}

.pmap-card-feats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-body, #4a5568);
}

.pmap-card-feats i {
  color: var(--text-muted, #718096);
  margin-right: 2px;
}

.pmap-card-price {
  margin-top: auto;
  padding-top: 4px;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark, #23272a);
}

.pmap-list-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted, #718096);
}

.pmap-list-empty[hidden] {
  display: none;
}

.pmap-list-empty i {
  font-size: 2rem;
  color: var(--pmap-sale);
  margin-bottom: 10px;
}

.pmap-list-empty p {
  margin: 0 0 16px;
}

/* ---------- Mapa ---------- */
.pmap-map-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.pmap-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #e8ecef;
}

.pmap-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 12px 10px 18px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(15, 17, 21, 0.14);
  max-width: calc(100% - 32px);
}

.pmap[data-view="split"] .pmap-toolbar-info {
  display: none;
}

.pmap-toolbar-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.pmap-toolbar-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-dark, #23272a);
}

.pmap-toolbar-sub {
  font-size: 0.75rem;
  color: var(--text-muted, #718096);
}

.pmap-seg {
  display: inline-flex;
  padding: 3px;
  background: #f1f3f6;
  border-radius: 999px;
}

.pmap-seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-body, #4a5568);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.pmap-seg button.is-active {
  background: var(--text-dark, #23272a);
  color: #fff;
  box-shadow: 0 2px 6px rgba(15, 17, 21, 0.2);
}

.pmap-seg button:not(.is-active):hover {
  background: rgba(15, 17, 21, 0.06);
}

.pmap-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: var(--pmap-sale);
}

.pmap-dot--alquiler {
  background: var(--pmap-rent);
}

.pmap-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 500;
  display: flex;
  gap: 8px;
}

.pmap-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 0;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  background: #fff;
  color: var(--text-dark, #23272a);
  box-shadow: 0 6px 24px rgba(15, 17, 21, 0.14);
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.pmap-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(15, 17, 21, 0.18);
}

.pmap-btn--primary {
  background: var(--pmap-sale);
  color: #fff;
}

.pmap-btn--primary:hover {
  background: var(--primary-pink-hover, var(--pmap-sale));
  color: #fff;
}

.pmap-btn--ghost {
  box-shadow: none;
  border: 1px solid rgba(15, 17, 21, 0.15);
}

.pmap[data-view="map"] .pmap-toggle-map,
.pmap[data-view="split"] .pmap-toggle-split {
  display: none;
}

/* ---------- Pines con precio ---------- */
.pmap-marker {
  background: transparent;
  border: 0;
}

.pmap-pin {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, calc(-100% - 7px));
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--text-dark, #23272a);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(15, 17, 21, 0.22);
  border: 2px solid var(--pin, var(--pmap-sale));
  transition: transform 0.15s ease, background 0.15s, color 0.15s;
  cursor: pointer;
}

.pmap-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--pin, var(--pmap-sale));
  border-bottom: 0;
}

.pmap-pin--venta {
  --pin: var(--pmap-sale);
}

.pmap-pin--alquiler {
  --pin: var(--pmap-rent);
}

.pmap-pin i {
  font-size: 0.72rem;
  color: var(--pin);
}

.pmap-pin--icon {
  padding: 7px;
}

.pmap-marker:hover .pmap-pin,
.pmap-marker.is-hover .pmap-pin,
.pmap-marker.is-active .pmap-pin {
  background: var(--pin);
  color: #fff;
  transform: translate(-50%, calc(-100% - 7px)) scale(1.12);
}

.pmap-marker:hover .pmap-pin i,
.pmap-marker.is-hover .pmap-pin i,
.pmap-marker.is-active .pmap-pin i {
  color: #fff;
}

/* ---------- Grupos de pines ---------- */
.pmap-cluster-wrap {
  background: transparent;
  border: 0;
}

.pmap-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--pmap-sale);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--pmap-sale) 28%, transparent), 0 4px 12px rgba(15, 17, 21, 0.25);
  border: 2px solid #fff;
  transition: transform 0.15s ease;
  cursor: pointer;
}

.pmap-cluster-wrap:hover .pmap-cluster,
.pmap-cluster-wrap.is-hover .pmap-cluster {
  transform: scale(1.12);
  background: var(--text-dark, #23272a);
}

.pmap .leaflet-cluster-anim .leaflet-marker-icon,
.pmap .leaflet-cluster-anim .leaflet-marker-shadow {
  transition: transform 0.3s ease-out, opacity 0.3s ease-in;
}

.pmap .leaflet-cluster-spider-leg {
  transition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;
}

/* ---------- Popup ---------- */
.pmap-leaflet-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: var(--pmap-radius);
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(15, 17, 21, 0.22);
}

.pmap-leaflet-popup .leaflet-popup-content {
  margin: 0;
  width: 280px !important;
}

.pmap-leaflet-popup .leaflet-popup-close-button {
  z-index: 2;
  top: 8px !important;
  right: 8px !important;
  width: 26px !important;
  height: 26px !important;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92) !important;
  color: #23272a !important;
  font-size: 18px !important;
  line-height: 24px !important;
}

.pmap-popup {
  display: block;
  color: inherit;
  text-decoration: none;
}

.pmap-popup-media {
  position: relative;
  height: 150px;
  background: #e5e7eb;
}

.pmap-popup-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pmap-popup-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px 14px;
}

.pmap-popup-body strong {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-dark, #23272a);
}

.pmap-popup-loc {
  font-size: 0.78rem;
  color: var(--text-muted, #718096);
}

.pmap-popup-loc i {
  color: var(--pmap-sale);
}

.pmap-popup-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.pmap-popup-foot .pmap-card-price {
  padding: 0;
}

.pmap-popup-cta {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--pmap-sale);
}

/* Controles Leaflet */
.pmap .leaflet-bar {
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(15, 17, 21, 0.14);
}

.pmap .leaflet-bar a {
  width: 38px;
  height: 38px;
  line-height: 38px;
  border-bottom-color: #eef0f3;
}

.pmap .leaflet-bottom.leaflet-right {
  margin-bottom: 8px;
}

/* ---------- Mobile switch ---------- */
.pmap-mobile-switch {
  display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .pmap {
    --pmap-list-w: 380px;
  }

  .pmap-card-link {
    grid-template-columns: 120px 1fr;
  }
}

@media (max-width: 860px) {
  .pmap {
    --pmap-list-w: 100%;
    min-height: 460px;
  }

  .pmap-list {
    position: absolute;
    inset: 0;
    z-index: 700;
    width: 100%;
    max-width: none;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .pmap[data-view="split"] .pmap-list {
    width: 100%;
    max-width: none;
    transform: translateY(0);
  }

  .pmap-list-head,
  .pmap-list-scroll {
    min-width: 0;
  }

  .pmap-list-scroll {
    padding-bottom: 90px;
  }

  .pmap-actions,
  .pmap-toolbar-info,
  .pmap-list-head .pmap-icon-btn {
    display: none;
  }

  .pmap-toolbar {
    left: 10px;
    right: 10px;
    top: 10px;
    justify-content: center;
    padding: 6px;
  }

  .pmap .leaflet-bottom.leaflet-right {
    margin-bottom: 84px;
  }

  .pmap-mobile-switch {
    display: inline-flex;
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 800;
    align-items: center;
    padding: 13px 22px;
    border: 0;
    border-radius: 999px;
    background: var(--dark-topbar, #0f1115);
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 10px 30px rgba(15, 17, 21, 0.3);
    cursor: pointer;
  }

  .pmap-mobile-switch i {
    margin-right: 6px;
  }

  .pmap[data-view="map"] .pmap-mobile-switch--map,
  .pmap[data-view="split"] .pmap-mobile-switch--list {
    display: none;
  }
}
