/* ================================================
   Apuntavamos.com — Modern Design System
   Inspirado en realtor.com
   ================================================ */

/* ---------- Variables ---------- */
:root {
  --primary:       #e86e27;
  --primary-dark:  #c75c18;
  --primary-light: #fef3ec;
  --bg:            #f4f5f7;
  --white:         #ffffff;
  --text:          #1a1a2e;
  --text-mid:      #4b5563;
  --text-light:    #6b7280;
  --border:        #e5e7eb;
  --shadow-xs:     0 1px 2px rgba(0,0,0,0.06);
  --shadow-sm:     0 1px 6px rgba(0,0,0,0.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:     0 8px 28px rgba(0,0,0,0.13);
  --radius-sm:     5px;
  --radius:        10px;
  --radius-lg:     14px;
  --transition:    0.18s ease;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-w:         1280px;
  --header-h:      66px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
h1, h2, h3, h4, h5 { line-height: 1.3; font-weight: 700; }
ul { list-style: none; }
button { font-family: var(--font); }

/* ---------- Container ---------- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* ======================================================
   HEADER
   ====================================================== */
#header-section,
.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  box-shadow: var(--shadow-xs);
}
#header-section > .container,
.site-header > .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Logo */
.logo a { display: flex; align-items: center; }
.logo img { height: 38px; width: auto; }

/* Nav */
nav.navi.main-nav,
.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
}
nav.navi.main-nav > ul,
.main-nav > ul {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
nav.navi.main-nav > ul > li,
.main-nav > ul > li {
  position: relative;
  list-style: none;
}
nav.navi.main-nav > ul > li > a,
.main-nav > ul > li > a {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 13px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  white-space: nowrap;
}
nav.navi.main-nav > ul > li > a:hover,
.main-nav > ul > li > a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* Dropdown sub-menu */
nav.navi.main-nav ul.sub-menu,
.main-nav .sub-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 185px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all var(--transition);
  z-index: 600;
  list-style: none;
  padding: 6px 0;
}
nav.navi.main-nav > ul > li:hover > ul.sub-menu,
.main-nav > ul > li:hover .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
nav.navi.main-nav ul.sub-menu li a,
.main-nav .sub-menu li a {
  display: block;
  padding: 9px 16px;
  font-size: 14px;
  color: var(--text-mid);
  transition: all var(--transition);
  text-transform: capitalize;
}
nav.navi.main-nav ul.sub-menu li a:hover,
.main-nav .sub-menu li a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Favorites link in nav */
nav.navi.main-nav > ul > li > a .fa-heart,
.main-nav .fa-heart { color: var(--primary); }

/* Mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* Back-to-top (rendered inside header echo in PHP) */
.back-top, .scrolltop-btn {
  position: fixed !important;
  bottom: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  background: var(--primary);
  color: var(--white) !important;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
  z-index: 490;
}
.back-top.visible, .scrolltop-btn.visible { display: flex; }
.back-top:hover, .scrolltop-btn:hover { background: var(--primary-dark); }

/* ======================================================
   SEARCH BAR
   ====================================================== */
.advanced-search,
.search-section {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.search-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.search-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.search-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.search-select,
.search-input {
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-width: 140px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.search-select:focus,
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232,110,39,0.12);
}
input.search-input {
  background-image: none;
  padding-right: 12px;
}
.search-btn {
  height: 42px;
  padding: 0 24px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background var(--transition);
  white-space: nowrap;
}
.search-btn:hover { background: var(--primary-dark); }
.advanced-toggle {
  height: 42px;
  padding: 0 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
  white-space: nowrap;
}
.advanced-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* Advanced fields panel */
.advanced-fields-panel {
  display: none;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
}
.advanced-fields-panel.open { display: flex; }
/*.advanced-fields-panel .search-select,
.advanced-fields-panel .search-input {
  flex: 1 1 150px;
}*/

/* ======================================================
   PAGE LAYOUT — LISTING
   ====================================================== */
.listing-section {
  padding: 24px 0 48px;
}
.breadcrumb-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 14px;
}
.breadcrumb-bar a { color: var(--text-light); }
.breadcrumb-bar a:hover { color: var(--primary); }
.breadcrumb-bar .sep { opacity: 0.4; }

.listing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.listing-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.listing-count {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 2px;
  font-weight: 400;
}

/* ======================================================
   PROPERTY GRID
   ====================================================== */
.property-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ======================================================
   PROPERTY CARD
   ====================================================== */
.prop-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
}
.prop-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

/* Photo */
.prop-photo {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #e8e8e8;
}
.prop-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.prop-card:hover .prop-photo img { transform: scale(1.05); }

/* Photo overlays */
.prop-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1;
}
.prop-badge-sale  { background: var(--primary); color: #fff; }
.prop-badge-rent  { background: #1d6fa4;        color: #fff; }
.prop-badge-general { background: #2f855a;      color: #fff; }

.prop-visited {
  position: absolute;
  top: 10px;
  right: 48px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.prop-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.92);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: var(--shadow-xs);
}
.prop-fav i { font-size: 13px; color: var(--text-light); transition: color var(--transition); }
.prop-fav:hover, .prop-fav.active { background: var(--primary); }
.prop-fav:hover i, .prop-fav.active i { color: #fff; }

.prop-code {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  letter-spacing: 0.3px;
}

/* Card body */
.prop-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.prop-price {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.prop-price-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-light);
  margin-bottom: 8px;
  margin-top: 2px;
}
.prop-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.prop-title a { color: inherit; }
.prop-title a:hover { color: var(--primary); }
.prop-location {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.prop-location i { font-size: 11px; }

/* Amenities bar */
.prop-amenities {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.prop-amen {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-mid);
}
.prop-amen i { color: var(--primary); font-size: 12px; }
.prop-amen strong { color: var(--text); font-weight: 600; }

/* Card footer */
.prop-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-light);
  margin-top: auto;
}
.prop-agency {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}
.prop-agency a {
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
  display: inline-block;
}
.prop-agency a:hover { color: var(--primary); }
.prop-date {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ======================================================
   PAGINATION
   ====================================================== */
.pagination-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin-top: 36px;
  flex-wrap: wrap;
}
.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-mid);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: default;
}

/* ======================================================
   OVERLAY / LIGHTBOX
   ====================================================== */
#Mostar {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding-top: 60px;
}
#Mostar.open { display: flex; }

/* Wide mode — for map / street-view iframes */
#Mostar.overlay-wide {
  padding: 16px;
  align-items: center;
}
#Mostar.overlay-wide .overlay-box {
  max-width: 94vw;
  width: 94vw;
  height: 88vh;
  max-height: 88vh;
}
#Mostar.overlay-wide #contenido {
  padding: 0;
}

.overlay-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 90%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}
.overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.overlay-head p { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.overlay-head img { height: 22px; }
.overlay-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.overlay-close:hover { background: #f3f4f6; color: var(--text); }
#contenido {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* ── Inmobiliaria popup (cargado via fetchOverlay) ── */
.inmo-popup {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.inmo-popup-logo {
  flex-shrink: 0;
  width: 150px;
}
.inmo-popup-logo img { width: 100%; height: auto; border-radius: var(--radius-sm); }
.inmo-popup-info h3 { font-size: 1.05rem; margin-bottom: 4px; color: var(--text); }
.inmo-addr { color: var(--text-mid); font-size: 13px; margin-bottom: 12px; }
.inmo-contact-list { list-style: none; padding: 0; margin: 0 0 12px; }
.inmo-contact-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.inmo-contact-list a { color: var(--text); }
.inmo-contact-list a:hover { color: var(--primary); }
.inmo-social { display: flex; gap: 8px; margin-bottom: 14px; }
.inmo-social a {
  display: inline-flex; width: 30px; height: 30px; border-radius: 50%;
  align-items: center; justify-content: center;
  background: var(--bg); color: var(--text); font-size: 13px;
  transition: background var(--transition), color var(--transition);
}
.inmo-social a:hover { background: var(--primary); color: #fff; }
.inmo-listings-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-mid); margin-bottom: 8px;
}
.inmo-listings-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.inmo-listing-item {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 10px;
  background: var(--bg); border-radius: 20px;
  border: 1px solid var(--border);
}
.inmo-listing-item a { color: var(--text); }
.inmo-listing-item a:hover { color: var(--primary); }
.inmo-listing-count { color: var(--text-light); }

/* ======================================================
   INMOBILIARIAS — listing grid
   ====================================================== */
.inmo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 8px;
}
.inmo-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow var(--transition), transform var(--transition);
}
.inmo-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: var(--text);
}
.inmo-card-logo {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.inmo-card-logo img {
  max-height: 130px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
}
.inmo-card-body { padding: 14px 16px 16px; flex: 1; }
.inmo-card-name {
  font-size: 14px; font-weight: 700; margin-bottom: 8px;
  color: var(--text); line-height: 1.3;
}
.inmo-card-detail {
  font-size: 12px; color: var(--text-mid);
  margin-bottom: 4px; display: flex; align-items: center; gap: 6px;
}

/* ======================================================
   INMOBILIARIA — full page profile
   ====================================================== */
.inmo-page-layout {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
}
.inmo-page-logo-col {
  position: sticky;
  top: calc(var(--header-h) + 16px);
}
.inmo-page-logo-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.inmo-page-logo-box img {
  max-width: 100%; max-height: 160px;
  object-fit: contain; margin: 0 auto 14px;
}
.inmo-habilitada {
  display: inline-flex; flex-direction: column; align-items: center;
  gap: 4px; font-size: 12px; color: var(--text-light);
  margin-top: 10px;
}
.inmo-habilitada img { width: 52px; }
.inmo-page-info { min-width: 0; }
.inmo-info-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
}
.inmo-info-card h1 {
  font-size: 1.4rem; margin-bottom: 4px;
}
.inmo-info-addr {
  color: var(--text-mid); font-size: 14px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 6px;
}
.inmo-tel-list { list-style: none; padding: 0; margin: 0 0 14px; }
.inmo-tel-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.inmo-tel-list li:last-child { border-bottom: none; }
.inmo-tel-list a { color: var(--text); font-weight: 600; }
.inmo-tel-list a:hover { color: var(--primary); }
.inmo-social-row { display: flex; gap: 8px; margin-bottom: 14px; }
.inmo-social-row a {
  display: inline-flex; width: 34px; height: 34px; border-radius: 50%;
  align-items: center; justify-content: center;
  background: var(--bg); color: var(--text); font-size: 15px;
  border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
}
.inmo-social-row a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.inmo-pub-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-mid);
  margin-bottom: 12px; margin-top: 20px;
}
.inmo-pub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.inmo-pub-item {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.inmo-pub-item a {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.inmo-pub-item a:hover { color: var(--primary); }
.inmo-pub-count {
  font-size: 20px; font-weight: 700; color: var(--primary);
}
.inmo-map-wrap {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); margin-top: 20px;
}
.inmo-map-wrap iframe { display: block; }
.inmo-contact-col {
  position: sticky;
  top: calc(var(--header-h) + 16px);
}
.inmo-contact-box {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.inmo-contact-box-head {
  background: var(--primary); color: #fff;
  padding: 12px 16px; font-size: 14px; font-weight: 700;
}
.inmo-contact-box-body { padding: 16px; }

@media (max-width: 1024px) {
  .inmo-page-layout { grid-template-columns: 220px 1fr; }
  .inmo-contact-col { grid-column: 1 / -1; position: static; }
}
@media (max-width: 700px) {
  .inmo-page-layout { grid-template-columns: 1fr; }
  .inmo-page-logo-col { position: static; }
  .inmo-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .inmo-card-logo { height: 120px; }
}

/* ======================================================
   FOOTER
   ====================================================== */
.site-footer,
footer.footer-v2 {
  background: #16213e;
  color: #9ca3af;
  margin-top: 40px;
}
.footer-main {
  padding: 48px 20px 32px;
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.footer-col h4,
.footer-widget .widget-title {
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}
.footer-col ul li,
.footer-widget ul li { margin-bottom: 9px; }
.footer-col ul li a,
.footer-widget ul li a {
  color: #9ca3af;
  font-size: 14px;
  transition: color var(--transition);
}
.footer-col ul li a:hover,
.footer-widget ul li a:hover { color: var(--primary); }

.footer-bottom-bar {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 18px 20px;
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-bottom-bar a { color: #9ca3af; font-size: 13px; }
.footer-bottom-bar a:hover { color: var(--primary); }
.footer-bottom-bar img { filter: brightness(0) invert(1); opacity: 0.6; width: 90px; }
.footer-nav-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-social { display: flex; gap: 8px; }
.footer-social a {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 15px;
  transition: all var(--transition);
}
.footer-social a:hover { background: var(--primary); color: #fff; }

/* ======================================================
   UTILITIES
   ====================================================== */
.text-primary { color: var(--primary); }
.fw-600 { font-weight: 600; }
.mt-4 { margin-top: 4px; }
.mb-0 { margin-bottom: 0; }

/* ======================================================
   RESPONSIVE
   ====================================================== */
@media (max-width: 1024px) {
  .property-grid     { grid-template-columns: repeat(2, 1fr); }
  .footer-main       { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --header-h: 56px; }

  /* Mobile nav */
  nav.navi.main-nav > ul,
  .main-nav > ul {
    display: none;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: var(--header-h);
    left: 0;
    width: 100%;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
    box-shadow: var(--shadow-md);
    gap: 0;
  }
  nav.navi.main-nav.open > ul,
  .main-nav.open > ul { display: flex; }

  nav.navi.main-nav > ul > li > a,
  .main-nav > ul > li > a {
    padding: 12px 20px;
    border-radius: 0;
  }
  nav.navi.main-nav ul.sub-menu,
  .main-nav .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--border);
    display: none;
    border-radius: 0;
    padding: 0;
  }
  nav.navi.main-nav ul.sub-menu.open,
  .main-nav .sub-menu.open { display: block; }
  nav.navi.main-nav ul.sub-menu li a,
  .main-nav .sub-menu li a { padding: 10px 32px; }

  .nav-toggle { display: flex; }

  /* Search */
  .search-form-row { flex-direction: column; }
  .search-form-row .search-select,
  .search-form-row .search-input,
  .search-form-row .search-btn,
  .search-form-row .advanced-toggle { width: 100%; min-width: unset; justify-content: center; }
  .advanced-fields-panel .search-select,
  .advanced-fields-panel .search-input { flex: 1 1 100%; }

  /* Grid */
  .property-grid { grid-template-columns: 1fr; gap: 16px; }

  /* Footer */
  .footer-main { grid-template-columns: 1fr; gap: 24px; padding: 32px 20px 24px; }
  .footer-bottom-bar { flex-direction: column; align-items: flex-start; gap: 14px; }

  /* Listing */
  .listing-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .prop-price { font-size: 18px; }
  .prop-amenities { gap: 8px; }
  .pagination-wrap { gap: 3px; }
  .page-btn { min-width: 34px; height: 34px; font-size: 13px; }
}

/* ======================================================
   FICHA DE PROPIEDAD
   ====================================================== */
.ficha-main { padding: 24px 0 52px; }

/* Two-column layout */
.ficha-layout {
  display: grid;
  grid-template-columns: 1fr 348px;
  gap: 24px;
  align-items: start;
}
/* min-width:0 evita que el item de grid se expanda más allá de 1fr
   cuando el contenido (thumbnails, etc.) es más ancho que el contenedor */
.ficha-content {
  min-width: 0;
}
.ficha-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* --- Gallery --- */
.gallery-main {
  position: relative;
  width: 100%;           /* no excede el ancho del contenedor */
  aspect-ratio: 16/10;
  background: #111;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}
.gallery-main-img {
  width: 100%; height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  transition: opacity 0.18s;
}
.gallery-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px;
  background: rgba(0,0,0,0.52); color: #fff;
  border: none; border-radius: 50%; font-size: 19px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; z-index: 5;
}
.gallery-btn:hover { background: rgba(0,0,0,0.82); }
.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }
.gallery-badges {
  position: absolute; top: 10px; left: 10px;
  display: flex; gap: 6px; z-index: 5;
}
.gallery-actions {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 6px; z-index: 5;
}
.gallery-count-btn {
  position: absolute; bottom: 10px; right: 10px; z-index: 5;
  background: rgba(0,0,0,0.58); color: #fff; font-size: 12px;
  padding: 4px 10px; border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: background 0.15s;
}
.gallery-count-btn:hover { background: rgba(0,0,0,0.85); }
.gallery-thumbs {
  display: flex; gap: 6px;
  overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  /* Contiene los thumbnails sin expandir el grid item */
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.gallery-thumb {
  flex-shrink: 0; width: 88px; height: 58px;
  border-radius: var(--radius-sm); overflow: hidden;
  cursor: pointer; opacity: 0.58;
  transition: opacity 0.15s, outline 0.15s;
  outline: 2px solid transparent; outline-offset: 2px;
}
.gallery-thumb:hover { opacity: 0.85; }
.gallery-thumb.active { opacity: 1; outline-color: var(--primary); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Lightbox */
.ficha-lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.94); z-index: 1200;
  align-items: center; justify-content: center;
}
.ficha-lightbox.open { display: flex; }
.lb-img {
  max-width: 90vw; max-height: 88vh;
  object-fit: contain; border-radius: var(--radius-sm);
}
.lb-close {
  position: fixed; top: 16px; right: 16px;
  background: rgba(255,255,255,0.12); color: #fff;
  border: none; width: 42px; height: 42px; border-radius: 50%;
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; z-index: 10;
}
.lb-close:hover { background: rgba(255,255,255,0.26); }
.lb-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; background: rgba(255,255,255,0.12);
  color: #fff; border: none; border-radius: 50%; font-size: 22px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; z-index: 10;
}
.lb-nav:hover { background: rgba(255,255,255,0.26); }
.lb-prev { left: 14px; }
.lb-next { right: 14px; }
.lb-counter {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.65); font-size: 13px; z-index: 10;
}

/* --- Property header (title + price) --- */
.ficha-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 16px;
}
.ficha-title { font-size: 21px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.ficha-location {
  font-size: 14px; color: var(--text-light);
  display: flex; align-items: center; gap: 5px; margin-bottom: 3px;
}
.ficha-code { font-size: 12px; color: var(--text-light); }
.ficha-price-box { text-align: right; flex-shrink: 0; }
.ficha-price-amount {
  font-size: 28px; font-weight: 800; color: var(--text);
  display: block; line-height: 1.1;
}
.ficha-price-currency { font-size: 16px; font-weight: 500; color: var(--text-mid); }
.ficha-price-label { font-size: 12px; color: var(--text-light); margin-top: 3px; display: block; }
.ficha-vigencia { font-size: 11px; color: var(--text-light); margin-top: 2px; display: block; }

/* --- Key facts bar --- */
.ficha-facts {
  display: flex; flex-wrap: wrap; gap: 0;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 18px;
}
.fact-item {
  flex: 1 1 0; min-width: 80px;
  padding: 13px 8px; text-align: center;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.fact-item:last-child { border-right: none; }
.fact-item i { color: var(--primary); font-size: 16px; }
.fact-item strong { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1; }
.fact-item span { font-size: 10px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.3px; }

/* --- Section blocks --- */
.ficha-block {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
  min-width: 0;   /* hereda el contenido dentro del grid */
  overflow: hidden;
}
.ficha-block-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--primary); display: inline-block;
}
.ficha-description { font-size: 14px; line-height: 1.78; color: var(--text-mid); white-space: pre-line; }

/* Details key-value grid */
.details-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
}
.detail-item {
  font-size: 13px; color: var(--text-mid);
  padding: 7px 6px; border-bottom: 1px solid var(--border);
}
.detail-item strong { color: var(--text); font-weight: 600; display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 1px; }

/* Amenity tags */
.amenity-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.amenity-tag {
  background: var(--primary-light); color: var(--primary);
  font-size: 12px; font-weight: 500;
  padding: 4px 12px; border-radius: 20px;
  display: flex; align-items: center; gap: 5px;
  text-decoration: none; transition: background 0.15s;
}
.amenity-tag:hover { background: #fde0c8; color: var(--primary); }
.amenity-tag i { font-size: 10px; }

/* Rental prices */
.rental-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.rental-item {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 10px; text-align: center;
}
.rental-period { font-size: 10px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 3px; }
.rental-price { font-size: 15px; font-weight: 700; color: var(--text); }
.rental-currency { font-size: 10px; font-weight: 400; color: var(--text-light); }

/* Video embed */
.ficha-video { border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; margin-top: 16px; }
.ficha-video iframe { width: 100%; height: 100%; border: none; display: block; }

/* --- Contact sidebar --- */
.contact-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.contact-card-head {
  background: var(--primary); color: #fff;
  padding: 12px 16px; font-size: 14px; font-weight: 700;
}
.contact-card-body { padding: 14px 14px 10px; }
.contact-field { margin-bottom: 9px; }
.contact-field input,
.contact-field select,
.contact-field textarea {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; color: var(--text);
  background: var(--white); outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none; appearance: none;
}
.contact-field input:focus,
.contact-field select:focus,
.contact-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(232,110,39,0.12);
}
.contact-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
  padding-right: 28px;
}
.contact-field textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.contact-wsp-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-mid); margin-top: 5px; }
.contact-wsp-row input[type=checkbox] { width: auto; cursor: pointer; }

.cbtn {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: none; font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  margin-bottom: 7px; text-decoration: none; text-align: center;
}
.cbtn-primary  { background: var(--primary); color: #fff; }
.cbtn-primary:hover  { background: var(--primary-dark); color: #fff; }
.cbtn-outline  { background: none; border: 1px solid var(--border); color: var(--text-mid); }
.cbtn-outline:hover  { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.cbtn-green    { background: #25D366; color: #fff; }
.cbtn-green:hover    { background: #20b958; color: #fff; }
.cbtn-blue     { background: #1d6fa4; color: #fff; }
.cbtn-blue:hover     { background: #155d8a; color: #fff; }

.inmo-logo-wrap {
  border-top: 1px solid var(--border); padding: 12px 14px;
  text-align: center;
}
.inmo-logo-wrap a { display: block; }
.inmo-logo-wrap img { max-height: 54px; max-width: 100%; width: auto; margin: 0 auto; object-fit: contain; }

/* WhatsApp floating button — oculto (reemplazado por botón en sidebar + barra mobile) */
.wsp-float { display: none; }

/* WhatsApp lead modal (vanilla) */
.wsp-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.65); z-index: 1150;
  align-items: center; justify-content: center;
}
.wsp-modal.open { display: flex; }
.wsp-modal-box {
  background: var(--white); border-radius: var(--radius-lg);
  width: 90%; max-width: 400px; padding: 22px;
  box-shadow: var(--shadow-lg);
}
.wsp-modal-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.wsp-error { color: #e53e3e; font-size: 12px; margin-bottom: 8px; display: none; }
.wsp-modal-footer { display: flex; gap: 10px; margin-top: 14px; }
.wsp-modal-footer button {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
}
.wsp-cancel  { background: var(--bg); color: var(--text-mid); }
.wsp-confirm { background: #25D366; color: #fff; }

/* ── Barra de acción fija en mobile (WSP + Contactar) ── */
.ficha-mobile-cta {
  display: none; /* se activa solo en mobile */
}

/* --- Responsive ficha --- */
@media (max-width: 960px) {
  .ficha-layout { grid-template-columns: 1fr; }
  .ficha-sidebar { position: static; }

  /* Barra fija inferior */
  .ficha-mobile-cta {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 500;
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 10px 14px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    gap: 10px;
    box-shadow: 0 -3px 16px rgba(0,0,0,0.10);
  }
  .mobile-cta-btn {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 13px 10px;
    border: none; border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 14px; font-weight: 700;
    cursor: pointer; color: #fff; text-decoration: none;
    transition: filter 0.15s;
  }
  .mobile-cta-btn:hover { filter: brightness(0.92); color: #fff; }
  .mobile-cta-wsp     { background: #25D366; }
  .mobile-cta-contact { background: var(--primary); }

  /* Espacio para que el contenido no quede tapado por la barra */
  body.has-ficha-cta { padding-bottom: 80px; }
}
@media (max-width: 640px) {
  .ficha-title { font-size: 17px; }
  .ficha-price-amount { font-size: 22px; }
  .ficha-top { flex-direction: column; }
  .ficha-price-box { text-align: left; }
  .details-grid { grid-template-columns: repeat(2, 1fr); }
  .rental-grid  { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 400px) {
  .details-grid { grid-template-columns: 1fr; }
  .rental-grid  { grid-template-columns: 1fr; }
}

/* ======================================================
   HERO / INDEX PAGE
   ====================================================== */
#hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #16213e;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.60) 0%,
    rgba(0,0,0,0.30) 50%,
    rgba(0,0,0,0.65) 100%
  );
}
/* Transparent header overlaid on hero */
#hero-header {
  position: relative;
  z-index: 10;
  height: var(--header-h);
  display: flex;
  align-items: center;
}
#hero-header > .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
#hero-header .logo img { height: 40px; width: auto; }
#hero-header nav.navi.main-nav > ul > li > a {
  color: rgba(255,255,255,0.92);
}
#hero-header nav.navi.main-nav > ul > li > a:hover {
  background: rgba(255,255,255,0.13);
  color: #fff;
}
#hero-header .nav-toggle span { background: #fff; }
/* Sub-menu keeps white bg on desktop for readability */
#hero-header nav.navi.main-nav ul.sub-menu { background: var(--white); }
#hero-header nav.navi.main-nav ul.sub-menu li a { color: var(--text-mid); }

/* Hero main content */
.hero-content {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  align-items: center;
  padding: 32px 0 72px;
}
.hero-content > .container { width: 100%; }
.hero-headline {
  text-align: center;
  color: #fff;
  margin-bottom: 30px;
}
.hero-headline h1 {
  font-size: clamp(26px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.15;
  text-shadow: 0 2px 16px rgba(0,0,0,0.45);
  margin-bottom: 10px;
}
.hero-headline p {
  font-size: clamp(14px, 2vw, 19px);
  font-weight: 400;
  opacity: 0.88;
  text-shadow: 0 1px 8px rgba(0,0,0,0.35);
}

/* Search panel */
.hero-search-panel {
  background: rgba(255,255,255,0.97);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.28);
  padding: 22px 26px;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
}
.hero-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.hero-search-row .search-select { flex: 1 1 145px; min-width: 130px; }
.hero-search-row .search-input  { flex: 1 1 160px; min-width: 130px; }
.hero-search-row .search-btn {
  flex-shrink: 0;
  height: 44px;
  font-size: 15px;
  padding: 0 30px;
}

/* Image credit */
.hero-credit {
  position: absolute;
  bottom: 10px;
  left: 16px;
  z-index: 6;
  font-size: 10px;
  color: rgba(255,255,255,0.55);
}
.hero-credit a { color: rgba(255,255,255,0.55); text-decoration: underline; }

/* Responsive hero */
@media (max-width: 768px) {
  #hero-section { min-height: 100svh; }
  .hero-search-panel { padding: 16px 14px; border-radius: var(--radius); }
  .hero-search-row { flex-direction: column; }
  .hero-search-row .search-select,
  .hero-search-row .search-input,
  .hero-search-row .search-btn { width: 100%; min-width: unset; justify-content: center; }
  /* Mobile dropdown on dark hero */
  #hero-header nav.navi.main-nav > ul {
    background: rgba(22,33,62,0.97);
    border-bottom: 1px solid rgba(255,255,255,0.10);
  }
  #hero-header nav.navi.main-nav > ul > li > a { color: rgba(255,255,255,0.9); }
  #hero-header nav.navi.main-nav > ul > li > a:hover { background: rgba(255,255,255,0.08); }
  #hero-header nav.navi.main-nav ul.sub-menu {
    background: rgba(22,33,62,0.95);
    border-top: 1px solid rgba(255,255,255,0.10);
  }
  #hero-header nav.navi.main-nav ul.sub-menu li a { color: rgba(255,255,255,0.8); }
}
