:root {
  --color-primary: #1a2f4e;
  --color-primary-light: #2a4570;
  --color-accent: #c9a961;
  --color-accent-dark: #a88a45;
  --color-bg: #fafafa;
  --color-surface: #ffffff;
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --max-width: 1280px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-accent-dark); }

img { max-width: 100%; height: auto; display: block; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; color: var(--color-primary); }
h1 { font-size: 2.5rem; margin-bottom: 1rem; }
h2 { font-size: 2rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.5rem; margin-bottom: 0.5rem; }

/* ===== HEADER ===== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
  gap: 32px;
}
.logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 800;
  font-size: 1.6rem;
  color: var(--color-primary);
  letter-spacing: -0.5px;
}
.logo span { color: var(--color-accent); }
.logo small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 2px;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.nav-main {
  display: flex;
  gap: 8px;
  align-items: center;
}
.nav-main a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--color-text);
  transition: all 0.2s;
}
.nav-main a:hover, .nav-main a.active {
  background: var(--color-primary);
  color: white;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-primary);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--color-primary);
  color: white;
}
.btn-primary:hover { background: var(--color-primary-light); color: white; }
.btn-accent {
  background: var(--color-accent);
  color: var(--color-primary);
}
.btn-accent:hover { background: var(--color-accent-dark); color: white; }
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary); color: white; }
.btn-whatsapp {
  background: #25D366;
  color: white;
}
.btn-whatsapp:hover { background: #1ebd5a; color: white; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-lg { padding: 16px 32px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
  overflow: hidden;
  background: linear-gradient(135deg, #1a2f4e 0%, #2a4570 100%);
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(26,47,78,0.7), rgba(26,47,78,0.85)),
    url('https://images.unsplash.com/photo-1564013799919-ab600027ffc6?w=1600&q=80');
  background-size: cover;
  background-position: center;
  z-index: 0;
}
.hero > .container { position: relative; z-index: 1; padding: 60px 24px; }
.hero h1 {
  color: white;
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: 16px;
}
.hero p {
  font-size: 1.2rem;
  margin-bottom: 32px;
  opacity: 0.95;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== HERO SEARCH ===== */
.hero-search {
  background: white;
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 900px;
  margin: 0 auto;
}
.search-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 16px;
}
.search-tab {
  padding: 10px 24px;
  background: var(--color-bg);
  color: var(--color-text);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.search-tab.active {
  background: var(--color-primary);
  color: white;
}
.search-fields {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 12px;
}
.search-fields input, .search-fields select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: white;
  color: var(--color-text);
}

/* ===== SECTIONS ===== */
.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }
.section-header {
  text-align: center;
  margin-bottom: 48px;
}
.section-header h2 {
  font-size: 2.25rem;
  margin-bottom: 8px;
}
.section-header p {
  color: var(--color-text-muted);
  font-size: 1.1rem;
}
.section-bg { background: white; }

/* ===== PROPERTY GRID ===== */
.properties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 24px;
}

.property-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.property-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}
.property-img {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #f3f4f6;
}
.property-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.property-card:hover .property-img img { transform: scale(1.05); }

.property-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--color-accent);
  color: var(--color-primary);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.property-badge.sale { background: var(--color-accent); color: var(--color-primary); }
.property-badge.rental { background: var(--color-primary); color: white; }
.property-badge.reserved { background: #f59e0b; color: white; }

.property-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.property-type {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-accent-dark);
  font-weight: 600;
  margin-bottom: 6px;
}
.property-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 8px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.property-location {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.property-features {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.property-features span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.property-price {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 8px;
}
.property-price small { font-size: 0.8rem; color: var(--color-text-muted); font-weight: 500; }

/* ===== FILTERS BAR ===== */
.filters-bar {
  background: white;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 32px;
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.filters-bar input, .filters-bar select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: white;
  color: var(--color-text);
}

/* ===== MAP ===== */
.map-section {
  background: white;
  padding-bottom: 0;
}
.map-container {
  width: 100%;
  height: 500px;
  margin-top: 32px;
  border-radius: 0;
  overflow: hidden;
  background: #e5e7eb;
}
.map-container.with-radius {
  border-radius: var(--radius-lg);
  height: 400px;
}

.map-popup {
  font-family: inherit;
  padding: 4px;
  min-width: 200px;
}
.map-popup img { width: 100%; height: 120px; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }
.map-popup h4 { font-size: 0.95rem; margin-bottom: 4px; }
.map-popup .price { color: var(--color-primary); font-weight: 700; }
.map-popup a { font-size: 0.85rem; color: var(--color-accent-dark); }

/* ===== PROPERTY DETAIL ===== */
.property-detail { padding: 40px 0; }
.gallery {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 240px 240px;
  gap: 8px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
}
.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.2s;
}
.gallery img:hover { opacity: 0.9; }
.gallery img:first-child { grid-row: 1 / 3; grid-column: 1; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
}
.detail-main h1 { font-size: 2rem; margin-bottom: 8px; }
.detail-address {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  margin-bottom: 24px;
}
.detail-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  padding: 24px;
  background: var(--color-bg);
  border-radius: var(--radius);
  margin: 24px 0;
}
.detail-features div {
  text-align: center;
}
.detail-features .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.detail-features .value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-primary);
}

.detail-description {
  margin-top: 24px;
  font-size: 1rem;
  line-height: 1.8;
  white-space: pre-wrap;
}

.detail-sidebar {
  position: sticky;
  top: 100px;
  align-self: start;
}
.sidebar-card {
  background: white;
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}
.sidebar-card .price-big {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 16px;
}
.sidebar-card .form-group { margin-bottom: 12px; }
.sidebar-card input, .sidebar-card textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
}
.sidebar-card textarea { min-height: 100px; resize: vertical; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--color-text);
}
.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  background: white;
  color: var(--color-text);
  transition: border-color 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
}
textarea.form-control { min-height: 140px; resize: vertical; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ===== ALERTS ===== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-success {
  background: #d1fae5;
  color: #065f46;
  border-left: 4px solid var(--color-success);
}
.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border-left: 4px solid var(--color-danger);
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--color-primary);
  color: #cbd5e1;
  padding: 60px 0 24px;
  margin-top: 80px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.site-footer h4 {
  color: white;
  font-size: 1.05rem;
  margin-bottom: 16px;
}
.site-footer a {
  color: #cbd5e1;
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.site-footer a:hover { color: var(--color-accent); }
.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  font-size: 0.85rem;
  color: #94a3b8;
}
.social-links {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}
.social-links a {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  margin: 0;
  transition: background 0.2s;
}
.social-links a:hover { background: var(--color-accent); }

/* ===== WHATSAPP FLOAT ===== */
.whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37,211,102,0.4);
  z-index: 99;
  color: white;
  transition: transform 0.2s;
}
.whatsapp-float:hover { transform: scale(1.1); color: white; }
.whatsapp-float svg { width: 32px; height: 32px; fill: white; }

/* ===== LOADER ===== */
.loader {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}
.empty-state h3 { color: var(--color-text); margin-bottom: 8px; }

/* ===== STATS ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  text-align: center;
}
.stat .num {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-accent);
}
.stat .label {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
}
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: absolute;
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  padding: 12px 18px;
  border-radius: 50%;
  transition: background 0.2s;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.3); }
.lightbox-close { top: 20px; right: 20px; }
.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; }
  .filters-bar { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.5rem; }
  .nav-main {
    display: none;
    position: absolute;
    top: 80px; left: 0; right: 0;
    background: white;
    flex-direction: column;
    padding: 16px;
    box-shadow: var(--shadow-lg);
  }
  .nav-main.open { display: flex; }
  .nav-toggle { display: block; }
  .search-fields { grid-template-columns: 1fr; }
  .filters-bar { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .gallery {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 200px 200px;
  }
  .gallery img:first-child { grid-column: 1 / 3; }
  .form-row { grid-template-columns: 1fr; }
  .section { padding: 48px 0; }
}
