/* ==========================================================================
   Find Home — Map-First Property Search
   ========================================================================== */

/* ---- Page Layout ---- */
.fh-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---- Filter Bar ---- */
.fh-filters {
  position: sticky;
  top: 48px;
  z-index: 30;
  background: var(--card, #fff);
  border-bottom: 1px solid var(--border, rgba(16,24,40,.10));
  padding: 8px 0;
}
.fh-filters-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.fh-filters-inner::-webkit-scrollbar { display: none; }

/* ---- Search Input ---- */
.fh-search-wrap {
  position: relative;
  flex: 0 0 280px;
  min-width: 200px;
}
.fh-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--text-muted, #999);
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}
.fh-search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border: 1px solid var(--border, rgba(16,24,40,.10));
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text, #0b1220);
  background: var(--card, #fff);
  outline: none;
  transition: border-color .15s;
}
.fh-search-input:focus {
  border-color: var(--brand, #0f5fff);
}

/* ---- Autocomplete Dropdown ---- */
.fh-autocomplete {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow, 0 14px 44px rgba(0,0,0,.18));
  max-height: 260px;
  overflow-y: auto;
  z-index: 50;
}
.fh-autocomplete.open { display: block; }
.fh-ac-item {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.fh-ac-item:last-child { border-bottom: none; }
.fh-ac-item:hover { background: rgba(15,95,255,.06); }
.fh-ac-type {
  font-size: 11px;
  color: var(--text-muted, #999);
  margin-left: 6px;
}

/* ---- Filter Chips ---- */
.fh-chip-wrap {
  position: relative;
  flex-shrink: 0;
}
.fh-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  border: 1px solid var(--border, rgba(16,24,40,.10));
  border-radius: 20px;
  background: var(--card, #fff);
  font-size: 13px;
  font-family: inherit;
  color: var(--text, #0b1220);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, box-shadow .15s;
}
.fh-filter-chip:hover,
.fh-filter-chip.active {
  border-color: var(--brand, #0f5fff);
  box-shadow: 0 0 0 2px rgba(15,95,255,.10);
}
.fh-chip-arrow {
  width: 14px;
  height: 14px;
  stroke: var(--text-muted, #999);
  fill: none;
  stroke-width: 2;
  transition: transform .15s;
}
.fh-filter-chip.open .fh-chip-arrow {
  transform: rotate(180deg);
}

/* ---- Filter Dropdowns ---- */
.fh-filter-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: var(--card, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow, 0 14px 44px rgba(0,0,0,.18));
  z-index: 50;
  padding: 8px 0;
}
.fh-filter-dropdown.open { display: block; }
.fh-dropdown--wide { min-width: 260px; }
.fh-dropdown-list {
  max-height: 260px;
  overflow-y: auto;
}
.fh-dropdown-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background .1s;
}
.fh-dropdown-option:hover { background: rgba(15,95,255,.06); }
.fh-dropdown-option input[type="radio"],
.fh-dropdown-option input[type="checkbox"] {
  accent-color: var(--brand, #0f5fff);
}

/* ---- Price Inputs ---- */
.fh-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.fh-price-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--card, #fff);
  outline: none;
  width: 80px;
}
.fh-price-input:focus { border-color: var(--brand); }
.fh-price-sep { color: var(--text-muted); font-size: 14px; }
.fh-price-apply {
  display: block;
  width: calc(100% - 28px);
  margin: 10px 14px;
  padding: 8px;
  background: var(--brand, #0f5fff);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ---- Clear Button ---- */
.fh-clear-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  border: none;
  background: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--brand, #0f5fff);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
}
.fh-clear-btn:hover { text-decoration: underline; }

/* ---- Results Bar ---- */
.fh-results-bar {
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-muted, #999);
  background: var(--card, #fff);
  border-bottom: 1px solid var(--border);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
.fh-results-count {
  font-weight: 700;
  color: var(--text, #0b1220);
  font-size: 15px;
}
.fh-results-location {
  margin-left: 4px;
  font-weight: 500;
}

/* ---- Main Content ---- */
.fh-main {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ---- Map ---- */
.fh-map-wrap {
  width: 100%;
  height: 100%;
  position: relative;
}
#fhMap {
  width: 100%;
  height: 100%;
}

/* ---- Map Loading ---- */
.fh-map-loading {
  display: none;
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: var(--card, #fff);
  padding: 8px 18px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.fh-map-loading.visible { display: flex; align-items: center; gap: 8px; }
.fh-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand, #0f5fff);
  border-radius: 50%;
  animation: fh-spin .6s linear infinite;
}
@keyframes fh-spin { to { transform: rotate(360deg); } }

/* ---- Carousel ---- */
.fh-carousel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 15;
  padding: 0 0 12px;
  pointer-events: none;
}
.fh-carousel > * { pointer-events: auto; }
.fh-carousel-inner {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 8px 52px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.fh-carousel-inner::-webkit-scrollbar { display: none; }

/* ---- Carousel Arrows ---- */
.fh-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 16;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--card, #fff);
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fh-carousel-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--text, #0b1220);
  fill: none;
  stroke-width: 2;
}
.fh-carousel-btn--left { left: 10px; }
.fh-carousel-btn--right { right: 10px; }
.fh-carousel-btn:hover { background: var(--brand, #0f5fff); }
.fh-carousel-btn:hover svg { stroke: #fff; }

/* ---- Listing Card ---- */
.fh-card {
  flex: 0 0 260px;
  background: var(--card, #fff);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  border: 2px solid transparent;
}
.fh-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
}
.fh-card.highlighted {
  border-color: var(--brand, #0f5fff);
}
.fh-card-img {
  position: relative;
  height: 160px;
  overflow: hidden;
  background: var(--border);
}
.fh-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.fh-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.fh-badge-sale { background: var(--brand, #0f5fff); color: #fff; }
.fh-badge-lease { background: #f79009; color: #fff; }
.fh-card-heart {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.85);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fh-card-heart svg {
  width: 16px;
  height: 16px;
  stroke: var(--text);
  fill: none;
  stroke-width: 2;
}
.fh-card-heart.saved svg { fill: #f04438; stroke: #f04438; }
.fh-card-body {
  padding: 12px 14px;
}
.fh-card-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #0b1220);
  margin-bottom: 4px;
}
.fh-card-addr {
  font-size: 13px;
  color: var(--text, #0b1220);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.fh-card-location {
  font-size: 12px;
  color: var(--text-muted, #999);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 8px;
}
.fh-card-location svg {
  width: 12px;
  height: 12px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
}
.fh-card-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted, #999);
}
.fh-card-meta span {
  display: flex;
  align-items: center;
  gap: 3px;
}
.fh-card-meta svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
}

/* ---- Cluster Markers ---- */
.fh-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand, #0f5fff);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border: 3px solid rgba(255,255,255,.9);
  box-shadow: 0 2px 10px rgba(15,95,255,.35);
}
.fh-cluster--large {
  width: 52px;
  height: 52px;
  font-size: 14px;
}

/* ---- Price Tag Markers ---- */
.fh-price-tag {
  background: var(--card, #fff);
  color: var(--text, #0b1220);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
  border: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.fh-price-tag:hover,
.fh-price-tag.highlighted {
  background: var(--brand, #0f5fff);
  color: #fff;
  border-color: var(--brand);
}

/* ---- No Results ---- */
.fh-no-results {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ═══════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════ */
[data-theme="dark"] .fh-filters,
[data-theme="dark"] .fh-results-bar {
  background: var(--panel, #1a1f2e);
}
[data-theme="dark"] .fh-search-input,
[data-theme="dark"] .fh-filter-chip,
[data-theme="dark"] .fh-price-input {
  background: var(--card, #232838);
  color: var(--text, #e2e8f0);
  border-color: var(--border, rgba(255,255,255,.08));
}
[data-theme="dark"] .fh-filter-dropdown,
[data-theme="dark"] .fh-autocomplete {
  background: var(--card, #232838);
  border-color: var(--border);
}
[data-theme="dark"] .fh-card {
  background: var(--card, #232838);
}
[data-theme="dark"] .fh-card-price { color: var(--text, #e2e8f0); }
[data-theme="dark"] .fh-card-addr { color: var(--text, #e2e8f0); }
[data-theme="dark"] .fh-price-tag {
  background: var(--card, #232838);
  color: var(--text, #e2e8f0);
  border-color: var(--border);
}
[data-theme="dark"] .fh-carousel-btn {
  background: var(--card, #232838);
}
[data-theme="dark"] .fh-carousel-btn svg {
  stroke: var(--text, #e2e8f0);
}
[data-theme="dark"] .fh-map-loading {
  background: var(--card, #232838);
}
[data-theme="dark"] .fh-card-heart {
  background: rgba(35,40,56,.85);
}
[data-theme="dark"] .fh-card-heart svg {
  stroke: var(--text, #e2e8f0);
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .fh-search-wrap { flex: 0 0 200px; min-width: 160px; }
  .fh-card { flex: 0 0 220px; }
  .fh-card-img { height: 130px; }
  .fh-carousel-inner { padding: 8px 44px; }
  .fh-results-bar { padding: 4px 12px; font-size: 12px; }
}

@media (max-width: 480px) {
  .fh-search-wrap { flex: 0 0 160px; min-width: 140px; }
  .fh-card { flex: 0 0 200px; }
  .fh-card-img { height: 110px; }
  .fh-card-price { font-size: 16px; }
  .fh-carousel-btn { width: 30px; height: 30px; }
  .fh-carousel-btn svg { width: 14px; height: 14px; }
  .fh-carousel-btn--left { left: 4px; }
  .fh-carousel-btn--right { right: 4px; }
  .fh-carousel-inner { padding: 8px 36px; gap: 8px; }
}
