/* ========================================================
   BASE — 50&50Property Design System
   Shared across ALL public pages
   --------------------------------------------------------
   NOTE on fonts: Inter is loaded centrally via the base layout
   (src/views/layout.ejs) as a preloaded <link> tag. Do NOT @import
   here — that's render-blocking and causes the visible FOUT swap.
   ======================================================== */

/* ===== Design Tokens ===== */
:root {
  /* Primary Palette */
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #a78bfa;
  --primary-glow: rgba(124, 58, 237, 0.4);
  --secondary: #06b6d4;
  --secondary-glow: rgba(6, 182, 212, 0.3);
  --accent: #f472b6;
  --accent-glow: rgba(244, 114, 182, 0.3);

  /* Semantic */
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;

  /* Dark Surface Palette */
  --bg-base: #0b0f1a;
  --bg-surface: #111827;
  --bg-elevated: #1f2937;
  --bg-glass: rgba(17, 24, 39, 0.6);
  --bg-glass-light: rgba(255, 255, 255, 0.03);
  --bg-glass-heavy: rgba(17, 24, 39, 0.85);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  /* Borders */
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(255, 255, 255, 0.15);
  --border-accent: rgba(124, 58, 237, 0.3);

  /* Glassmorphism */
  --glass-blur: blur(20px);
  --glass-blur-heavy: blur(30px);
  --glass-bg: rgba(17, 24, 39, 0.6);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --glass-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --glass-glow: 0 0 30px rgba(124, 58, 237, 0.15);

  /* Spacing & Radii */
  --radius: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --container: 1280px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; }

/* ===== Animated Background =====
   Two ambient orbs that wash the viewport with a soft purple/cyan tint.
   Avoiding the "spotlight cut" artifact:
   - Orbs sized larger than the viewport and anchored well past the edge,
     so their circular boundary never enters the visible area.
   - Gradient fades to transparent at 100% (not 70%) so there is no
     perceptible ring where alpha jumps to zero.
   - filter: blur softens any residual edge and blends with surrounding dark.
   - Opacity kept low (≤ 0.09) so the orbs read as ambient lighting rather
     than as discrete spotlights with a visible falloff. */
.bg-mesh {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.bg-mesh::before {
  content: ''; position: absolute;
  width: 1400px; height: 1400px;
  top: -560px; left: -560px;
  background: radial-gradient(circle at center,
    rgba(124, 58, 237, 0.09) 0%,
    rgba(124, 58, 237, 0.04) 35%,
    transparent 100%);
  filter: blur(60px);
  animation: floatOrb 28s ease-in-out infinite;
  will-change: transform;
}
.bg-mesh::after {
  content: ''; position: absolute;
  width: 1200px; height: 1200px;
  bottom: -480px; right: -480px;
  background: radial-gradient(circle at center,
    rgba(6, 182, 212, 0.07) 0%,
    rgba(6, 182, 212, 0.03) 35%,
    transparent 100%);
  filter: blur(60px);
  animation: floatOrb 24s ease-in-out infinite reverse;
  will-change: transform;
}

.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, black 15%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, black 15%, transparent 100%);
}

/* ===== Keyframes ===== */
@keyframes floatOrb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(100px, 50px) scale(1.1); }
  50% { transform: translate(50px, 100px) scale(0.95); }
  75% { transform: translate(-50px, 50px) scale(1.05); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: rgba(124, 58, 237, 0.3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(124, 58, 237, 0.5); }

/* ===== Typography Utilities ===== */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 50%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; background-size: 200% auto;
  animation: shimmer 4s ease-in-out infinite;
}
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* ===== Layout Utilities ===== */
.container { max-width: var(--container); margin: 0 auto; padding: 0 2rem; }
.section { padding: 5rem 2rem; position: relative; z-index: 1; }
.section-lg { padding: 6rem 2rem; }

/* ===== Glass Utility ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
}
.glass-heavy {
  background: var(--bg-glass-heavy);
  backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: var(--glass-border);
  box-shadow: var(--glass-shadow-lg), var(--glass-glow);
  border-radius: var(--radius-lg);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; padding: 0.75rem 1.5rem;
  border-radius: var(--radius); font-weight: 600; font-size: 0.95rem;
  cursor: pointer; border: none; transition: all 0.3s;
  font-family: inherit; position: relative; overflow: hidden;
}
.btn-primary, .btn-glow {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 20px var(--primary-glow), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-glow::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.15) 50%, transparent 60%);
  transform: translateX(-100%); transition: transform 0.6s;
}
.btn-glow:hover::after { transform: translateX(100%); }
.btn-glow:hover, .btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px var(--primary-glow);
}
.btn-primary:disabled {
  background: rgba(255,255,255,0.1); color: var(--text-muted);
  cursor: not-allowed; transform: none; box-shadow: none;
}
.btn-outline {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-accent);
  color: var(--primary-light);
}
.btn-outline:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--primary); transform: translateY(-2px);
}
.btn-secondary {
  background: rgba(255,255,255,0.08); color: var(--text-primary);
  border: 1px solid var(--border-glass);
}
.btn-secondary:hover { background: rgba(255,255,255,0.12); border-color: var(--border-glass-hover); }
.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626); color: #fff;
  box-shadow: 0 4px 15px rgba(248,113,113,0.3);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(248,113,113,0.4); }
.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; border-radius: var(--radius-md); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 0.4rem;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.form-input, .form-control {
  width: 100%; padding: 0.85rem 1rem;
  border: 1px solid var(--border-glass); border-radius: var(--radius);
  font-size: 1rem; font-family: inherit;
  background: rgba(255,255,255,0.04); color: var(--text-primary);
  transition: all 0.3s; outline: none;
}
.form-input::placeholder, .form-control::placeholder { color: var(--text-muted); }
.form-input:focus, .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(255,255,255,0.06);
}
.form-input.error, .form-control.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(248,113,113,0.2);
}
select.form-input, select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px;
}
select.form-input option, select.form-control option { background: var(--bg-surface); color: var(--text-primary); }

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.password-wrapper { position: relative; }
.password-toggle {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1.2rem;
  opacity: 0.5; color: var(--text-secondary);
}
.password-toggle:hover { opacity: 1; }

/* ===== Alerts ===== */
.alert {
  padding: 0.75rem 1rem; border-radius: var(--radius);
  margin-bottom: 1.25rem; font-size: 0.9rem;
  display: none; backdrop-filter: var(--glass-blur);
}
.alert.show { display: block; }
.alert-danger { background: rgba(248,113,113,0.1); color: var(--danger); border: 1px solid rgba(248,113,113,0.2); }
.alert-success { background: rgba(52,211,153,0.1); color: var(--success); border: 1px solid rgba(52,211,153,0.2); }
.alert-warning { background: rgba(251,191,36,0.1); color: var(--warning); border: 1px solid rgba(251,191,36,0.2); }

/* ===== Badges ===== */
.badge {
  display: inline-block; padding: 4px 12px;
  font-size: 0.75rem; font-weight: 500; border-radius: 100px;
}
.badge-success { background: rgba(52,211,153,0.15); color: #34d399; border: 1px solid rgba(52,211,153,0.2); }
.badge-warning { background: rgba(251,191,36,0.15); color: #fbbf24; border: 1px solid rgba(251,191,36,0.2); }
.badge-danger  { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid rgba(248,113,113,0.2); }
.badge-info    { background: rgba(96,165,250,0.15); color: #60a5fa; border: 1px solid rgba(96,165,250,0.2); }

/* ===== Loading ===== */
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 15px var(--primary-glow);
}
.loading { display: flex; align-items: center; justify-content: center; padding: 3rem; }

/* ============================================================
   ===== Footer — Editorial "Hogar" line =====
   ============================================================ */
.site-footer {
  position: relative;
  z-index: 1;
  margin-top: 5rem;
  padding: 4rem 1.75rem 2rem;
  background: linear-gradient(180deg, transparent, rgba(11, 15, 26, 0.65) 25%);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.site-footer::before {
  /* faint editorial dividing thread */
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(280px, 60%, 720px);
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(167, 139, 250, 0.35) 30%,
    rgba(6, 182, 212, 0.3) 70%,
    transparent);
}

.footer-grid {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 3.5rem;
  align-items: start;
}

.footer-brand .footer-logo {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.028em;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: inline-block;
  text-decoration: none;
}
.footer-brand .footer-logo:hover { color: var(--primary-light); }

.footer-brand p {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 360px;
  margin-bottom: 1.25rem;
}
.footer-brand .footer-tagline {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--primary-light);
  letter-spacing: -0.005em;
  max-width: 320px;
  display: inline-block;
}

.footer-col h4 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  margin-bottom: 1.3rem;
  position: relative;
  padding-bottom: 0.65rem;
}
.footer-col h4::after {
  /* short editorial underline */
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 22px;
  height: 1px;
  background: var(--primary-light);
  opacity: 0.6;
}

.footer-col a {
  display: block;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text-secondary);
  font-size: 0.92rem;
  padding: 0.4rem 0;
  text-decoration: none;
  transition: color 0.3s ease, transform 0.3s ease, padding-left 0.3s ease;
}
.footer-col a:hover {
  color: var(--text-primary);
  padding-left: 6px;
}

/* ===== Modals ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px);
  z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-glass-heavy); backdrop-filter: var(--glass-blur-heavy);
  -webkit-backdrop-filter: var(--glass-blur-heavy);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg); max-width: 600px; width: 100%;
  max-height: 80vh; overflow: hidden; box-shadow: var(--glass-shadow-lg);
  animation: modalIn 0.3s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border-glass);
}
.modal-title { font-size: 1.25rem; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 1.5rem; cursor: pointer;
  color: var(--text-muted); padding: 4px; line-height: 1; transition: color 0.3s;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body {
  padding: 24px; overflow-y: auto; max-height: calc(80vh - 140px);
  font-size: 0.9rem; line-height: 1.7; color: var(--text-secondary);
}
.modal-body h3 { color: var(--text-primary); font-size: 1rem; margin: 20px 0 10px; }
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { margin-bottom: 12px; }
.modal-body ul { margin: 12px 0; padding-left: 20px; }
.modal-body li { margin-bottom: 6px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-glass); text-align: right; }
.modal-footer .btn { width: auto; padding: 10px 24px; }

/* ===== Password Strength ===== */
.password-strength { margin-top: 8px; }
.strength-bar { height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.strength-fill { height: 100%; width: 0; transition: all 0.3s; }
.strength-fill.weak { width: 33%; background: var(--danger); }
.strength-fill.medium { width: 66%; background: var(--warning); }
.strength-fill.strong { width: 100%; background: var(--success); }
.strength-text { font-size: 0.75rem; color: var(--text-muted); }

/* ===== Checkbox Groups ===== */
.checkbox-group { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 1.25rem; }
.checkbox-group input { width: 18px; height: 18px; margin-top: 2px; cursor: pointer; accent-color: var(--primary); }
.checkbox-label { font-size: 0.875rem; color: var(--text-muted); line-height: 1.4; }
.checkbox-label a { color: var(--primary-light); }
.checkbox-label a:hover { text-decoration: underline; }

/* ===== Form Errors ===== */
.form-error { color: #fca5a5; font-size: 0.8rem; margin-top: 4px; display: none; }
.form-error.show { display: block; }

/* ===== Success Screen ===== */
.success-screen { text-align: center; padding: 20px 0; display: none; }
.success-screen.show { display: block; }
.success-icon { font-size: 4rem; margin-bottom: 16px; }
.success-title {
  font-size: 1.5rem; font-weight: 800; margin-bottom: 8px;
  background: linear-gradient(135deg, var(--success), var(--secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.success-message { color: var(--text-secondary); margin-bottom: 24px; }

@media (max-width: 768px) {
  .modal { max-height: 90vh; margin: 10px; }
  .modal-body { max-height: calc(90vh - 140px); }
}
.footer-bottom {
  max-width: var(--container);
  margin: 3rem auto 0;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}
.footer-bottom small {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.footer-bottom .footer-craft {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-secondary);
  letter-spacing: 0;
}
.footer-social {
  display: flex;
  gap: 0.55rem;
}
.footer-social a {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.3s ease;
}
.footer-social a:hover {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(167, 139, 250, 0.4);
  color: var(--primary-light);
  transform: translateY(-2px);
}

@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 2.25rem; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .site-footer { padding: 3rem 1.25rem 1.5rem; margin-top: 3rem; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }
}

/* ===================================================================
   Mobile baseline — applies platform-wide to avoid common phone issues.
   Loaded on every page through base.css; written with low specificity so
   any page-specific @media rules can still override.
   =================================================================== */

/* Long URLs, emails, or property titles must wrap, never push the page wide */
@media (max-width: 768px) {
  body, p, h1, h2, h3, li, td, th, a {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* Tables become horizontally scrollable on mobile when not already wrapped.
   Pages should still prefer their own .table-wrap container; this is just a
   safety net so a bare <table> never causes the whole viewport to scroll. */
@media (max-width: 768px) {
  table { max-width: 100%; }
}

/* Tap-target floor: any clickable button or link should be at least 40px
   high on phones so it's reachable with a thumb. Form inputs included. */
@media (max-width: 480px) {
  button:not(.chip):not(.tab):not(.ed-modal__close),
  .btn,
  input[type="submit"],
  input[type="button"] {
    min-height: 40px;
  }
  /* Form rows that look like rows on desktop usually need to stack */
  .form-row,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .form-actions > * { width: 100%; }
}

/* Modals: when a modal-content / .modal / .ed-modal slips through without its
   own mobile rules, ensure it never exceeds the viewport. */
@media (max-width: 520px) {
  .modal-content,
  .modal,
  .ed-modal {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 14px;
  }
}

/* Generic stat-card / mini stats grids — collapse if a page forgot to. */
@media (max-width: 480px) {
  .mini-stats,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
