:root{
  --navy: #225372;
  --sage: #7dc28f;
  --sage-dark: #3b6d11;
  --sage-bg: #eaf3de;
  --ink: #1c1c1a;
  --muted: #7a7a74;
  --faint: #9a9a92;
  --border: #ececec;
  --border-soft: #e4e4de;
  --surface: #fafaf8;
  --bg: #ffffff;
  --card-bg: #ffffff;
  --placeholder-bg: #e8ece9;
  --accent-text: var(--navy);
  --radius: 10px;
  --hero-overlay: linear-gradient(90deg, rgba(255,255,255,.93) 0%, rgba(255,255,255,.93) 30%, rgba(255,255,255,.06) 75%, rgba(255,255,255,0) 100%);
  --hero-overlay-mobile: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.72));
  --hero-sub: #4a4a46;
  color-scheme: light;
}

[data-theme="dark"]{
  --ink: #eef2f0;
  --muted: #9fb4bd;
  --faint: #6f838c;
  --border: #26454f;
  --border-soft: #2c4a56;
  --surface: #17323f;
  --bg: #0f242e;
  --card-bg: #17323f;
  --placeholder-bg: #1f3d49;
  --accent-text: var(--sage);
  --hero-overlay: linear-gradient(90deg, rgba(15,36,46,.96) 0%, rgba(15,36,46,.96) 30%, rgba(15,36,46,.55) 75%, rgba(15,36,46,.45) 100%);
  --hero-overlay-mobile: linear-gradient(180deg, rgba(15,36,46,.92), rgba(15,36,46,.8));
  --hero-sub: #c7d6da;
  color-scheme: dark;
}

*{ box-sizing: border-box; }

/* Las listas desplegables nativas no heredan el fondo del select: se lo damos explícito */
select option, select optgroup{ background: var(--card-bg); color: var(--ink); }

body{
  margin:0;
  font-family:'Montserrat', sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

a{ color: inherit; text-decoration: none; }
img{ max-width:100%; display:block; }
ul{ list-style:none; margin:0; padding:0; }

.container{
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 16px 24px;
  background: var(--navy);
  position:relative;
}
.brand{ display:flex; align-items:center; gap:8px; font-size:16px; font-weight:500; color:#ffffff; }
.brand .mark{
  width:auto; height:30px; object-fit:contain;
}
.site-header .brand .mark{
  filter: brightness(0) invert(1);
}
.brand .dot{ color: var(--sage); }

.header-right{ display:flex; align-items:center; gap:28px; }

.nav{ display:flex; align-items:center; gap:24px; font-size:13.5px; }
.nav a{ color: rgba(255,255,255,0.75); position:relative; padding-bottom:4px; }
.nav a.active, .nav a:hover{ color:#ffffff; font-weight:500; }
.nav a.active::after{
  content:''; position:absolute; left:0; right:0; bottom:-6px; height:2px;
  background: var(--sage); border-radius:2px;
}

.nav-theme-row{ display:flex; align-items:center; }
.nav-theme-label{ display:none; }

/* ---------- Dropdown "Comprar" ---------- */
.nav-dropdown{ position:relative; }
.nav-dropdown-trigger{
  background:none; border:none; padding:0; padding-bottom:4px; font:inherit; cursor:pointer;
  display:flex; align-items:center; gap:5px; color: rgba(255,255,255,0.75);
}
.nav-dropdown-trigger svg{ width:10px; height:10px; transition: transform .2s ease; }
.nav-dropdown-trigger.active, .nav-dropdown-trigger:hover, .nav-dropdown.open .nav-dropdown-trigger{ color:#ffffff; font-weight:500; }
.nav-dropdown.open .nav-dropdown-trigger svg{ transform: rotate(180deg); }

.nav-dropdown-menu{
  display:none; position:absolute; top:calc(100% + 14px); left:0;
  background: var(--card-bg); border-radius:10px; box-shadow:0 12px 32px rgba(0,0,0,.28);
  padding:8px; min-width:190px; z-index:30;
}
.nav-dropdown.open .nav-dropdown-menu{ display:block; }
.nav-dropdown-menu a{ display:block; padding:9px 12px; border-radius:6px; font-size:12.5px; color: var(--ink); white-space:nowrap; }
.nav-dropdown-menu a:hover{ background: var(--surface); }
.nav-dropdown-menu a.active{ background: var(--surface); font-weight:500; color: var(--accent-text); }

.nav-toggle{ display:none; background:none; border:none; font-size:22px; color:#ffffff; cursor:pointer; }

@media (max-width: 860px){
  .nav{ display:none; position:absolute; top:64px; left:0; right:0; background: var(--card-bg); flex-direction:column; align-items:stretch; gap:0; border-bottom:1px solid var(--border); z-index:20; }
  .nav.open{ display:flex; }
  .nav a{ color: var(--ink); padding:14px 24px; border-top:1px solid var(--border); }
  .nav a.active, .nav a:hover{ color: var(--accent-text); }
  .nav a.active::after{ display:none; }
  .nav-toggle{ display:block; }

  .nav-theme-row{ justify-content:space-between; padding:14px 24px; border-top:1px solid var(--border); }
  .nav-theme-label{ display:inline; color: var(--ink); font-size:13.5px; }

  .nav-dropdown{ border-top:1px solid var(--border); }
  .nav-dropdown-trigger{ width:100%; padding:14px 24px; justify-content:space-between; color: var(--ink); }
  .nav-dropdown-trigger.active, .nav-dropdown-trigger:hover{ color: var(--accent-text); }
  .nav-dropdown-menu{
    position:static; display:none; box-shadow:none; border-radius:0; background: var(--surface); padding:0; min-width:0;
  }
  .nav-dropdown.open .nav-dropdown-menu{ display:block; }
  .nav-dropdown-menu a{ padding:12px 24px 12px 40px; border-radius:0; }
}

/* ---------- Theme switch ---------- */
.theme-switch{ background:none; border:none; padding:0; cursor:pointer; line-height:0; flex-shrink:0; }
.theme-switch-track{
  display:inline-block; width:46px; height:25px; border-radius:16px; position:relative;
  background:#ffffff; box-shadow:0 2px 6px rgba(0,0,0,.25); border:1px solid rgba(0,0,0,.06);
}

.theme-switch-track > svg{ position:absolute; top:50%; width:11px; height:11px; transform:translateY(-50%); color:#c3c9cb; }
.theme-switch-track > svg.sun{ left:6px; }
.theme-switch-track > svg.moon{ right:6px; }
.theme-switch-track svg circle, .theme-switch-track svg path{ stroke: currentColor; }

.theme-switch-knob{
  display:block; position:absolute; top:3px; left:3px; width:19px; height:19px; border-radius:50%;
  background: var(--navy); box-shadow:0 1px 3px rgba(0,0,0,.25);
  transition: transform .3s ease, background-color .3s ease;
}
[data-theme="dark"] .theme-switch-knob{ transform: translateX(21px); background: var(--sage); }
.theme-switch-knob svg{ position:absolute; top:4px; left:4px; width:11px; height:11px; transition: opacity .2s ease; }
.theme-switch-knob svg circle, .theme-switch-knob svg path{ stroke: currentColor; }
.theme-switch-knob svg.sun{ opacity:1; color:#ffffff; }
.theme-switch-knob svg.moon{ opacity:0; color:#ffffff; }
[data-theme="dark"] .theme-switch-knob svg.sun{ opacity:0; }
[data-theme="dark"] .theme-switch-knob svg.moon{ opacity:1; }

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font-family:inherit; font-size:13px; font-weight:500;
  padding:11px 20px; border-radius:8px; cursor:pointer;
  border:1px solid transparent;
}
.btn-primary{ background: var(--navy); color:#fff; }
.btn-primary:hover{ opacity:.92; }
.btn-accent{ background: var(--sage); color:#173404; }
.btn-accent:hover{ opacity:.92; }
.btn-outline{ background: var(--card-bg); border-color: var(--accent-text); color: var(--accent-text); }
.btn-outline{
  background: var(--card-bg); border-color: var(--accent-text); color: var(--accent-text);
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn-outline:hover{ background: var(--navy); border-color: var(--navy); color: #ffffff; }
.btn-danger{ background: var(--card-bg); border-color:#e2b8b8; color:#a44a4a; }
.btn-block{ width:100%; }

/* ---------- Hero ---------- */
.hero{
  position:relative; overflow:hidden;
  min-height:480px; display:flex; align-items:center;
  padding:0;
}
.hero-photo{
  position:absolute; inset:0; background-position:center bottom; background-size:cover;
  transition: background-image .35s ease;
}
.hero-overlay{ position:absolute; inset:0; background: var(--hero-overlay); }
@media (max-width:700px){ .hero-overlay{ background: var(--hero-overlay-mobile); } }

.hero-content{
  position:relative; z-index:2; width:100%;
  padding:44px max(24px, 6vw); text-align:left;
}
.hero h1{ font-size: clamp(26px, 4vw, 42px); font-weight:600; margin:0 0 8px; color: var(--ink); }
.hero-content p{ color: var(--hero-sub); font-size:14px; margin:0 0 22px; }

.search-bar{
  display:flex; gap:8px; max-width:640px; margin:0 auto;
  background: var(--surface); border:1px solid var(--border-soft);
  border-radius:12px; padding:10px; flex-wrap:wrap;
}
.search-bar select, .search-bar input{
  flex:1; min-width:120px; border:none; background:transparent;
  font-family:inherit; font-size:13px; color: var(--ink); padding:8px;
}
.search-bar select:not(:first-child), .search-bar input:not(:first-child){
  border-left:1px solid var(--border-soft);
}

.search-card{ max-width:620px; }
.hero-tabs{ display:flex; gap:2px; overflow-x:auto; }
.hero-tab{
  background:none; border:none; font-family:inherit; cursor:pointer; white-space:nowrap;
  font-size:12.5px; color: var(--ink); padding:10px 16px; border-radius:10px 10px 0 0;
}
.hero-tab.active{ font-weight:600; background: var(--surface); box-shadow: inset 0 -2px 0 var(--sage); }
.hero-form{ margin:0; border-radius:0 12px 12px 12px; box-shadow:0 12px 34px rgba(0,0,0,.18); }

@media (max-width:700px){
  .hero-content{ text-align:center; padding:40px 20px; }
  .hero-tabs{ justify-content:center; }
}

/* ---------- Property cards ---------- */
.grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:18px; }
@media (max-width:900px){ .grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:600px){ .grid{ grid-template-columns:1fr; } }

.card{
  border:1px solid var(--border); border-radius:var(--radius); overflow:hidden;
  transition: box-shadow .2s ease, transform .2s ease, background-color .25s ease, border-color .25s ease;
  background: var(--card-bg);
}
.card:hover{ box-shadow:0 8px 24px rgba(0,0,0,0.12); transform:translateY(-2px); }
.card .thumb{ height:170px; background: var(--placeholder-bg) center/cover no-repeat; position:relative; }
.card .body{ padding:14px 16px; }
.card .price{ font-size:16px; font-weight:600; color: var(--accent-text); margin:0 0 6px; }
.badge{
  display:inline-block; font-size:10.5px; font-weight:600; letter-spacing:.02em;
  color:#173404; background: var(--sage); padding:3px 10px; border-radius:5px; margin-bottom:6px;
}
.badge-soft{ background: var(--sage-bg); color: var(--sage-dark); }
.badge-blue{ background:#e6f1fb; color:#0c447c; }
.card .zone{ font-size:12px; color: var(--muted); margin:4px 0; }
.card .specs{ font-size:11.5px; color: var(--faint); margin:0; }

/* ---------- Section titles ---------- */
.section{ padding:36px 24px; }
.section-title{ font-size:15px; font-weight:600; margin:0 0 16px; }
.section-title.center{ text-align:center; }

/* ---------- Catalog layout ---------- */
.catalog{ display:grid; grid-template-columns:220px 1fr; gap:28px; padding:28px 24px 60px; }
@media (max-width:820px){ .catalog{ grid-template-columns:1fr; } }

.filters{ border:1px solid var(--border); border-radius:var(--radius); padding:20px; align-self:start; }
.filters h3{ font-size:12px; font-weight:600; margin:0 0 14px; }
.filter-group{ margin-bottom:16px; }
.filter-group label.title{ display:block; font-size:10.5px; color:var(--faint); margin-bottom:6px; }
.pill-group{ display:flex; gap:6px; }
.pill{
  flex:1; text-align:center; font-size:11px; padding:7px 0; border-radius:6px;
  border:1px solid var(--border-soft); color: var(--muted); cursor:pointer; background: var(--card-bg);
}
.pill.active{ background: var(--navy); color:#fff; border-color:var(--navy); }
.check-list label{ display:flex; align-items:center; gap:7px; font-size:12px; color: var(--ink); margin-bottom:7px; }
.check-list input{ accent-color: var(--sage); }
.range-inputs{ display:flex; gap:6px; }
.range-inputs input{ width:100%; font-size:11.5px; border:1px solid var(--border-soft); border-radius:6px; padding:7px 8px; font-family:inherit; background: var(--card-bg); color: var(--ink); }
select.field, input.field{ width:100%; font-size:12px; border:1px solid var(--border-soft); border-radius:6px; padding:8px 10px; font-family:inherit; color: var(--ink); background: var(--card-bg); }

.results-bar{ display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.results-bar p{ font-size:12.5px; color:var(--muted); margin:0; }

/* ---------- Property detail ---------- */
.gallery{ display:grid; grid-template-columns:2fr 1fr 1fr; gap:6px; border-radius:var(--radius); overflow:hidden; margin-bottom:24px; max-height:420px; }
.gallery img{ width:100%; height:100%; object-fit:cover; }
.gallery .main{ grid-row:span 2; }
.gallery .more{ position:relative; }
.gallery .more .veil{ position:absolute; inset:0; background:rgba(34,83,114,.55); color:#fff; display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:500; }
@media (max-width:700px){ .gallery{ grid-template-columns:1fr; max-height:none; } .gallery .main{ grid-row:auto; } .gallery img{ height:220px; } }

.gallery-open{ cursor: zoom-in; }

/* ---------- Lightbox ---------- */
.lightbox{
  display:none; position:fixed; inset:0; z-index:100;
  background: rgba(10,14,13,0.94);
  align-items:center; justify-content:center;
}
.lightbox.open{ display:flex; }
.lightbox-img{
  max-width:88vw; max-height:82vh; object-fit:contain;
  border-radius:6px; box-shadow:0 20px 60px rgba(0,0,0,.4);
}
.lightbox-close{
  position:absolute; top:18px; right:22px; background:none; border:none;
  color:#fff; font-size:32px; line-height:1; cursor:pointer; opacity:.85;
}
.lightbox-close:hover{ opacity:1; }
.lightbox-nav{
  position:absolute; top:50%; transform:translateY(-50%);
  background: rgba(255,255,255,0.12); border:none; color:#fff;
  width:44px; height:44px; border-radius:50%; font-size:16px; cursor:pointer;
}
.lightbox-nav:hover{ background: rgba(255,255,255,0.22); }
.lightbox-prev{ left:18px; }
.lightbox-next{ right:18px; }
.lightbox-counter{
  position:absolute; bottom:22px; left:50%; transform:translateX(-50%);
  color:#fff; font-size:12px; opacity:.75; font-family:'Montserrat', sans-serif;
}
@media (max-width:600px){
  .lightbox-nav{ width:38px; height:38px; }
  .lightbox-close{ top:12px; right:14px; }
}

.detail-grid{ display:grid; grid-template-columns:1.7fr 1fr; gap:36px; padding:0 24px 60px; }
@media (max-width:820px){ .detail-grid{ grid-template-columns:1fr; } }

.specs-row{ display:flex; gap:28px; flex-wrap:wrap; padding:16px 0; border-top:1px solid var(--border); border-bottom:1px solid var(--border); margin-bottom:22px; }
.specs-row .num{ font-size:17px; font-weight:600; margin:0; }
.specs-row .label{ font-size:11px; color:var(--faint); margin:0; }

.amenities-grid{ display:grid; grid-template-columns:1fr 1fr; gap:10px 18px; margin-bottom:26px; }
.amenity-item{ display:flex; align-items:center; gap:8px; font-size:13px; color: var(--ink); }

.map-frame{ width:100%; height:220px; border:0; border-radius:10px; }

.contact-card{ border:1px solid var(--border); border-radius:var(--radius); padding:20px; position:sticky; top:20px; }
.contact-card .price{ font-size:22px; font-weight:600; color: var(--accent-text); margin:0 0 8px; }

/* ---------- Emprendimientos ---------- */
.emp-card{ border:1px solid var(--border); border-radius:var(--radius); display:grid; grid-template-columns:220px 1fr; overflow:hidden; margin-bottom:16px; }
.emp-card .thumb{ background: var(--placeholder-bg) center/cover no-repeat; }
.emp-card .body{ padding:20px; }
@media (max-width:640px){ .emp-card{ grid-template-columns:1fr; } .emp-card .thumb{ height:160px; } }
.progress{ height:6px; background: var(--border); border-radius:4px; overflow:hidden; margin:8px 0 4px; }
.progress-fill{ height:100%; background: var(--sage); }

/* ---------- Team / Nosotros ---------- */
.stats-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-bottom:36px; }

.two-col-cta{ display:grid; grid-template-columns:1fr 1fr; gap:24px; text-align:center; }
@media (max-width:640px){ .two-col-cta{ grid-template-columns:1fr; gap:32px; } }
.stat{ text-align:center; padding:20px 12px; background:var(--surface); border-radius:var(--radius); }
.stat .num{ font-size:22px; font-weight:600; color: var(--accent-text); margin:0 0 4px; }
.stat .label{ font-size:11px; color:var(--muted); margin:0; }

.team-card{ border:1px solid var(--border); border-radius:12px; padding:22px; display:grid; grid-template-columns:72px 1fr; gap:18px; align-items:center; }
.team-card .avatar{ width:72px; height:72px; border-radius:50%; background: var(--placeholder-bg); }
.team-meta{ display:flex; flex-wrap:wrap; gap:16px; margin-top:10px; font-size:12px; color: var(--ink); }
.team-meta span{ display:flex; align-items:center; gap:6px; }

/* ---------- Forms ---------- */
.form-field{ margin-bottom:12px; }
.form-field label{ display:block; font-size:12px; color: var(--ink); margin-bottom:5px; }
.form-field input, .form-field select, .form-field textarea{
  width:100%; font-family:inherit; font-size:13px; color: var(--ink);
  border:1px solid var(--border-soft); border-radius:7px; padding:10px 12px; background: var(--card-bg);
}
.form-row{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
@media (max-width:600px){ .form-row{ grid-template-columns:1fr; } }

/* ---------- Footer ---------- */
.site-footer{ border-top:1px solid var(--border); padding:28px 24px; text-align:center; }
.site-footer p{ font-size:11.5px; color:var(--faint); margin:4px 0; }
.site-footer .admin-link{ font-size:10.5px; opacity:.6; }
.site-footer .admin-link:hover{ opacity:1; text-decoration:underline; }

/* ---------- Alerts ---------- */
.alert{ padding:12px 16px; border-radius:8px; font-size:13px; margin-bottom:18px; }
.alert-success{ background:#eaf3de; color:#3b6d11; }
.alert-error{ background:#fbe9e9; color:#a44a4a; }

/* ---------- Admin ---------- */
.admin-wrap{ max-width:960px; margin:0 auto; padding:28px 24px 60px; }
.admin-topbar{ display:flex; align-items:center; justify-content:space-between; padding:14px 24px; border-bottom:1px solid var(--border); }
.admin-topbar .who{ font-size:12px; color:var(--faint); display:flex; align-items:center; gap:16px; }

.admin-table{ width:100%; border-collapse:collapse; border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.admin-table th{ text-align:left; font-size:10.5px; color:var(--faint); background:var(--surface); padding:10px 14px; font-weight:500; }
.admin-table td{ padding:12px 14px; border-top:1px solid var(--border); font-size:12.5px; vertical-align:middle; }
.admin-table .thumb-sm{ width:40px; height:40px; border-radius:6px; background: var(--placeholder-bg) center/cover no-repeat; }
.admin-table .actions a{ margin-right:12px; font-size:12px; }
.admin-table .actions a.danger{ color:#a44a4a; }

.login-box{ max-width:300px; margin:60px auto; border:1px solid var(--border); border-radius:12px; padding:34px 28px; text-align:center; }
.login-box .mark{ width:auto; height:52px; object-fit:contain; display:block; margin:0 auto 16px; }
.login-top{ display:flex; justify-content:flex-end; padding:16px 20px 0; }

.dropzone{
  border:1.5px dashed var(--border-soft); border-radius:10px; padding:26px; text-align:center;
  background: var(--surface); margin-bottom:20px; cursor:pointer;
}
.dropzone p{ margin:6px 0 0; font-size:12px; color: var(--ink); }
.dropzone small{ color: var(--faint); }

.thumbs-preview{ display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.thumbs-preview img{ width:64px; height:64px; object-fit:cover; border-radius:6px; border:1px solid var(--border); }

.step-label{ font-size:11px; font-weight:600; color: var(--accent-text); margin:22px 0 10px; }
.step-label:first-child{ margin-top:0; }

.emp-toggle{ display:flex; align-items:center; gap:8px; font-size:13px; margin:6px 0 18px; }

/* ---------- Administrador de fotos (panel) ---------- */
.photo-help{ font-size:12px; color:var(--muted); margin:0 0 12px; line-height:1.6; }
.photo-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(120px, 1fr)); gap:10px; margin-bottom:14px; }
.photo-grid:empty{ display:none; }
.photo-item{
  position:relative; aspect-ratio:4/3; border-radius:8px; overflow:hidden;
  border:2px solid var(--border); background: var(--placeholder-bg); cursor:grab;
}
.photo-item img{ width:100%; height:100%; object-fit:cover; display:block; }
.photo-item.is-cover{ border-color: var(--sage); }
.photo-item.dragging{ opacity:.4; }
.photo-item.drag-over{ outline:2px dashed var(--sage); outline-offset:2px; }
.photo-badge, .photo-new{
  position:absolute; top:6px; left:6px; font-size:10px; font-weight:600;
  padding:2px 8px; border-radius:4px; background: var(--sage); color:#173404;
}
.photo-new{ left:auto; right:6px; background:rgba(0,0,0,.6); color:#fff; font-weight:500; }
.photo-actions{
  position:absolute; left:0; right:0; bottom:0; display:flex; justify-content:center; gap:4px;
  padding:5px; background:linear-gradient(transparent, rgba(0,0,0,.7));
}
.photo-actions button{
  border:none; background:rgba(255,255,255,.92); color:#1c1c1a; cursor:pointer;
  width:28px; height:28px; border-radius:6px; font-size:12px; line-height:1; padding:0;
}
.photo-actions button:hover{ background:#fff; }
.dropzone.is-over{ border-color: var(--sage); background: var(--card-bg); }
