/* ── HiStudy Design System Tokens ────────────────────────────────────────── */
/* Indigo→violet primary, gold premium accent, emerald success accent.
   Cairo Arabic + Inter Latin. Soft warm neutrals. */

:root {
  /* Brand */
  --primary-50:  #eef3ff;
  --primary-100: #E0E7FF;
  --primary-200: #C7D2FE;
  --primary-400: #7e9bef;
  --primary-500: #5b7fea;
  --primary-600: #3e64de;  /* base */
  --primary-700: #395bca;  /* hover */
  --primary-800: #26417f;
  --violet-500:  #5b7fea;
  --violet-600:  #00263e;

  /* Accents */
  --gold-300:    #FCD34D;
  --gold-400:    #FBBF24;
  --gold-500:    #F59E0B;  /* premium */
  --gold-600:    #D97706;
  --emerald-400: #34D399;
  --emerald-500: #10B981;  /* success */
  --emerald-600: #059669;

  /* Neutrals (warm cool blend) */
  --ink-950:  #0B1020;
  --ink-900:  #0F172A;  /* deep ink */
  --ink-800:  #1E293B;
  --ink-700:  #334155;
  --ink-600:  #475569;
  --ink-500:  #64748B;  /* slate body */
  --ink-400:  #94A3B8;
  --ink-300:  #CBD5E1;
  --ink-200:  #E2E8F0;
  --ink-100:  #F1F5F9;
  --ink-50:   #F8FAFC;
  --paper:    #FAFAFA;  /* off-white */
  --white:    #FFFFFF;

  /* Dark theme (lesson viewer) */
  --dk-bg:        #0F0F12;
  --dk-surface:   #18181B;
  --dk-surface-2: #1F1F23;
  --dk-border:    #27272A;
  --dk-text:      #E4E4E7;
  --dk-muted:     #A1A1AA;

  /* Surfaces */
  --bg:        var(--paper);
  --surface:   var(--white);
  --surface-2: var(--ink-50);
  --border:    rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.12);

  /* Type */
  --font-ar: "Cairo", "Tajawal", system-ui, sans-serif;
  --font-en: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Spacing — 8px grid */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px; --s-20: 80px;

  /* Radii */
  --r-sm: 8px;  --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-2xl: 24px; --r-full: 999px;

  /* Shadow — layered, subtle */
  --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 2px 6px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.08), 0 4px 8px rgba(15,23,42,.04);
  --shadow-xl: 0 24px 56px rgba(15,23,42,.12), 0 8px 16px rgba(15,23,42,.04);
  --shadow-glow: 0 8px 24px rgba(62, 100, 222,.24);

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #3e64de 0%, #00263e 100%);
  --grad-primary-soft: linear-gradient(135deg, #eef3ff 0%, #e7effc 100%);
  --grad-gold: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);
  --grad-emerald: linear-gradient(135deg, #10B981 0%, #34D399 100%);
  --grad-hero: radial-gradient(1200px 600px at 82% -5%, rgba(62,100,222,.40), transparent 58%),
               radial-gradient(900px 520px at 0% 105%, rgba(9,50,96,.60), transparent 60%),
               linear-gradient(135deg, #06213c 0%, #123a6b 55%, #1b4a86 100%);

  /* Motion */
  --ease: cubic-bezier(.2,.7,.2,1);
  --t-fast: 160ms;
  --t-base: 220ms;
  --t-slow: 320ms;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ar);
  font-feature-settings: "ss01" on, "kern" on;
  color: var(--ink-900);
  background: var(--bg);
  direction: ltr;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Base type scale (Arabic-tuned) */
.h-display { font-size: 64px; line-height: 1.05; letter-spacing: -0.02em; font-weight: 800; }
.h-1 { font-size: 48px; line-height: 1.1; letter-spacing: -0.02em; font-weight: 800; }
.h-2 { font-size: 36px; line-height: 1.15; letter-spacing: -0.01em; font-weight: 700; }
.h-3 { font-size: 28px; line-height: 1.2; font-weight: 700; }
.h-4 { font-size: 22px; line-height: 1.3; font-weight: 700; }
.h-5 { font-size: 18px; line-height: 1.4; font-weight: 700; }
.t-lead { font-size: 19px; line-height: 1.55; color: var(--ink-600); }
.t-body { font-size: 15px; line-height: 1.6; color: var(--ink-700); }
.t-small { font-size: 13px; line-height: 1.5; color: var(--ink-500); }
.t-micro { font-size: 11px; line-height: 1.4; letter-spacing: .04em; color: var(--ink-500); text-transform: uppercase; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px;
  font-family: inherit; font-size: 15px; font-weight: 700;
  border-radius: var(--r-md); border: 1px solid transparent;
  cursor: pointer; user-select: none;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary-600); color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,.1) inset, 0 6px 16px rgba(62, 100, 222,.32);
}
.btn-primary:hover { background: var(--primary-700); box-shadow: 0 1px 0 rgba(255,255,255,.1) inset, 0 8px 22px rgba(62, 100, 222,.42); }
.btn-grad {
  background: var(--grad-primary); color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 8px 22px rgba(124,58,237,.36);
}
.btn-outline { background: transparent; color: var(--ink-900); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--ink-50); border-color: var(--ink-300); }
.btn-ghost { background: transparent; color: var(--ink-900); }
.btn-ghost:hover { background: var(--ink-100); }
.btn-success { background: var(--emerald-500); color: white; box-shadow: 0 6px 16px rgba(16,185,129,.28); }
.btn-wa { background: #25D366; color: white; box-shadow: 0 6px 16px rgba(37,211,102,.28); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.btn-block { display: flex; width: 100%; }

/* Pills / chips */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px;
  font-size: 12px; font-weight: 600;
  border-radius: var(--r-full);
  background: var(--ink-100); color: var(--ink-700);
}
.pill-primary { background: var(--primary-50); color: var(--primary-700); }
.pill-gold    { background: #FEF3C7; color: var(--gold-600); }
.pill-emerald { background: #D1FAE5; color: var(--emerald-600); }
.pill-rose    { background: #FFE4E6; color: #BE123C; }
.pill-dark    { background: var(--ink-900); color: white; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

/* Avatars (initial-based) */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 999px;
  font-weight: 700; color: white; font-size: 14px;
  background: var(--grad-primary);
  flex-shrink: 0;
}
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-xl { width: 96px; height: 96px; font-size: 32px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }

/* Star row */
.stars { display: inline-flex; gap: 2px; color: var(--gold-500); }
.stars svg { width: 14px; height: 14px; }

/* Course thumbnail placeholder (gradient) */
.thumb {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #EC4899 100%);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.95);
  font-weight: 800; font-size: 22px; text-align: center;
  padding: 20px;
}
.thumb::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(60% 60% at 80% 0%, rgba(255,255,255,.25), transparent 60%),
    radial-gradient(50% 60% at 0% 100%, rgba(0,0,0,.18), transparent 60%);
  pointer-events: none;
}
.thumb-1 { background: linear-gradient(135deg, #3e64de, #00263e); }
.thumb-2 { background: linear-gradient(135deg, #0EA5E9, #6366F1); }
.thumb-3 { background: linear-gradient(135deg, #F59E0B, #F97316); }
.thumb-4 { background: linear-gradient(135deg, #10B981, #06B6D4); }
.thumb-5 { background: linear-gradient(135deg, #EC4899, #8B5CF6); }
.thumb-6 { background: linear-gradient(135deg, #1E293B, #334155); }
.thumb-7 { background: linear-gradient(135deg, #DC2626, #F59E0B); }
.thumb-8 { background: linear-gradient(135deg, #059669, #84CC16); }

/* Progress */
.prog {
  height: 6px; border-radius: 999px; background: var(--ink-100); overflow: hidden;
}
.prog > i { display: block; height: 100%; background: var(--grad-primary); border-radius: 999px; }

/* Inputs */
.input {
  display: flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 16px;
  background: white; border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 15px; font-family: inherit;
  width: 100%;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input:focus-within, .input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(99,102,241,.12);
  outline: none;
}
.input input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; min-width: 0; }
.label-sm { font-size: 13px; font-weight: 600; color: var(--ink-700); margin-bottom: 6px; display: block; }

/* Helpers */
.flex { display: flex; }
.col  { display: flex; flex-direction: column; }
.center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.gap-5 { gap: 20px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.muted { color: var(--ink-500); }
.divider { height: 1px; background: var(--border); }

/* Scrollbar nicety */
.scroller::-webkit-scrollbar { width: 8px; height: 8px; }
.scroller::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 99px; }

/* RTL: ensure number/code stays LTR where needed */
.ltr { direction: ltr; unicode-bidi: isolate; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
