/* ═══════════════════════════════════════════════════════════
   98 Mizban Design System v1.0
   CSS Variables driven · Light/Dark · Primary Color Switch
   ═══════════════════════════════════════════════════════════ */

:root {
  /* ── Brand Primary (overridable by JS) ── */
  --color-primary: #3755ae;
  --color-primary-hover: #2c4590;
  --color-primary-soft: color-mix(in srgb, var(--color-primary) 12%, transparent);
  --color-primary-muted: color-mix(in srgb, var(--color-primary) 22%, transparent);

  /* ── Semantic ── */
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger:  #dc2626;
  --color-info:    #0284c7;

  /* ── Neutral Scale (Light) ── */
  --color-bg:          #f4f7fa;
  --color-surface:     #ffffff;
  --color-surface-2:   #f8fafc;
  --color-border:      #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-text:        #0f172a;
  --color-text-muted:  #64748b;
  --color-text-subtle: #94a3b8;
  --color-heading:     #0f172a;

  /* ── Header / Footer ── */
  --header-bg:         #ffffff;
  --header-border:     #e2e8f0;
  --footer-bg:         #0f172a;
  --footer-text:       #94a3b8;
  --footer-heading:    #f1f5f9;

  /* ── Shadows ── */
  --shadow-xs:  0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm:  0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:  0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg:  0 12px 32px rgba(15, 23, 42, 0.12);
  --shadow-mega: 0 20px 50px rgba(15, 23, 42, 0.15);

  /* ── Radius ── */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  /* ── Typography ── */
  --font-fa: 'Vazirmatn', 'Tahoma', system-ui, sans-serif;
  --font-en: 'Inter', system-ui, -apple-system, sans-serif;
  --font-ar: 'Noto Sans Arabic', 'Tahoma', system-ui, sans-serif;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;

  --leading-tight:  1.25;
  --leading-snug:   1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* ── Spacing ── */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* ── Layout ── */
  --container: 1200px;
  --container-wide: 1400px;
  --header-h: 72px;
  --header-h-mobile: 60px;

  /* ── Transitions ── */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 200ms;
}

/* ── Dark Mode ── */
[data-theme="dark"] {
  --color-bg:          #0b1120;
  --color-surface:     #111827;
  --color-surface-2:   #1e293b;
  --color-border:      #1e293b;
  --color-border-strong: #334155;
  --color-text:        #e2e8f0;
  --color-text-muted:  #94a3b8;
  --color-text-subtle: #64748b;
  --color-heading:     #f8fafc;

  --header-bg:         #0f172a;
  --header-border:     #1e293b;
  --footer-bg:         #020617;
  --footer-text:       #64748b;
  --footer-heading:    #e2e8f0;

  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg:  0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-mega: 0 20px 50px rgba(0, 0, 0, 0.55);

  --color-primary-soft: color-mix(in srgb, var(--color-primary) 18%, transparent);
  --color-primary-muted: color-mix(in srgb, var(--color-primary) 28%, transparent);
}

/* System preference fallback when data-theme="system" */
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --color-bg:          #0b1120;
    --color-surface:     #111827;
    --color-surface-2:   #1e293b;
    --color-border:      #1e293b;
    --color-border-strong: #334155;
    --color-text:        #e2e8f0;
    --color-text-muted:  #94a3b8;
    --color-text-subtle: #64748b;
    --color-heading:     #f8fafc;
    --header-bg:         #0f172a;
    --header-border:     #1e293b;
    --footer-bg:         #020617;
    --footer-text:       #64748b;
    --footer-heading:    #e2e8f0;
  }
}

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

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

body {
  font-family: var(--font-fa);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--duration) var(--ease), color var(--duration) var(--ease);
}

html[lang="en"] body,
[dir="ltr"] body { font-family: var(--font-en); }

html[lang="ar"] body { font-family: var(--font-ar); }

img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--color-primary); text-decoration: none; transition: color var(--duration) var(--ease); }
a:hover { color: var(--color-primary-hover); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 {
  color: var(--color-heading);
  font-weight: 700;
  line-height: var(--leading-tight);
}

/* ── Utilities ── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
.container-wide {
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

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

/* Focus visible for a11y */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

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

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.25rem;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  line-height: 1.4;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.btn-outline:hover {
  background: var(--color-primary-soft);
}
.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}
.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: var(--text-xs);
}

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.badge-success { background: color-mix(in srgb, var(--color-success) 15%, transparent); color: var(--color-success); }
.badge-warning { background: color-mix(in srgb, var(--color-warning) 15%, transparent); color: var(--color-warning); }
