/* ===== SIDEBAR ===== */
.sidebar {
  width: 280px;
  min-width: 280px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  position: sticky;
  top: 64px;
}
.sidebar-inner { padding-bottom: 2rem; }

@media (max-width: 991px) {
  .sidebar { display: none; }
}

.filter-group {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid #f0ece4;
}
.filter-group:last-of-type { border-bottom: none; }

.filter-label {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  display: block;
  margin-bottom: 4px;
}
.filter-hint {
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 6px;
}
.fs-sm { font-size: 13px; }

/* Checkboxes & radios dorados */
.check-gold:checked {
  background-color: #C8A96E;
  border-color: #C8A96E;
}
.check-gold:focus { box-shadow: 0 0 0 .2rem rgba(200,169,110,.25); }

/* Range slider */
.range-gold {
  accent-color: #C8A96E;
}

/* Botones de filtro tipo pill */
.btn-filter {
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1.5px solid #e5e7eb;
  border-radius: 20px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition: all .18s;
}
.btn-filter:hover { border-color: #C8A96E; color: #C8A96E; }
.btn-filter--active {
  background: #C8A96E;
  border-color: #C8A96E;
  color: #fff;
  font-weight: 600;
}

/* ===== BARRA SUPERIOR ===== */
.view-btn.active {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
}

/* ---- TOPBAR MÓVIL (< 992px): controles arriba, contador abajo ---- */
.topbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.topbar-counter { order: 2; }
.topbar-controls { order: 1; }
.topbar-select { flex: 1 1 auto; min-width: 0; }

/* ---- TOPBAR DESKTOP (≥ 992px): una sola fila ---- */
@media (min-width: 992px) {
  .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
  .topbar-counter { order: 1; white-space: nowrap; }
  .topbar-controls { order: 2; }
  .topbar-select { width: auto; min-width: 160px; flex: 0 0 auto; }
}

/* ===== PROP CARDS ===== */
.agency-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

/* Badge "Nuevo" */
.badge-new {
  background-color: #1a1a2e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

/* ===== PAGINACIÓN ===== */
.page-link-gold {
  background-color: #C8A96E !important;
  border-color: #C8A96E !important;
  color: #fff !important;
}
.page-link:focus { box-shadow: 0 0 0 .2rem rgba(200,169,110,.25); }
.page-link:hover { color: #C8A96E; }

/* ===== NAV ACTIVE ===== */
.nav-active { color: #C8A96E !important; }

/* ===== MAPA ===== */
#mapaLeaflet {
  width: 100%;
  height: calc(100vh - 180px);
  min-height: 420px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  z-index: 0;
}

/* Marcador precio dorado */
.mapa-marker {
  position: absolute;
  /* centre the pill on the anchor point and sit it above */
  transform: translate(-50%, calc(-100% - 8px));
  display: inline-flex;
  align-items: center;
  background: #C8A96E;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  padding: 5px 10px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0,0,0,.28);
  border: 2px solid #fff;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.mapa-marker::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #C8A96E;
}
.mapa-marker:hover { background: #A8893E; transform: translate(-50%, calc(-100% - 8px)) scale(1.06); }

/* Popup del mapa */
.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  padding: 0 !important;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(0,0,0,.15) !important;
}
.leaflet-popup-content { margin: 0 !important; width: auto !important; }
.leaflet-popup-tip-container { display: none; }

.mapa-popup__img {
  height: 120px;
  background-size: cover;
  background-position: center;
  position: relative;
}
.mapa-popup__tipo {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #C8A96E;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.mapa-popup__body { padding: 12px 14px; }
.mapa-popup__precio { font-size: 16px; font-weight: 800; color: #1a1a2e; margin-bottom: 2px; }
.mapa-popup__titulo { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; line-height: 1.3; }
.mapa-popup__features { display: flex; gap: 10px; font-size: 12px; color: #6b7280; margin-bottom: 5px; }
.mapa-popup__features i { color: #C8A96E; }
.mapa-popup__zona { font-size: 11px; color: #9ca3af; margin-bottom: 10px; }
.mapa-popup__zona i { color: #C8A96E; }
.mapa-popup__btn {
  display: block;
  text-align: center;
  background: #C8A96E;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 7px;
  border-radius: 6px;
  text-decoration: none;
  transition: background .18s;
}
.mapa-popup__btn:hover { background: #A8893E; color: #fff; }

@media (max-width: 767px) {
  #mapaLeaflet { height: calc(100vh - 220px); min-height: 360px; }
}

/* ===== SCROLLBAR SIDEBAR ===== */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

/* ===== RESPONSIVE MAIN ===== */
@media (max-width: 991px) {
  main.flex-fill { padding: 1rem !important; }
}
@media (max-width: 575px) {
  main.flex-fill { padding: .75rem !important; }
  /* 1 columna en xs */
  #propsGrid .col-sm-6 { flex: 0 0 100%; max-width: 100%; }
  .pagination { flex-wrap: wrap; justify-content: center; gap: 2px; }
}

.ficha-gallery { display: grid; gap: 6px; border-radius: 16px; overflow: hidden; }
  .ficha-gallery--1 { grid-template-columns: 1fr; }
  .ficha-gallery--2 { grid-template-columns: 2fr 1fr; }
  .ficha-gallery--3,
  .ficha-gallery--4plus { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
  .gallery-main { background-size: cover; background-position: center; border-radius: 0; }
  .ficha-gallery--3 .gallery-main,
  .ficha-gallery--4plus .gallery-main { grid-row: 1 / 3; }
  .gallery-thumb { background-size: cover; background-position: center; cursor: pointer; position: relative; }
  .gallery-thumb:hover::after { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,.15); }
  .gallery-more-btn {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.45); color: #fff; font-weight: 700; font-size: 18px;
    cursor: pointer; text-decoration: none;
  }
  .gallery-main { min-height: 360px; }
  .gallery-thumb { min-height: 174px; }
  @media (max-width: 767px) {
    .ficha-gallery--2,
    .ficha-gallery--3,
    .ficha-gallery--4plus { grid-template-columns: 1fr; grid-template-rows: auto; }
    .ficha-gallery--3 .gallery-main,
    .ficha-gallery--4plus .gallery-main { grid-row: auto; }
    .gallery-thumb { display: none; }
    .gallery-main { min-height: 260px; border-radius: 12px; }
  }

  /* ===== FICHA DETAIL ===== */
  .ficha-price { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; color: #1a1a2e; }
  .ficha-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .ficha-stat-icon { font-size: 22px; color: #C8A96E; }
  .ficha-stat-val { font-size: 16px; font-weight: 700; color: #1a1a2e; }
  .ficha-stat-label { font-size: 11px; color: #9ca3af; text-transform: uppercase; letter-spacing: .04em; }

  .ficha-section-title {
    font-size: 16px; font-weight: 700; color: #1a1a2e;
    padding-bottom: 10px; border-bottom: 2px solid #C8A96E;
    display: inline-block; margin-bottom: 18px;
  }

  .ficha-feature-item {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: #374151; padding: 8px 0;
    border-bottom: 1px solid #f5f4f0;
  }
  .ficha-feature-item:last-child { border-bottom: none; }
  .ficha-feature-item i { color: #C8A96E; font-size: 15px; width: 20px; text-align: center; }

  /* Sidebar ficha */
  .ficha-sidebar { position: sticky; top: 80px; }
  .ficha-contact-card {
    background: #fff; border: 1px solid #e5e7eb; border-radius: 16px;
    padding: 24px; box-shadow: 0 4px 20px rgba(0,0,0,.07);
  }
  .ficha-agency-logo {
    width: 52px; height: 52px; border-radius: 12px; object-fit: cover;
  }
  .ficha-tel-btn {
    background: #1a1a2e; color: #fff; border-radius: 10px;
    padding: 12px; font-weight: 700; font-size: 15px;
    border: none; width: 100%; transition: background .18s;
  }
  .ficha-tel-btn:hover { background: #2d2d44; color: #fff; }

  /* Mapa ficha */
  #fichaMap { height: 300px; border-radius: 12px; border: 1px solid #e5e7eb; }

  /* Breadcrumb oscuro */
  .ficha-breadcrumb { background: #1a1a2e; padding: 14px 0; }
  .ficha-breadcrumb .breadcrumb-item a { color: #C8A96E; font-size: 13px; text-decoration: none; }
  .ficha-breadcrumb .breadcrumb-item.active { color: rgba(255,255,255,.55); font-size: 13px; }
  .ficha-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,.3); }

  /* Badge operación */
  .badge-op { font-size: 12px; font-weight: 700; padding: 5px 14px; border-radius: 20px; }
  .badge-op--venta { background: #C8A96E; color: #fff; }
  .badge-op--alquiler { background: #5b8db8; color: #fff; }