:root {
  --buttons: #1f9c53;
  --darker-green: #12793d;
  --dark: #292929;
  --light: #f1f1f1;
  --light-mobile: #f4f4f4;
  --box-bg: #ffffff;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Poppins", sans-serif;
  background: var(--light);
  color: var(--dark);
  overscroll-behavior: none;
}

.map-page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: calc(100vh - 104px);
  height: calc(100dvh - 104px);
  overflow: hidden;
}

.map-layout {
  display: flex;
  height: 100%;
}

.map-listings {
  width: 375px;
  background: var(--light);
  display: flex;
  flex-direction: column;
  overflow: visible;
  min-height: 0;
  margin: 30px 0 36px 0;
}

.map-units {
  flex: 1;
  padding: 0 30px 0 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.map-units::-webkit-scrollbar {
  display: none;
}

.map-units::after {
  content: "";
  height: 1px;
  flex-shrink: 0;
}

.map-container {
  flex: 1;
  padding: 30px 0 36px 0;
}

#map {
  width: 100%;
  height: 100%;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.price-marker {
  background: rgba(31, 156, 83, 0.9);
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transform: translate(-50%, -100%);
  transition: transform 0.15s ease, background 0.15s ease;
  pointer-events: auto;
}

.price-marker.active {
  background: var(--darker-green);
  transform: translate(-50%, -100%) scale(1.12);
}

.unit-card {
  background: white;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 30px;
}

.unit-card:last-child {
  margin-bottom: 0;
}

.unit-card.in-view {
  opacity: 1;
  transform: translateY(0);
}

.unit-card.active {
  box-shadow:
    inset 0 0 0 2px var(--buttons),
    0 4px 12px rgba(0, 0, 0, 0.08);
}

.unit-carousel {
  position: relative;
  margin: 14px;
  aspect-ratio: 4 / 3;
  border-radius: 5px;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.4s ease;
  position: relative;
  z-index: 1;
}

.carousel-track img {
  width: 100%;
  height: 100%;
  flex-shrink: 0;
  object-fit: contain;
}

.carousel-blur {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(18px);
  transform: scale(1.12);
  z-index: 0;
}

.price-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  background: var(--darker-green);
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 0.8rem;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  background: rgba(0,0,0,0.55);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}

.carousel-btn.prev {
  left: 8px;
}

.carousel-btn.next {
  right: 8px;
}

.unit-info {
  padding: 6px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.unit-info h3 {
  margin: 0 0 2px;
  font-size: 1.05rem;
  color: var(--dark);
}

.unit-meta {
  padding-left: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
  color: #555;
}

.unit-meta.address {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unit-meta i {
  margin-right: 5px;
}

.view-button {
  margin-top: 12px;
  background: white;
  color: var(--buttons);
  border: 2.5px solid var(--buttons);
  padding: 8px 14px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  display: flex;
  justify-content: space-between;
  transition: transform 0.1s ease, background 0.2s ease, color 0.2s ease;
}

.view-button::after {
  content: ">";
}

.view-button:active {
  background: var(--buttons);
  color: white;
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .view-button:hover {
    background: var(--buttons);
    color: white;
  }
}

@media (min-width: 769px) and (max-width: 1350px) {
  .map-page-wrapper { 
    padding-left: 55px;
    padding-right: 55px;
  }
}

@media (max-width: 768px) {

  body {
    overflow: hidden;
  }

  .map-page-wrapper {
    padding: 0;
  }

  .map-layout {
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
  }

  .map-container {
    padding: 0 !important;
    height: 100% !important;
    z-index: 1;
    flex: none;
  }

  #map {
    height: 100%;
    border-radius: 0;
    box-shadow: none;
  }

  .map-listings {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    background: var(--light-mobile);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 20;
    will-change: transform;
    touch-action: pan-y;
    pointer-events: auto;
    contain: layout paint;
    padding-top: 0;
  }

  .map-listings:not(.expanded) .map-units {
    overflow: hidden;
  }

  .map-listings.expanded .map-units {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .map-listings::before {
    content: "";
    width: 42px;
    height: 4px;
    background: #d1d1d1;
    border-radius: 999px;
    margin: 11px auto 11px;
    flex-shrink: 0;
  }

  .map-units {
    padding: 10px 16px 24px;
    min-height: 0;
    padding-top: 0;
  }
}