/* VypeRealty v2 — Premium Styles | TridaxLabs (tridax.org) */

/* ─── CSS Variables (Light Theme) ─── */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f7f8fa;
  --bg-tertiary: #eef0f4;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-input: #f7f8fa;
  --bg-hero: linear-gradient(135deg, #0c1b33 0%, #142644 40%, #1a3358 100%);
  --text-primary: #0f1729;
  --text-secondary: #4a5568;
  --text-tertiary: #8896ab;
  --text-inverse: #ffffff;
  --border-primary: #e8ebf0;
  --border-secondary: #f0f2f5;
  --brand: #1a56db;
  --brand-light: #e8f0fe;
  --brand-dark: #0f3a8a;
  --accent: #059669;
  --accent-light: #d1fae5;
  --danger: #dc2626;
  --warning: #d97706;
  --shadow-sm: 0 1px 2px rgba(15,23,41,.04);
  --shadow-md: 0 4px 16px rgba(15,23,41,.06);
  --shadow-lg: 0 12px 40px rgba(15,23,41,.08);
  --shadow-xl: 0 20px 60px rgba(15,23,41,.1);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --transition: .25s cubic-bezier(.4,0,.2,1);
  --glass: rgba(255,255,255,.85);
  --glass-border: rgba(255,255,255,.5);
  --skeleton: linear-gradient(90deg, #eef0f4 25%, #e2e5ea 50%, #eef0f4 75%);
  color-scheme: light;
}

/* ─── Dark Mode ─── */
[data-theme="dark"] {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2333;
  --bg-card: #161b22;
  --bg-elevated: #1c2333;
  --bg-input: #1c2333;
  --bg-hero: linear-gradient(135deg, #060a10 0%, #0d1117 40%, #131923 100%);
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-tertiary: #565e6a;
  --text-inverse: #0d1117;
  --border-primary: #21262d;
  --border-secondary: #1c2333;
  --brand: #4f8ff7;
  --brand-light: #122040;
  --brand-dark: #79abff;
  --accent: #34d399;
  --accent-light: #0d2e22;
  --danger: #f87171;
  --warning: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.35);
  --shadow-xl: 0 20px 60px rgba(0,0,0,.4);
  --glass: rgba(13,17,23,.85);
  --glass-border: rgba(33,38,45,.6);
  --skeleton: linear-gradient(90deg, #1c2333 25%, #252d3a 50%, #1c2333 75%);
  color-scheme: dark;
}

/* ─── Base ─── */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { 
  background: var(--bg-secondary); 
  color: var(--text-primary); 
  -webkit-font-smoothing: antialiased; 
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition), color var(--transition);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ─── Focus ─── */
*:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }

/* ─── Selection ─── */
::selection { background: var(--brand); color: #fff; }

/* ─── Utility Classes ─── */
.bg-primary { background: var(--bg-primary); }
.bg-secondary { background: var(--bg-secondary); }
.bg-card { background: var(--bg-card); }
.bg-elevated { background: var(--bg-elevated); }
.bg-input { background: var(--bg-input); }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.border-main { border-color: var(--border-primary); }
.border-subtle { border-color: var(--border-secondary); }

/* ─── Glass Effect ─── */
.glass { background: var(--glass); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); border: 1px solid var(--glass-border); }

/* ─── Animations ─── */
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 800px; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pulse-dot { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .5; transform: scale(.8); } }
@keyframes countUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

.anim-slideUp { animation: slideUp .5s cubic-bezier(.22,1,.36,1) both; }
.anim-fadeIn { animation: fadeIn .4s ease both; }
.anim-scaleIn { animation: scaleIn .3s cubic-bezier(.22,1,.36,1) both; }
.anim-float { animation: float 3s ease-in-out infinite; }
.anim-shimmer { background: var(--skeleton); background-size: 200% 100%; animation: shimmer 1.5s infinite; }

/* Stagger children */
.stagger > * { animation: slideUp .5s cubic-bezier(.22,1,.36,1) both; }
.stagger > *:nth-child(1) { animation-delay: .05s; }
.stagger > *:nth-child(2) { animation-delay: .1s; }
.stagger > *:nth-child(3) { animation-delay: .15s; }
.stagger > *:nth-child(4) { animation-delay: .2s; }
.stagger > *:nth-child(5) { animation-delay: .25s; }
.stagger > *:nth-child(6) { animation-delay: .3s; }

/* ─── Card Hover ─── */
.card-lift { transition: transform var(--transition), box-shadow var(--transition); }
.card-lift:hover { transform: translateY(-6px); box-shadow: var(--shadow-xl); }

/* ─── Image Lazy Load ─── */
img.lazy { opacity: 0; transition: opacity .4s ease; }
img.lazy.loaded { opacity: 1; }

/* ─── Line Clamp ─── */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ─── Header ─── */
#site-header { transition: box-shadow var(--transition), background var(--transition); }
#site-header.scrolled { box-shadow: var(--shadow-md); }

/* ─── Dark Mode Toggle ─── */
.theme-toggle { position: relative; width: 52px; height: 28px; border-radius: 99px; background: var(--bg-tertiary); border: 2px solid var(--border-primary); cursor: pointer; transition: all var(--transition); }
.theme-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); transition: all var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
[data-theme="dark"] .theme-toggle::after { transform: translateX(24px); background: #fbbf24; }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { position: absolute; top: 50%; transform: translateY(-50%); font-size: 10px; transition: opacity var(--transition); }
.theme-toggle .icon-sun { right: 7px; opacity: 1; color: var(--warning); }
.theme-toggle .icon-moon { left: 7px; opacity: 0; color: var(--brand); }
[data-theme="dark"] .theme-toggle .icon-sun { opacity: 0; }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 1; color: #fbbf24; }

/* ─── Property Card ─── */
.property-card { background: var(--bg-card); border: 1px solid var(--border-secondary); border-radius: var(--radius-lg); overflow: hidden; transition: all var(--transition); }
.property-card:hover { border-color: var(--border-primary); box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.property-card img.cover { transition: transform .6s cubic-bezier(.22,1,.36,1); }
.property-card:hover img.cover { transform: scale(1.06); }

/* ─── Badge ─── */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.badge-sale { background: #059669; color: #fff; }
.badge-rent { background: #1a56db; color: #fff; }
.badge-commercial { background: #7c3aed; color: #fff; }
.badge-featured { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }

/* ─── Price Tag ─── */
.price-tag { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ─── Lightbox ─── */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.92); display: none; align-items: center; justify-content: center; }
.lightbox.active { display: flex; animation: fadeIn .2s ease; }
.lightbox img { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: var(--radius-md); }

/* ─── Mortgage Calculator ─── */
.calc-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; background: var(--bg-tertiary); outline: none; }
.calc-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); cursor: pointer; box-shadow: 0 2px 8px rgba(26,86,219,.3); }

/* ─── Toast ─── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); padding: 12px 24px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600; z-index: 300; opacity: 0; transition: all .3s cubic-bezier(.22,1,.36,1); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast-success { background: var(--accent); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--brand); color: #fff; }

/* ─── Skeleton Loader ─── */
.skeleton { border-radius: var(--radius-sm); background: var(--skeleton); background-size: 200% 100%; animation: shimmer 1.5s infinite; }

/* ─── Select ─── */
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M4.427 6.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 6H4.604a.25.25 0 00-.177.427z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; -webkit-appearance: none; }

/* ─── Input Focus ─── */
.input-field { background: var(--bg-input); border: 1.5px solid var(--border-primary); color: var(--text-primary); transition: all var(--transition); }
.input-field::placeholder { color: var(--text-tertiary); }
.input-field:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,.1); outline: none; }

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .property-card:hover { transform: none; }
  .card-lift:hover { transform: none; }
}

/* ─── Print ─── */
@media print { header, footer, nav, .no-print, #back-to-top, #dev-modal, .lightbox { display: none !important; } }

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
