/* ============================================================
   listings.css -- map + filters page (imoveis.html) only
   ============================================================ */

/* ── Filter Bar ─────────────────────────────────────────── */
.filter-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 100;
  margin-top: var(--header-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

/* Simple option buttons */
.dd-opt {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.812rem;
  font-weight: 300;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s;
}
.dd-opt:hover { background: var(--color-bg); }
.dd-opt.selected {
  color: var(--color-dark);
  font-weight: 500;
  background: rgba(201, 168, 76, 0.06);
}

/* City multi-select */
.dd-city-actions {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
}
.dd-action-btn {
  flex: 1;
  padding: 5px 8px;
  font-family: var(--font-body);
  font-size: 0.688rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: border-color 0.15s, color 0.15s;
}
.dd-action-btn:hover { border-color: var(--color-dark); color: var(--color-dark); }

.dd-city-options { padding: 4px 0; }

.dd-city-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 0.812rem;
  font-weight: 300;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}
.dd-city-opt:hover { background: var(--color-bg); }
.dd-city-opt input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--color-dark);
  cursor: pointer;
  flex-shrink: 0;
}

/* Area max input (pill-shaped) */
.fbar-area-input {
  padding: 8px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 24px;
  background: var(--color-bg);
  font-family: var(--font-body);
  font-size: 0.812rem;
  font-weight: 400;
  color: var(--color-text);
  outline: none;
  width: 160px;
  line-height: 1.4;
  transition: border-color 0.2s;
}
.fbar-area-input::placeholder { color: var(--color-text-secondary); }
.fbar-area-input:focus { border-color: var(--color-dark); }
.fbar-area-input::-webkit-inner-spin-button,
.fbar-area-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.fbar-area-input[type="number"] { -moz-appearance: textfield; }

/* Price dropdown */
.fbar-price-dd {
  min-width: 290px;
  padding: 16px 20px 20px;
}
.price-dd-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 6px;
}

/* Dual range slider */
.range-wrap {
  position: relative;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  margin: 20px 8px 6px;
}
.range-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--color-dark);
  border-radius: 2px;
  pointer-events: none;
  left: 0%;
  right: 0%;
}
.range-wrap input[type="range"] {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  outline: none;
  pointer-events: none;
  margin: 0;
  padding: 0;
}
.range-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-dark);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  pointer-events: all;
}
.range-wrap input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-dark);
  border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  pointer-events: all;
}

/* Limpar button */
.fbar-clear {
  flex-shrink: 0;
  margin-left: auto;
  padding: 8px 16px;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  cursor: pointer;
  text-decoration: underline;
  white-space: nowrap;
  transition: color 0.2s;
}
.fbar-clear:hover { color: var(--color-dark); }

/* ============================================================
   MAP + FILTERS PAGE (imoveis.html)
   ============================================================ */

/* -- Two-column layout: sidebar left, map right -------------- */
.listings-layout {
  display: grid;
  grid-template-columns: 40fr 60fr;
  height: calc(100vh - var(--header-h) - var(--fbar-h));
  margin-top: 0;
}

/* -- Map panel (right) --------------------------------------- */
.map-panel {
  position: sticky;
  top: calc(var(--header-h) + var(--fbar-h));
  height: calc(100vh - var(--header-h) - var(--fbar-h));
  overflow: hidden;
}

#properties-map {
  width: 100%;
  height: 100%;
}

/* -- Cluster markers ----------------------------------------- */
.map-cluster {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-dark);
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.map-cluster:hover {
  transform: scale(1.10);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

/* -- Sidebar (right): filters + card list -------------------- */
.listings-sidebar {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h) - var(--fbar-h));
  overflow: hidden;
  background: var(--color-bg);
  border-right: 1px solid var(--color-border);
}

#clear-filters {
  font-size: 0.688rem;
  font-family: var(--font-body);
  color: var(--color-text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

#clear-filters:hover { color: var(--color-dark); }

/* -- Results panel ------------------------------------------- */
.sidebar-results {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.sidebar-count {
  font-size: 0.688rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--color-border);
  margin: 0;
}

/* Header row: results count on the left, sort pill on the right */
.sidebar-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-results-head .sidebar-count {
  padding: 0;
  border-bottom: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sort-icon {
  width: 14px;
  height: 14px;
  stroke: var(--color-primary-deep);
  flex-shrink: 0;
}

/* -- Compact property card ----------------------------------- */
.compact-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition), border-left var(--transition);
  border-left: 3px solid transparent;
}

.compact-card:hover {
  background: var(--color-surface);
  border-left-color: var(--color-primary);
}

.compact-card.map-highlighted {
  background: var(--color-surface);
  border-left-color: var(--color-primary);
}

.compact-card-thumb {
  width: 96px;
  min-width: 96px;
  height: 72px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.compact-card-info {
  flex: 1;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.compact-card-title {
  font-size: 0.812rem;
  font-weight: 400;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.compact-card-title-link {
  color: inherit;
  text-decoration: none;
}

.compact-card-title-link:hover {
  color: var(--color-primary-deep);
  text-decoration: underline;
}

/* ---- Map-mode card (imoveis.html sidebar) -------------------
   Body click focuses the map instead of navigating. The photo gets
   the bulk of the card and carries the price as a gold pill. */
.compact-card-map {
  cursor: pointer;
  height: 166px; /* uniform rows keep the list rhythm clean */
  overflow: hidden;
}

.compact-card-map:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.compact-card-map .compact-card-media {
  position: relative;
  width: 240px;
  min-width: 240px;
  flex: none;
  overflow: hidden;
}

.compact-card-map .compact-card-thumb {
  width: 100%;
  min-width: 0;
  height: 100%;
}

.compact-card-price-pill {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 5px 12px;
  border-radius: 4px;
  background: var(--color-primary);
  color: var(--color-darker);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.15;
  font-variant-numeric: lining-nums;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.compact-card-map .compact-card-info {
  padding: 12px 16px;
  gap: 2px;
}

.compact-card-map .compact-card-title {
  font-size: 0.95rem;
  line-height: 1.3;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.compact-card-map .compact-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.compact-card-map .compact-card-view {
  margin-top: 0;
}

/* Price floor label inside the gold pill ("A partir de R$ …") */
.compact-card-price-pill .pill-from {
  display: block;
  font-family: var(--font-body);
  font-size: 0.5rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  line-height: 1.4;
  opacity: 0.75;
}

/* ---- Building groups: unit-count chip + expandable unit list ---- */
.compact-card-units-chip {
  flex: none;
  padding: 3px 11px;
  border: 1px solid var(--color-primary);
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-primary-deep);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.compact-card-units-chip::after {
  content: ' \25be';
  display: inline-block;
  transition: transform var(--transition);
}

.compact-card-units-chip:hover,
.compact-card-units-chip[aria-expanded="true"] {
  background: var(--color-primary);
  color: var(--color-darker);
}

.compact-card-units-chip[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.sidebar-entry.is-open .compact-card-map {
  background: var(--color-surface);
  border-left-color: var(--color-primary);
}

.compact-card-units {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
}

.unit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 18px 9px 21px;
  border-top: 1px solid var(--color-border);
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--color-text-secondary);
  transition: background var(--transition), color var(--transition);
}

.unit-row:hover {
  background: var(--color-bg);
  color: var(--color-primary-deep);
}

.unit-row-arrow {
  flex: none;
  color: var(--color-primary);
  font-size: 1rem;
}

.compact-card-view {
  display: inline-block;
  align-self: flex-start;
  margin-top: 4px;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-primary-deep);
  text-decoration: none;
}

.compact-card-view:hover {
  text-decoration: underline;
}

.compact-card-location {
  font-size: 0.688rem;
  font-weight: 300;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.compact-card-meta {
  font-size: 0.688rem;
  font-weight: 300;
  color: var(--color-text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}

/* -- Responsive: mobile -------------------------------------- */
@media (max-width: 768px) {
  .filter-bar { padding: 8px 12px; gap: 6px; }

  .listings-layout {
    display: block;
    height: auto;
    margin-top: 0;
  }

  .map-panel {
    position: relative;
    top: 0;
    height: 260px;
  }

  .listings-sidebar {
    height: auto;
    max-height: none;
    border-left: none;
    border-top: 1px solid var(--color-border);
  }

  .sidebar-results {
    overflow-y: visible;
    max-height: none;
  }

  /* Scale the sidebar card's photo down so the text keeps room on phones */
  .compact-card-map { height: 152px; }
  .compact-card-map .compact-card-media { width: 132px; min-width: 132px; }
  .compact-card-map .compact-card-info { padding: 10px 12px; }
  .compact-card-map .compact-card-title { font-size: 0.85rem; }

  .compact-card-price-pill {
    left: 6px;
    bottom: 6px;
    padding: 3px 8px;
    font-size: 0.85rem;
  }

  .fbar-price-dd { min-width: 260px; }
}
