/* ══════════════════════════════════════════════════════════════════
   HogaresRD — Design System v3
   Modern real estate portal aesthetic.
   Clean white base, professional blue accent, crisp typography.
   ══════════════════════════════════════════════════════════════════ */

/* ── Google Fonts ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── Design Tokens — Light Mode ────────────────────────────────── */
:root {
  /* Palette — clean white portal */
  --bg:              #FFFFFF;
  --bg-card:         #FFFFFF;
  --bg-secondary:    #F4F6F9;
  --bg-hover:        #EBF0F8;
  --text:            #1A2535;
  --text-secondary:  #4A5568;
  --text-muted:      #6B7280;  /* WCAG AA compliant on white */
  --border:          #E2E8F0;
  --border-strong:   #CBD5E1;

  /* Accent — professional blue */
  --accent:          #006AFF;
  --accent-hover:    #0052CC;
  --accent-light:    #EBF3FF;
  --blue:            #006AFF;   /* alias */

  /* Semantic */
  --red:             #E53E3E;
  --red-hover:       #C53030;
  --green:           #00A878;

  /* Elevation — clean, directional */
  --shadow-sm:       0 1px 3px rgba(26,37,53,0.08);
  --shadow:          0 2px 8px rgba(26,37,53,0.10);
  --shadow-md:       0 4px 16px rgba(26,37,53,0.12);
  --shadow-lg:       0 8px 32px rgba(26,37,53,0.14);
  --shadow-xl:       0 20px 60px rgba(26,37,53,0.16);

  /* Geometry — modern rounded corners */
  --radius:          4px;
  --radius-md:       8px;
  --radius-lg:       12px;
  --radius-xl:       16px;
  --radius-full:     9999px;

  /* Navigation */
  --nav-bg:          rgba(255,255,255,0.97);
  --nav-border:      rgba(226,232,240,0.9);

  /* Typography scale */
  --font:            'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-size-xs:    0.72rem;
  --font-size-sm:    0.85rem;
  --font-size-base:  1rem;
  --font-size-lg:    1.0625rem;
  --font-size-xl:    1.25rem;
  --font-size-2xl:   1.625rem;
  --font-size-3xl:   2.25rem;

  /* Spacing */
  --space-xs:        0.25rem;
  --space-sm:        0.5rem;
  --space-md:        1rem;
  --space-lg:        1.5rem;
  --space-xl:        2rem;
  --space-2xl:       3rem;
  --space-3xl:       4.5rem;

  /* Transitions */
  --transition:      0.15s ease;
  --transition-md:   0.25s ease;
}

/* ── Design Tokens — Dark Mode ─────────────────────────────────── */
[data-theme="dark"] {
  --bg:              #0F1623;
  --bg-card:         #1A2235;
  --bg-secondary:    #202D42;
  --bg-hover:        #263450;
  --text:            #EDF2F7;
  --text-secondary:  #A0AEBE;
  --text-muted:      #7A8A9E;  /* WCAG AA on dark bg */
  --border:          #2D3F58;
  --border-strong:   #3D5275;

  --accent:          #4D9EFF;
  --accent-hover:    #70B3FF;
  --accent-light:    #1A2F4F;
  --blue:            #4D9EFF;

  --red:             #FC5C5C;
  --red-hover:       #E04040;
  --green:           #38D996;

  --shadow-sm:       0 1px 3px rgba(0,0,0,0.3);
  --shadow:          0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:       0 4px 16px rgba(0,0,0,0.45);
  --shadow-lg:       0 8px 32px rgba(0,0,0,0.5);
  --shadow-xl:       0 20px 60px rgba(0,0,0,0.55);

  --nav-bg:          rgba(15,22,35,0.98);
  --nav-border:      rgba(45,63,88,0.9);
}

/* ── Base Reset & Typography ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: var(--font-size-base);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition-md), color var(--transition-md);
  overflow-x: hidden;
}
html { overflow-x: hidden; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ── Navigation ────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--nav-border);
  transition: background var(--transition-md), border-color var(--transition-md);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
  color: var(--text);
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg { width: 24px; height: 24px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
}

.nav-link {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  letter-spacing: 0;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  background: var(--accent-light);
}

/* ── Nav Dropdown ──────────────────────────────────────────────── */
.nav-item { position: relative; }

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 210px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
  z-index: 200;
}

.nav-item:hover .nav-dropdown,
.nav-item:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}

.nav-dropdown a:hover {
  color: var(--accent);
  background: var(--accent-light);
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  font-size: var(--font-size-sm);
  font-weight: 600;
  letter-spacing: 0;
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform var(--transition),
              box-shadow var(--transition);
  white-space: nowrap;
  cursor: pointer;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(0,106,255,0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition),
              transform var(--transition);
}

.card:hover {
  border-color: transparent;
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

/* ── Section Labels ─────────────────────────────────────────────── */
.section-label {
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.section-title {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1.15;
}

/* ── Property badges ─────────────────────────────────────────────  */
.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.22rem 0.6rem;
  border-radius: var(--radius-full);
}

.badge-venta    { background: var(--accent); color: #fff; }
.badge-alquiler { background: var(--red);  color: #fff; }

/* ── Form inputs ─────────────────────────────────────────────────  */
.input {
  width: 100%;
  padding: 0.7rem 1rem;
  font-size: var(--font-size-base);
  color: var(--text);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,106,255,0.12);
}

.input::placeholder { color: var(--text-muted); }

/* ── Dividers ───────────────────────────────────────────────────── */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  border: none;
}

/* ── Utilities ──────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive container ───────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (max-width: 768px) {
  .container { padding: 0 1rem; }
  .section-title { font-size: 1.5rem; }
}
@media (max-width: 600px) {
  .container { padding: 0 0.75rem; }
  h1 { font-size: 1.75rem; }
  h2, .section-title { font-size: 1.25rem; }
  .btn { padding: 0.5rem 1rem; font-size: 0.82rem; }
  .btn-primary, .btn-ghost, .btn-login { padding: 0.45rem 1rem; font-size: 0.82rem; }
}
@media (max-width: 480px) {
  body { font-size: 0.875rem; }
  .container { padding: 0 0.625rem; }
}
/* ── Mobile utility classes ────────────────────────────────────── */
@media (max-width: 768px) {
  .mobile-hide { display: none !important; }
}
@media (min-width: 769px) {
  .mobile-only { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAV — mirrors iOS tab bar
   Add <nav class="mobile-bottom-nav mobile-only"> to page HTML
   ══════════════════════════════════════════════════════════════════ */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--nav-border);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  padding: 0.35rem 0 max(0.35rem, env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.mobile-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
  padding: 0.3rem 0;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.mobile-bottom-nav a svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  transition: fill var(--transition);
}
.mobile-bottom-nav a.active,
.mobile-bottom-nav a:active {
  color: var(--accent);
}
.mobile-bottom-nav .nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  background: var(--red);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
/* Add bottom padding to body so content isn't hidden behind the bar */
@media (max-width: 768px) {
  body.has-bottom-nav { padding-bottom: 72px; }
}

/* ══════════════════════════════════════════════════════════════════
   SKELETON LOADING — shimmer placeholders
   Use: <div class="skeleton skeleton-text"></div>
        <div class="skeleton skeleton-card"></div>
        <div class="skeleton skeleton-image"></div>
   ══════════════════════════════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 37%, var(--bg-secondary) 63%);
  background-size: 800px 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-md);
}
.skeleton-text {
  height: 1rem;
  width: 80%;
  margin-bottom: 0.5rem;
}
.skeleton-text.short { width: 45%; }
.skeleton-text.xs    { height: 0.75rem; width: 30%; }
.skeleton-card {
  height: 180px;
  width: 100%;
  border-radius: var(--radius-lg);
}
.skeleton-image {
  height: 200px;
  width: 100%;
  border-radius: var(--radius-lg);
}
.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}
.skeleton-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
}
.skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ══════════════════════════════════════════════════════════════════
   EMPTY STATES — illustrated placeholders with CTA
   Use: <div class="empty-state-v2"> ... </div>
   ══════════════════════════════════════════════════════════════════ */
.empty-state-v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 2rem;
  text-align: center;
  min-height: 280px;
}
.empty-state-v2 .empty-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state-v2 .empty-icon svg {
  width: 36px;
  height: 36px;
  fill: var(--accent);
  opacity: 0.7;
}
.empty-state-v2 h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.empty-state-v2 p {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.5;
}
.empty-state-v2 .empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.4rem;
  background: var(--accent);
  color: #fff;
  font-size: var(--font-size-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  text-decoration: none;
}
.empty-state-v2 .empty-cta:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* ══════════════════════════════════════════════════════════════════
   ENTRANCE ANIMATIONS — fade-in-up for cards, sections, lists
   Add class="animate-in" to elements. They appear on scroll.
   ══════════════════════════════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.animate-in {
  animation: fadeInUp 0.4s ease-out both;
}
/* Stagger children — add to parent: class="stagger-children" */
.stagger-children > * {
  opacity: 0;
  animation: fadeInUp 0.35s ease-out both;
}
.stagger-children > *:nth-child(1)  { animation-delay: 0.03s; }
.stagger-children > *:nth-child(2)  { animation-delay: 0.06s; }
.stagger-children > *:nth-child(3)  { animation-delay: 0.09s; }
.stagger-children > *:nth-child(4)  { animation-delay: 0.12s; }
.stagger-children > *:nth-child(5)  { animation-delay: 0.15s; }
.stagger-children > *:nth-child(6)  { animation-delay: 0.18s; }
.stagger-children > *:nth-child(7)  { animation-delay: 0.21s; }
.stagger-children > *:nth-child(8)  { animation-delay: 0.24s; }
.stagger-children > *:nth-child(9)  { animation-delay: 0.27s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.30s; }

/* Subtle hover lift for interactive cards */
.card-hover {
  transition: transform var(--transition-md), box-shadow var(--transition-md);
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .animate-in,
  .stagger-children > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .card-hover:hover { transform: none; }
}
