/* ============================================================
   Arabian Horse Real Estate - Design Tokens & Base
   Premium design system: light + dark theme, semantic palette.
   ============================================================ */

:root {
  /* ---- Brand palette (deep navy + primary blue + teal accent) ---- */
  --color-navy: #0B1220;
  --color-navy-soft: #101A2E;
  --color-navy-700: #131F38;
  --color-navy-600: #1B2A44;
  --color-primary: #2563EB;
  --color-primary-hover: #1D4ED8;
  --color-primary-light: #EAF4FF;
  --color-primary-lighter: #F5F9FF;
  --color-primary-dark: #1E40AF;
  --color-teal: #0E9F8A;
  --color-teal-light: #E6F7F4;
  --color-teal-dark: #0B7F70;
  --color-accent: #7C3AED;
  --color-accent-light: #EDE9FE;
  --color-amber: #D97706;
  --color-amber-light: #FEF3C7;
  --color-cyanish: #0E9F8A;
  --color-cyanish-light: #E6F7F4;
  --color-success: #16A34A;
  --color-success-bg: #F0FDF4;
  --color-success-border: #86EFAC;
  --color-warning: #D97706;
  --color-warning-bg: #FEF3C7;
  --color-warning-border: #FCD34D;
  --color-error: #DC2626;
  --color-error-bg: #FEF2F2;
  --color-error-border: #FCA5A5;
  --color-info: #2563EB;
  --color-info-bg: #EFF6FF;
  --color-info-border: #BFDBFE;

  /* ---- Surfaces ---- */
  --bg: #F6F8FC;
  --surface: #FFFFFF;
  --surface-2: #F8FAFD;
  --surface-3: #F1F5F9;
  --surface-inset: #F9FAFB;
  --surface-ramp: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);

  /* ---- Borders ---- */
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --border-subtle: #F1F5F9;

  /* ---- Text ---- */
  --text: #0F172A;
  --text-2: #1D2B45;
  --text-3: #475569;
  --text-4: #94A3B8;
  --text-inverse: #FFFFFF;

  /* ---- Elevation ---- */
  --sh-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --sh-sm: 0 1px 3px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.05);
  --sh-md: 0 6px 16px rgba(15, 23, 42, 0.08);
  --sh-lg: 0 14px 40px rgba(15, 23, 42, 0.14);
  --sh-xl: 0 25px 50px -12px rgba(15, 23, 42, 0.22);
  --sh-focus: 0 0 0 4px rgba(37, 99, 235, 0.16);

  /* ---- Radii ---- */
  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 13px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* ---- Spacings (8px grid) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* ---- Layout ---- */
  --topbar-h: 68px;
  --sidebar-w: 272px;
  --sidebar-collapsed-w: 68px;

  /* ---- Typography ---- */
  --font: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --font-heading: var(--font);

  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-lg: 15px;
  --text-xl: 18px;
  --text-2xl: 22px;
  --text-3xl: 28px;
  --text-4xl: 36px;
  --text-5xl: 48px;

  /* ---- Motion ---- */
  --dur-fast: 80ms;
  --dur: 140ms;
  --dur-slow: 260ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.6, 1);

  /* ---- Z-index ---- */
  --z-dropdown: 100;
  --z-sidebar: 60;
  --z-modal: 2000;
  --z-toast: 3000;
}

/* ---------------- Dark theme ---------------- */
[data-theme="dark"] {
  --bg: #0B1220;
  --surface: #121A2B;
  --surface-2: #162034;
  --surface-3: #1C2740;
  --surface-inset: #182136;
  --border: #23304A;
  --border-strong: #334560;
  --border-subtle: #1A2438;
  --text: #E6EAF2;
  --text-2: #C9D4E4;
  --text-3: #98A7BC;
  --text-4: #6B7E99;
  --text-inverse: #0B1220;
  --success-bg: #0F2A1A;
  --success-border: #1E5A2E;
  --warning-bg: #3A2B0C;
  --warning-border: #5A420B;
  --error-bg: #3A1418;
  --error-border: #5A1E22;
  --info-bg: #122341;
  --info-border: #1E3A60;
  --surface-ramp: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

/* ---------------- Base ---------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

p { margin: 0; }

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--color-primary); text-decoration: none; }

a:hover { text-decoration: underline; }

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

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar { width: 10px; height: 10px; }

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
  border: 3px solid var(--surface);
  background-clip: content-box;
}

::-webkit-scrollbar-track { background: transparent; }

::selection { background: rgba(37, 99, 235, 0.16); }

.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;
}

/* ---------------- Utilities ---------------- */
.u-stack { display: flex; flex-direction: column; gap: var(--space-3); }
.u-row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.u-row-between { display: flex; gap: var(--space-4); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.u-flex-1 { flex: 1 1 auto; }
.u-text-right { text-align: right; }
.u-text-left { text-align: left; }
.u-text-center { text-align: center; }
.u-nowrap { white-space: nowrap; }
.u-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.u-muted { color: var(--text-3); }

/* ---------------- Responsive grid ================ */
.u-grid { display: grid; gap: var(--space-4); }
.u-grid-cols-1  { grid-template-columns: repeat(1, 1fr); }
.u-grid-cols-2  { grid-template-columns: repeat(2, 1fr); }
.u-grid-cols-3  { grid-template-columns: repeat(3, 1fr); }
.u-grid-cols-4  { grid-template-columns: repeat(4, 1fr); }
.u-grid-cols-5  { grid-template-columns: repeat(5, 1fr); }
.u-grid-cols-6  { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 768px) {
  .u-grid-cols-2, .u-grid-cols-3, .u-grid-cols-4, .u-grid-cols-5, .u-grid-cols-6 { grid-template-columns: 1fr; }
}

/* ---------------- RTL support ---------------- */
[dir="rtl"] .u-text-right { text-align: left; }
[dir="rtl"] .u-text-left { text-align: right; }

