:root {
  --primary: #0f172a;
  --secondary: #2563eb;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--primary);
  color: #fff;
}

.site-header .logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; }
.site-header .logo img { height: 36px; width: auto; border-radius: 6px; }

.hero {
  padding: 48px 24px;
  text-align: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
}
.hero h1 { margin: 0 0 8px; font-size: 2rem; }
.hero p { margin: 0; opacity: 0.9; }

.filters {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.filters select, .filters input {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  font-family: var(--font);
}

.grid {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform 0.15s ease;
}
.card:hover { transform: translateY(-3px); }
.card-link {
  text-decoration: none;
  color: var(--text);
  display: block;
}
.card-whatsapp {
  display: block;
  text-align: center;
  padding: 10px;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
}
.card-whatsapp:hover { background: #1ebe57; }
.card .thumb {
  height: 170px;
  background: #e2e8f0 center/cover no-repeat;
}
.card .body { padding: 14px; }
.card .price { font-weight: 700; color: var(--secondary); font-size: 1.05rem; }
.card .title { margin: 4px 0; font-size: 0.98rem; }
.card .meta { color: var(--muted); font-size: 0.85rem; }
.card .badge {
  display: inline-block;
  background: var(--secondary);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

.whatsapp-fab.hidden { display: none; }

.whatsapp-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #25d366;
  color: #fff;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.6rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Plantilla "modern": tarjetas más redondeadas, hero más alto, tipografía distinta */
[data-template="modern"] {
  --radius: 18px;
  --font: "Trebuchet MS", var(--font);
}
[data-template="modern"] .hero { padding: 72px 24px; }
[data-template="modern"] .card .thumb { height: 200px; }

/* Detalle de propiedad */
.detail {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 24px;
}
.detail .gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.detail .gallery img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: zoom-out;
  padding: 24px;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  cursor: default;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-nav.hidden { display: none; }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }
.detail h1 { margin-bottom: 4px; }
.detail .price { font-size: 1.4rem; font-weight: 700; color: var(--secondary); }
.detail .specs { display: flex; gap: 18px; flex-wrap: wrap; margin: 16px 0; color: var(--muted); }
.detail .cta { margin-top: 20px; }
.btn {
  display: inline-block;
  background: var(--secondary);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
