@import url('general.css');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--color-page-bg);
  color: var(--color-text-primary);
  min-height: 100vh;
}

/* ── PAGE LAYOUT ───────────────────────────────────────────────── */
.page-body {
  display: grid;
  grid-template-columns: 280px 1fr 0px;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 64px);
  /* Required so sticky children work — grid default is stretch */
  align-items: start;
  transition: grid-template-columns .35s cubic-bezier(.16, 1, .3, 1);
}

/* Expand the detail column when a property is selected */
.page-body.detail-open {
  grid-template-columns: 280px 1fr 380px;
}

/* 3-col listings when detail panel is closed, 2-col when open */
.listings-grid {
  grid-template-columns: repeat(3, 1fr);
}

.page-body.detail-open .listings-grid {
  grid-template-columns: repeat(2, 1fr);
}

/* ── FILTER SIDEBAR ────────────────────────────────────────────── */
.filter-sidebar {
  background: var(--color-surface);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  /* Sticky full-height column with internal scroll */
  position: sticky;
  top: 80px;
  /* 64px navbar + 16px breathing room */
  height: calc(100vh - 96px);
  /* fill viewport minus navbar + gap */
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-dark) transparent;
}

.filter-sidebar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.filter-sidebar__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.filter-sidebar__clear-btn {
  font-size: 0.8rem;
  color: var(--color-primary);
  cursor: pointer;
  font-weight: 500;
  background: none;
  border: none;
}

.filter-sidebar__clear-btn:hover {
  color: var(--color-primary-dark);
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-page-bg);
  border-radius: var(--border-radius-md);
  padding: 9px 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.filter-group__label:hover {
  background: var(--color-hover-bg);
}

.filter-group__label span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group__label i {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  transition: background var(--transition-fast);
}

.filter-checkbox:hover {
  background: var(--color-hover-bg);
}

.filter-checkbox label {
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--color-text-body);
}

.filter-checkbox__input {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid var(--color-border-dark);
  appearance: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.filter-checkbox__input:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.filter-checkbox__input:checked::after {
  content: '✓';
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  justify-content: center;
}

.filter-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  cursor: pointer;
}

.filter-radio label {
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--color-text-body);
}

input[type="radio"] {
  width: 17px;
  height: 17px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

#js-filter-types {
  max-height: 200px;
  overflow: auto;
}

.price-range__labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 10px 0 6px;
}

.price-range__slider {
  width: 100%;
  accent-color: var(--color-primary);
  height: 4px;
  cursor: pointer;
}

.area-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
}

.area-inputs__sep {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.area-input {
  background: var(--color-page-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  padding: 7px 10px;
  font-size: 0.8rem;
  color: var(--color-text-body);
  outline: none;
  width: 100%;
  transition: border-color var(--transition-fast);
}

.area-input:focus {
  border-color: var(--color-primary);
}

.area-input::placeholder {
  color: var(--color-border-dark);
}

.amenity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.amenity-tag {
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--color-border);
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
  background: transparent;
}

.amenity-tag.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-surface);
}

.amenity-tag:hover:not(.is-active) {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

/* ── Filter input ────────────────────────────────────────────────── */
.filter-input {
  width: 100%;
  background: var(--color-page-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  padding: 8px 11px;
  font-size: .84rem;
  color: var(--color-text-body);
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}

.filter-input:focus {
  border-color: var(--color-primary);
}

/* Location wrap + dropdown */
.filter-location-wrap {
  position: relative;
}

.filter-location-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  list-style: none;
  padding: 4px 0;
  margin: 0;
  z-index: 200;
  max-height: 200px;
  overflow-y: auto;
}

.filter-location-dropdown[hidden] {
  display: none;
}

.filter-location-dropdown li {
  padding: 8px 12px;
  font-size: .82rem;
  cursor: pointer;
  color: var(--color-text-body);
  transition: background .1s;
}

.filter-location-dropdown li:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* Active location tag */
.filter-active-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: .78rem;
  font-weight: 600;
  gap: 6px;
}

.filter-active-tag[hidden] {
  display: none;
}

.filter-active-tag button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-primary);
  font-size: .72rem;
  padding: 0;
}

/* Range inputs row */
.filter-range-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}

.filter-range-sep {
  text-align: center;
  font-size: .8rem;
  color: var(--color-text-muted);
}

.filter-range-input {
  background: var(--color-page-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  padding: 7px 8px;
  font-size: .8rem;
  color: var(--color-text-body);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .15s;
}

.filter-range-input:focus {
  border-color: var(--color-primary);
}

.filter-range-input::placeholder {
  color: var(--color-border-dark);
}

/* Checkbox rows (type filter) */
.filter-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 2px;
  cursor: pointer;
  font-size: .84rem;
  color: var(--color-text-body);
  border-radius: 6px;
  transition: background .1s;
}

.filter-checkbox-row:hover {
  background: var(--color-page-bg);
}

.filter-checkbox-row input {
  flex-shrink: 0;
  accent-color: var(--color-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Apply button */
.filter-apply-btn {
  width: 100%;
  margin-top: .5rem;
  padding: 10px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--border-radius-md);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background .15s;
}

.filter-apply-btn:hover {
  background: var(--color-primary-dark);
}

/* Listings count line */
.listings-count {
  font-size: .82rem;
  color: var(--color-text-muted);
  font-weight: 500;
  padding: 0 2px 2px;
  min-height: 1.2em;
}

/* ── LISTINGS ──────────────────────────────────────────────────── */
.listings-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.listings-grid {
  display: grid;
  gap: 1rem;
}

.property-card {
  background: var(--color-surface);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .25s, box-shadow .25s;
  border: 2px solid transparent;
}

.property-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.property-card.is-active {
  border-color: var(--color-primary);
}

.property-card__image-wrap {
  position: relative;
  height: 170px;
  overflow: hidden;
}

.property-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}

.property-card:hover .property-card__image {
  transform: scale(1.05);
}

/* Video play badge on card thumbnail */
.property-card__video-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .25);
  pointer-events: none;
}

.property-card__video-badge i {
  font-size: 2.5rem;
  color: rgba(255, 255, 255, .9);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5));
}

/* Type badge */
.property-card__badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
}

/* Listing type (Buy / Rent / Sale) */
.property-card__listing-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.65rem;
  font-weight: 700;
  color: white;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Save button */
.property-card__save-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  background: var(--color-surface);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  color: var(--color-primary);
  transition: background var(--transition-fast);
  font-size: 0.85rem;
}

.property-card__save-btn:hover {
  background: var(--color-primary-light);
}

.property-card__save-btn.is-saved {
  background: var(--color-primary-light);
}

/* Card info */
.property-card__info {
  padding: 12px 14px;
}

.property-card__name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90%;
}

.property-card__location {
  align-items: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 90%;
}

.property-card__location i {
  font-size: 0.72rem;
  color: var(--color-primary);
  flex-shrink: 0;
}

.property-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.property-card__price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.property-card__price-original {
  text-decoration: line-through;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 400;
  margin-right: 6px;
}

.property-card__price-discounted {
  color: var(--color-text-primary);
  font-weight: 700;
}

.property-card__price-currency {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

/* ── DETAIL PANEL ──────────────────────────────────────────────── */
.detail-panel {
  background: var(--color-surface);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  /* Sticky full-height column with internal scroll */
  position: sticky;
  top: 80px;
  height: calc(100vh - 96px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-dark) transparent;
  animation: panelSlideIn .4s cubic-bezier(.16, 1, .3, 1) both;
  /* Hidden until a property is selected */
  display: none;
}

.detail-panel.is-visible {
  display: block;
}

/* ── Desktop close button — inside a sticky header bar ─────────── */
.detail-panel__header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 10px 0;
  background: transparent;
  margin-bottom: -44px;
  pointer-events: none;
}

.detail-panel__header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: all;
}

/* Close button — must re-enable pointer-events since header has none */
.detail-panel__close-btn {
  pointer-events: all;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .35);
  backdrop-filter: blur(6px);
  color: white;
  font-size: .8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .15s;
  flex-shrink: 0;
}

.detail-panel__close-btn:hover {
  background: rgba(0, 0, 0, .55);
  transform: scale(1.1);
}

/* Edit listing button */
.detail-owner-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  height: 30px;
  border-radius: 15px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .15s;
}

.detail-owner-btn:hover {
  background: var(--color-primary-dark);
  transform: scale(1.05);
}

/* Share button */
.detail-share-wrap {
  position: relative;
}

.detail-share-btn {
  pointer-events: all;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .35);
  backdrop-filter: blur(6px);
  color: white;
  font-size: .8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .15s;
}

.detail-share-btn:hover {
  background: rgba(0, 0, 0, .55);
  transform: scale(1.1);
}

.detail-share-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  min-width: 170px;
  z-index: 100;
}

.detail-share-menu[hidden] {
  display: none;
}

.share-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--color-text-primary);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: background .12s;
}

.share-option:hover {
  background: var(--color-page-bg);
}

.share-option i {
  width: 16px;
  text-align: center;
}

.share-option--fb i {
  color: #1877f2;
}

.share-option--tw i {
  color: #000;
}

.share-option--wa i {
  color: #25d366;
}

.share-option--copy i {
  color: var(--color-text-muted);
}

/* Video thumbnail in strip */
.detail-thumbnail--video {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid transparent;
  transition: border-color .15s;
}

.detail-thumbnail--video.is-active {
  border-color: var(--color-primary);
}

.detail-thumbnail--video i {
  font-size: 1.4rem;
  color: #fff;
  opacity: .85;
}

/* Gallery no longer needs special positioning */
.detail-gallery {
  position: relative;
}

@keyframes panelSlideIn {
  from {
    opacity: 0;
    transform: translateX(32px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.detail-panel .detail-gallery,
.detail-panel .detail-content {
  transition: opacity var(--transition-med), transform var(--transition-med);
}

.detail-panel.is-refreshing .detail-gallery,
.detail-panel.is-refreshing .detail-content {
  opacity: 0;
  transform: translateY(10px);
}

.detail-panel.is-loaded .detail-gallery,
.detail-panel.is-loaded .detail-content {
  opacity: 1;
  transform: translateY(0);
}

/* Gallery — fixed height for images, natural height for videos */
.detail-gallery {
  overflow: hidden;
  line-height: 0;
  /* remove inline gap */
}

.detail-gallery__main-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: opacity var(--transition-med), transform var(--transition-med);
  display: block;
}

.detail-gallery__main-image:hover {
  transform: scale(1.02);
}

.detail-gallery__main-video {
  width: 100%;
  max-height: 320px;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  display: block;
  background: #000;
}

/* Thumbnail strip */
.detail-thumbnails {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-dark) transparent;
}

.detail-thumbnail {
  width: 56px;
  height: 42px;
  border-radius: var(--border-radius-sm);
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  flex-shrink: 0;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.detail-thumbnail:hover {
  transform: scale(1.06);
}

.detail-thumbnail.is-active {
  border-color: var(--color-primary);
}

/* Detail content */
.detail-content {
  padding: 1.25rem;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.detail-header__name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}

.detail-header__price {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.detail-header__price-unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.detail-location {
  display: flex;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  align-items: baseline;
}

.detail-location i {
  font-size: 0.78rem;
  color: var(--color-primary);
  flex-shrink: 0;
}

/* Tabs */
.detail-tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1rem;
}

.detail-tab {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
  transition: color var(--transition-fast);
}

.detail-tab:hover {
  color: var(--color-primary);
}

.detail-tab.is-active {
  color: var(--color-primary);
}

.detail-tab.is-active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
}

/* Tab content panels */
.detail-tab-content {
  display: none;
}

.detail-tab-content.is-active {
  display: block;
}

.detail-description {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  margin-bottom: 1rem;
}

/* Spec grid */
.detail-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 1rem;
}

.detail-spec-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-page-bg);
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  animation: specPop .35s cubic-bezier(.34, 1.56, .64, 1) both;
}

.detail-spec-item:nth-child(1) {
  animation-delay: .04s;
}

.detail-spec-item:nth-child(2) {
  animation-delay: .08s;
}

.detail-spec-item:nth-child(3) {
  animation-delay: .12s;
}

.detail-spec-item:nth-child(4) {
  animation-delay: .16s;
}

.detail-spec-item:nth-child(5) {
  animation-delay: .20s;
}

.detail-spec-item:nth-child(6) {
  animation-delay: .24s;
}

.detail-spec-item:nth-child(7) {
  animation-delay: .28s;
}

.detail-spec-item:nth-child(8) {
  animation-delay: .32s;
}

@keyframes specPop {
  from {
    opacity: 0;
    transform: scale(.85);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.detail-spec-item__icon {
  width: 28px;
  height: 28px;
  border-radius: var(--border-radius-sm);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.detail-spec-item__label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-body);
}

/* Action buttons */
.detail-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 1rem;
}

.btn--outline {
  padding: 10px;
  border-radius: 12px;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn--outline:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.btn--primary {
  padding: 10px;
  border-radius: 12px;
  border: none;
  background: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-surface);
  cursor: pointer;
  transition: background var(--transition-fast), transform .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn--primary:hover {
  background: var(--color-primary-dark);
}

.btn--primary:active {
  transform: scale(.97);
}

/* ── MAP ───────────────────────────────────────────────────────── */
/* ── DETAIL MAP — real Leaflet ─────────────────────────────────── */
.detail-map {
  height: 180px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--color-border);
  z-index: 0;
}

/* Explicit height so Leaflet doesn't get 0px container */
.detail-map .leaflet-container {
  height: 180px;
  width: 100%;
  border-radius: 11px;
  font-size: 12px;
}

/* Undo global CSS reset inside Leaflet — box-sizing:border-box breaks tile layout */
.detail-map .leaflet-container * {
  box-sizing: content-box;
}

.detail-map .leaflet-container img {
  max-width: none;
  max-height: none;
}

/* Leaflet attribution — smaller to fit the panel */
.detail-map .leaflet-control-attribution {
  font-size: .6rem !important;
  background: rgba(255, 255, 255, .75) !important;
}

/* ── PLACEHOLDER ───────────────────────────────────────────────── */
.detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 360px;
  gap: 14px;
  color: var(--color-border-dark);
  animation: fadeIn .4s ease;
}

.detail-placeholder i {
  font-size: 3.5rem;
  opacity: .5;
}

.detail-placeholder p {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ── MOBILE FILTER BUTTON ──────────────────────────────────────── */
.mobile-filter-btn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--color-primary);
  color: var(--color-surface);
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: background var(--transition-fast);
}

.mobile-filter-btn:hover {
  background: var(--color-primary-dark);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 150;
}

.overlay.is-open {
  display: block;
}

/* ── LIGHTBOX ──────────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.8);
  flex-direction: column;
}

.lightbox.is-open {
  display: flex;
}

/* Top bar */
.lightbox__bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
}

.lightbox__counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.05em;
}

.lightbox__bar-actions {
  display: flex;
  gap: 8px;
}

.lightbox__btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.lightbox__btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

/* Stage — fills remaining vertical space */
.lightbox__stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Zoom wrapper — scales around center */
.lightbox__zoom-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transform-origin: center center;
  transition: transform .2s ease;
}

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  user-select: none;
  pointer-events: all;
}

/* Arrows */
.lightbox__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: var(--color-primary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.lightbox__arrow:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.08);
}

.lightbox__arrow--prev {
  left: 16px;
}

.lightbox__arrow--next {
  right: 16px;
}

/* Thumbnail strip */
.lightbox__thumbs {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  justify-content: center;
}

.lb-thumb {
  flex-shrink: 0;
  width: 60px;
  height: 46px;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background: none;
  opacity: 0.45;
  transition: opacity var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.lb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lb-thumb.is-active {
  border-color: var(--color-primary);
  opacity: 1;
}

.lb-thumb:hover:not(.is-active) {
  opacity: 0.75;
  transform: scale(1.05);
}

/* ── RESPONSIVE ────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .page-body {
    grid-template-columns: 260px 1fr;
  }

  /* ── iOS-style bottom sheet ──────────────────────────────────── */
  .sheet-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 300;
    animation: backdropFadeIn .25s ease;
  }

  .sheet-backdrop.is-open {
    display: block;
  }

  @keyframes backdropFadeIn {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }

  /* Sheet container */
  .detail-panel {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: auto;
    max-height: 90dvh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 400;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
    transform: translateY(100%);
    transition: transform .38s cubic-bezier(.32, 1, .46, 1);
    animation: none;
    display: block;
  }

  /* Detail-open must NOT collapse the listings grid on mobile */
  .page-body,
  .page-body.detail-open {
    grid-template-columns: 260px 1fr;
  }

  /* Grid stays 3-col whether or not a property is selected */
  .page-body.detail-open .listings-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .detail-panel.is-sheet-open {
    transform: translateY(0);
  }

  /* Hide the ::before handle — we use a fixed element outside the sheet instead */
  .detail-panel::before {
    display: none;
  }

  /* Fixed home indicator pill — sits above the sheet, outside overflow */
  .sheet-handle {
    display: none;
    position: fixed;
    bottom: calc(90dvh + 8px);
    /* just above the sheet's max-height */
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    z-index: 401;
    /* above the sheet (400) */
    cursor: grab;
    transition: bottom .38s cubic-bezier(.32, 1, .46, 1),
      opacity .38s ease;
    opacity: 0;
    pointer-events: none;
  }

  .sheet-handle.is-open {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  /* Wider touch target for drag zone — drag-handle overlay */
  .detail-panel__drag-handle {
    display: block;
    width: 100%;
    height: 32px;
    cursor: grab;
    position: relative;
    z-index: 5;
    margin-top: -28px;
  }

  /* Hide desktop close btn and its header — sheet uses drag-to-dismiss */
  .detail-panel__header {
    display: none;
  }

  .detail-panel__close-btn {
    display: none;
  }

  .detail-panel:not(.is-sheet-open) {
    pointer-events: none;
  }
}

@media (max-width: 900px) {
  .page-body {
    grid-template-columns: 240px 1fr;
    gap: 1rem;
    padding: 1rem;
  }

  /* Detail panel is a sheet — grid stays 2-col regardless of detail state */
  .listings-grid,
  .page-body.detail-open .listings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .page-body {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .filter-sidebar {
    display: none;
    position: fixed;
    top: 64px;
    height: auto;
    max-height: calc(100vh - 64px);
  }

  .filter-sidebar.is-open {
    display: block;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 200;
    overflow-y: auto;
    border-radius: 0;
  }

  /* Detail panel is a sheet — grid stays 2-col regardless of detail state */
  .listings-grid,
  .page-body.detail-open .listings-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mobile-filter-btn {
    display: flex !important;
  }
}

@media (max-width: 440px) {

  .listings-grid,
  .page-body.detail-open .listings-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Detail panel: video poster (static preview, click opens lightbox) ── */
.detail-gallery__video-poster {
  position: relative;
  display: block;
  overflow: hidden;
}

.detail-gallery__play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .3);
  transition: background .15s;
}

.detail-gallery__video-poster:hover .detail-gallery__play-overlay {
  background: rgba(0, 0, 0, .45);
}

.detail-gallery__play-overlay i {
  font-size: 3.5rem;
  color: rgba(255, 255, 255, .92);
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .5));
}

/* ── Lightbox video ────────────────────────────────────────────── */
.lightbox__video {
  max-width: 92vw;
  max-height: 78vh;
  width: auto;
  height: auto;
  display: block;
  border-radius: 6px;
  background: #000;
}

/* Video thumb in lightbox strip */
.lb-thumb__video-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #111;
  color: rgba(255, 255, 255, .8);
  font-size: 1.3rem;
}

/* ════════════════════════════════════════════════════════════════
   CONTACT OPTIONS  (detail panel Contact tab)
════════════════════════════════════════════════════════════════ */
.contact-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 15px 0;
}

.contact-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  text-decoration: none;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  width: 100%;
  text-align: left;
}

.contact-option:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.contact-option__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.contact-option--wa .contact-option__icon {
  background: #dcfce7;
  color: #16a34a;
}

.contact-option--phone .contact-option__icon {
  background: #dbeafe;
  color: #2563eb;
}

.contact-option--email .contact-option__icon {
  background: #fce7f3;
  color: #db2777;
}

.contact-option--wa:hover {
  border-color: #16a34a;
  background: #f0fdf4;
}

.contact-option--phone:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

.contact-option--email:hover {
  border-color: #db2777;
  background: #fdf2f8;
}

.contact-option__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-option__label {
  font-size: .88rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.contact-option__sub {
  font-size: .78rem;
  color: var(--color-text-muted);
}

.contact-option__arrow {
  color: var(--color-text-muted);
  font-size: .75rem;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════
   EMAIL CONTACT MODAL
════════════════════════════════════════════════════════════════ */
.contact-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn .2s ease;
}

.contact-modal-overlay[hidden] {
  display: none;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.contact-modal {
  background: var(--color-surface);
  border-radius: 20px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
  animation: modalSlideUp .22s ease;
}

@keyframes modalSlideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.contact-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--color-page-bg);
  color: var(--color-text-muted);
  font-size: .9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  z-index: 1;
}

.contact-modal__close:hover {
  background: var(--color-border);
  color: var(--color-text-primary);
}

.contact-modal__header {
  padding: 28px 28px 0;
  text-align: center;
}

.contact-modal__icon {
  width: 54px;
  height: 54px;
  background: #fce7f3;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #db2777;
  margin: 0 auto 14px;
}

.contact-modal__title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.contact-modal__sub {
  margin: 0;
  font-size: .82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.contact-modal__body {
  padding: 20px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact-modal__field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.contact-modal__label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.contact-modal__input {
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: .88rem;
  color: var(--color-text-body);
  background: var(--color-page-bg);
  outline: none;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}

.contact-modal__input:focus {
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.contact-modal__input::placeholder {
  color: var(--color-border-dark);
}

.contact-modal__textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.contact-modal__error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: .82rem;
  color: #dc2626;
  font-weight: 500;
}

.contact-modal__error[hidden] {
  display: none;
}

.contact-modal__send {
  width: 100%;
  padding: 12px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, opacity .15s;
}

.contact-modal__send:hover {
  background: var(--color-primary-dark);
}

.contact-modal__send:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.contact-modal__success {
  text-align: center;
  padding: 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  color: #16a34a;
  font-size: .88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.contact-modal__success[hidden] {
  display: none;
}
