@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600&display=swap');

/* ==========================================================================
   Apex Real Estate — Master Design System (Pure CSS3 & CSS Variables)
   WCAG 2.2 AA Compliant • Mobile First • Performance Tuned
   ========================================================================== */

:root {
  /* Dynamic Brand Palette (Configurable via Settings > Appearance) */
  --primary: #0F2A4A;
  --primary-hover: #163E6D;
  --primary-light: #EBF1F7;
  --secondary: #C5A880;
  --secondary-hover: #B59567;
  --secondary-light: #F7F3ED;
  --accent: #E07A5F;
  --accent-hover: #CC654B;
  --accent-light: #FCF1EE;

  /* Neutrals & Surfaces */
  --bg: #FAF9F6;
  --surface: #FFFFFF;
  --surface-alt: #F3F4F6;
  --surface-hover: #F8FAFC;
  --border: #E5E7EB;
  --border-focus: #0F2A4A;
  --text: #1A202C;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  /* Functional Status */
  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #EF4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #3B82F6;
  --info-bg: rgba(59, 130, 246, 0.12);

  /* Typography Scales — Pure Poppins Typography */
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Poppins', sans-serif;
  
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem); /* 12-13px */
  --text-sm: clamp(0.8125rem, 0.78rem + 0.25vw, 0.875rem); /* 13-14px */
  --text-base: clamp(0.875rem, 0.84rem + 0.3vw, 1rem); /* 14-16px */
  --text-lg: clamp(1rem, 0.95rem + 0.4vw, 1.125rem); /* 16-18px */
  --text-xl: clamp(1.125rem, 1.05rem + 0.6vw, 1.35rem); /* 18-21px */
  --text-2xl: clamp(1.35rem, 1.25rem + 0.8vw, 1.75rem); /* 21-28px */
  --text-3xl: clamp(1.75rem, 1.55rem + 1.2vw, 2.25rem); /* 28-36px */
  --text-4xl: clamp(2.25rem, 1.95rem + 1.8vw, 3.25rem); /* 36-52px */

  /* Spacing Scale (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* Border Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  /* Soft Layered Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 10px -2px rgba(15, 42, 74, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 20px -3px rgba(15, 42, 74, 0.09), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 20px 30px -5px rgba(15, 42, 74, 0.12), 0 8px 12px -6px rgba(0, 0, 0, 0.05);

  /* Layout Containers */
  --container-max: 100%;
  --container-narrow: 1200px;

  /* Transitions */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --bg: #090E17;
  --surface: #101926;
  --surface-alt: #172335;
  --surface-hover: #1D2B40;
  --border: #1E2D44;
  --border-focus: #C5A880;
  --text: #F8FAFC;
  --text-muted: #94A3B8;
  --text-light: #64748B;
  --primary-light: #16253B;
  --secondary-light: #24221D;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 10px 24px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   Base Reset & Global Typography
   ========================================================================== */

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

html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--primary);
  line-height: 1.25;
  font-weight: 700;
  word-break: break-word;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4 {
  color: #FFFFFF;
}

/* Container - Acquires complete page width with fluid luxury gutters */
.container {
  width: 100%;
  max-width: var(--container-max);
  box-sizing: border-box;
  padding-left: clamp(16px, 3.5vw, 56px);
  padding-right: clamp(16px, 3.5vw, 56px);
}

.container-narrow {
  max-width: var(--container-narrow);
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================================
   Buttons Component Suite
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px; /* WCAG 44px touch target */
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease);
  user-select: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary);
  color: #FFFFFF;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(15, 42, 74, 0.25);
}

.btn-secondary {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background-color: var(--surface-alt);
  border-color: var(--text-muted);
}

.btn-gold {
  background-color: var(--secondary);
  color: #0F2A4A;
  font-weight: 700;
}
.btn-gold:hover {
  background-color: var(--secondary-hover);
  box-shadow: 0 4px 12px rgba(197, 168, 128, 0.35);
}

.btn-accent {
  background-color: var(--accent);
  color: #FFFFFF;
}
.btn-accent:hover {
  background-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(224, 122, 95, 0.35);
}

.btn-ghost {
  background-color: transparent;
  color: var(--primary);
}
.btn-ghost:hover {
  background-color: var(--primary-light);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover {
  background: var(--surface-alt);
  color: var(--primary);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 14px;
  font-size: var(--text-xs);
}

.btn-lg {
  min-height: 52px;
  padding: 14px 28px;
  font-size: var(--text-base);
}

/* ==========================================================================
   Badges & Chips Suite
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.badge-rera {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.badge-verified {
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.badge-ready {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.badge-featured {
  background: rgba(197, 168, 128, 0.2);
  color: #9A7745;
  border: 1px solid var(--secondary);
}

.badge-luxury {
  background: #0F2A4A;
  color: #FFFFFF;
}

/* Filter Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
  user-select: none;
}

.chip:hover {
  border-color: var(--primary);
  background: var(--surface-alt);
}

.chip.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

/* ==========================================================================
   Form Controls & Floating Labels
   ========================================================================== */

.form-group {
  margin-bottom: var(--sp-5);
  position: relative;
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(15, 42, 74, 0.12);
}

/* Dual Range Slider Component */
.range-slider-wrap {
  padding: 12px 0;
}

.range-slider {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ==========================================================================
   Property Card Variants (Industry Benchmark)
   ========================================================================== */

/* 1. Grid Card */
.property-card-grid {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-normal) var(--ease), box-shadow var(--duration-normal) var(--ease);
  display: flex;
  flex-direction: column;
}

.property-card-grid:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card-media {
  position: relative;
  height: 220px;
  background-color: var(--surface-alt);
  overflow: hidden;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.property-card-grid:hover .card-image {
  transform: scale(1.05);
}

.card-badge-strip {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.btn-favorite-heart {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #64748B;
  transition: all var(--duration-fast) var(--ease);
  z-index: 2;
}

.btn-favorite-heart:hover,
.btn-favorite-heart.active {
  color: var(--danger);
  transform: scale(1.15);
}

.card-content {
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.card-price {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--primary);
}

.card-price-unit {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.card-title {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-locality {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 14px;
}

.card-specs {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 14px;
}

.spec-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn-action-whatsapp {
  flex: 1;
  background: #25D366;
  color: #FFFFFF;
  min-height: 40px;
  font-size: var(--text-xs);
}
.btn-action-whatsapp:hover {
  background: #20BA5A;
}

.btn-action-call {
  flex: 1;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  min-height: 40px;
  font-size: var(--text-xs);
}
.btn-action-call:hover {
  background: var(--border);
}

/* 2. List Card Variant */
.property-card-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: grid;
  grid-template-columns: 320px 1fr;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-normal) var(--ease);
}

.property-card-list:hover {
  box-shadow: var(--shadow-md);
}

/* 3. Compact / Map Popup Card Variant */
.property-card-compact {
  width: 260px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.property-card-compact .card-media {
  height: 140px;
}
.property-card-compact .card-content {
  padding: 12px;
}

/* ==========================================================================
   Mobile Sticky Action Bar (44px min touch target)
   ========================================================================== */

.mobile-sticky-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  z-index: 1000;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08);
}

.sticky-bar-inner {
  display: flex;
  gap: 10px;
  max-width: 500px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .mobile-sticky-bar {
    display: block;
  }
  .property-card-list {
    grid-template-columns: 1fr;
  }
  body {
    padding-bottom: 70px; /* Offset for sticky bar */
  }
}

/* ==========================================================================
   Micro-interactions & Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
