/* Dream Lands — Map view + count pins */
/* ===== Map View ===== */

.map-view {
  width: 100%;
  padding: 0 1rem;
  margin-bottom: 2.5rem;
}

.map-split {
  position: relative;
  display: flex;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}

.map-split-left {
  flex: 1;
  min-height: 560px;
}

.map-split-right {
  display: none;
}

.map-split-right.mobile-open {
  display: flex;
  flex-direction: column;
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  max-height: 50vh;
  background: var(--bg-2, #1a2420);
  z-index: 1100;
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
}

.mobile-open .map-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.mobile-open .map-sidebar-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.mobile-open .map-sidebar-count {
  font-size: .8rem;
  color: var(--muted);
}

.mobile-open .map-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: .5rem;
}

.mobile-open .map-sidebar-card {
  display: flex;
  gap: .65rem;
  padding: .6rem;
  border-radius: 8px;
  cursor: pointer;
}

.mobile-open .map-sidebar-card+.map-sidebar-card {
  border-top: 1px solid var(--border);
}

.mobile-open .map-sidebar-thumb {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.mobile-open .map-sidebar-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.mobile-open .map-sidebar-info-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-open .map-sidebar-info-loc {
  font-size: .75rem;
  color: var(--muted);
}

.mobile-open .map-sidebar-info-price {
  font-size: .78rem;
  font-weight: 600;
  color: var(--acid);
}

.map-sidebar-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  opacity: .7;
}

.map-sidebar-close:hover {
  opacity: 1;
}

@media (min-width: 769px) {
  .map-split-right {
    display: flex;
    flex-direction: column;
    width: 340px;
    min-width: 340px;
    max-height: 560px;
    border-left: 1px solid var(--border);
    background: var(--bg-2, #1a2420);
  }

  .map-view.map-fullscreen .map-split-right {
    max-height: calc(100vh - 100px);
  }

  .map-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
  }

  .map-sidebar-title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
  }

  .map-sidebar-count {
    font-size: .8rem;
    color: var(--muted);
  }

  .map-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: .5rem;
  }

  .map-sidebar-card {
    display: flex;
    gap: .65rem;
    padding: .6rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
  }

  .map-sidebar-card:hover {
    background: rgba(255, 255, 255, .06);
  }

  .map-sidebar-card+.map-sidebar-card {
    border-top: 1px solid var(--border);
  }

  .map-sidebar-thumb {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
  }

  .map-sidebar-info {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
  }

  .map-sidebar-info-title {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .map-sidebar-info-loc {
    font-size: .75rem;
    color: var(--muted);
  }

  .map-sidebar-info-price {
    font-size: .85rem;
    font-weight: 700;
    color: var(--green);
  }

  .map-sidebar-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
  }
}

.map-container {
  width: 100%;
  height: 100%;
  min-height: 560px;
}

.map-fullscreen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.5rem;
  border: none;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.map-fullscreen-btn:hover {
  background: var(--green-light);
  transform: translateY(-1px);
}

.map-fullscreen-btn-float {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 500;
  box-shadow: var(--shadow);
}

.map-view.map-fullscreen .map-split {
  border-radius: 0;
  border: none;
}

.map-view.map-fullscreen .map-split-left {
  min-height: calc(100vh - 100px);
}

@media (max-width: 768px) {
  .map-split-left {
    min-height: 350px;
  }

  .map-fullscreen-btn-float {
    top: .6rem;
    right: .6rem;
    padding: .55rem 1rem;
    font-size: .8rem;
  }
}

/* Cluster markers */
.map-cluster-marker {
  background: none !important;
  border: none !important;
}

.map-cluster-dot {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .4));
}

.map-cluster-inner {
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .18), 0 1px 3px rgba(0, 0, 0, .1);
  text-align: center;
  width: max-content;
  min-width: 90px;
  max-width: 170px;
  transform: translate(-50%, -100%);
  position: relative;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}

.map-cluster-inner::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #fff;
}

.map-cluster-inner:hover {
  transform: translate(-50%, -100%) scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .22), 0 2px 4px rgba(0, 0, 0, .12);
}

/* Tenkasi sits amid several tight sub-clusters (KR Colony, Kuthukalvalasai,
   Kallidaikurichi) to its NE/SW — push its card straight up so it clears them. */
.map-cluster-marker--tenkasi .map-cluster-inner {
  transform: translate(-50%, calc(-100% - 95px));
}

.map-cluster-marker--tenkasi .map-cluster-inner:hover {
  transform: translate(-50%, calc(-100% - 95px)) scale(1.05);
}

.map-cluster-name {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text);
  margin: 2px 0 4px;
  white-space: normal;
}

.map-cluster-types {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  justify-items: center;
}

.map-type-badge {
  font-size: .65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 6px;
  background: #f0f0f0;
  color: var(--text);
  white-space: nowrap;
  line-height: 1.4;
}

.map-type-farm_land {
  background: #e8f5e9;
  color: #2e7d32;
}

.map-type-residential_plot {
  background: #e3f2fd;
  color: #1565c0;
}

.map-type-house {
  background: #fff3e0;
  color: #e65100;
}

.map-type-commercial {
  background: #f3e5f5;
  color: #7b1fa2;
}

/* ===== Compact count pins (name on hover, tap → area listings) ===== */
.map-pin-marker {
  background: none !important;
  border: none !important;
}

.map-pin {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--pin, #2e7d32);
  border: 2.5px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.map-pin::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 9px solid var(--pin, #2e7d32);
}

.map-pin-count {
  color: #fff;
  font-weight: 800;
  font-size: .9rem;
  line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.map-pin:hover {
  transform: scale(1.15);
  box-shadow: 0 5px 16px rgba(0, 0, 0, .4);
}

.map-pin-tooltip.leaflet-tooltip {
  background: rgba(0, 0, 0, .85);
  border: none;
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .3);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: .82rem;
  font-weight: 600;
  padding: 6px 12px;
  white-space: nowrap;
}

.map-pin-tooltip.leaflet-tooltip-top::before {
  border-top-color: rgba(0, 0, 0, .85);
}

/* Popup */
.map-popup-wrap .leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
  padding: 0;
}

.map-popup-wrap .leaflet-popup-content {
  margin: 0;
  width: auto !important;
}

.map-popup-wrap .leaflet-popup-tip {
  box-shadow: 0 2px 6px rgba(0, 0, 0, .1);
}

.map-popup {
  padding: 14px 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.map-popup-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.map-popup-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

.map-popup-table td {
  padding: 3px 8px 3px 0;
  font-size: .82rem;
  color: var(--muted);
}

.map-popup-table td:last-child {
  text-align: right;
  color: var(--text);
}

.map-popup-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-popup-card {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-radius: 8px;
  background: #f9f9f7;
  cursor: pointer;
  transition: background .12s;
}

.map-popup-card:hover {
  background: #f0f0ec;
}

.map-popup-card img {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.map-popup-card-title {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-popup-card-price {
  font-size: .72rem;
  font-weight: 700;
  color: var(--green);
  margin-top: 2px;
}

.map-popup-more {
  font-size: .75rem;
  color: var(--green);
  font-weight: 600;
  margin-top: 6px;
  text-align: center;
}

