/* =========================================================
   آزمون‌ساز — Design System (Premium / SaaS)
   public/css/design-system.css
   ========================================================= */

:root {
  --ds-bg: #f4f6fb;
  --ds-surface: #ffffff;
  --ds-ink: #0f172a;
  --ds-muted: #64748b;
  --ds-border: rgba(15, 23, 42, 0.06);
  --ds-primary: #2563eb;
  --ds-primary-2: #3b82f6;
  --ds-primary-soft: #eff6ff;
  --ds-accent: #06b6d4;
  --ds-success: #10b981;
  --ds-danger: #f43f5e;
  --ds-warning: #f59e0b;
  --ds-radius: 1.25rem;
  --ds-radius-sm: 0.875rem;
  --ds-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -8px rgba(15, 23, 42, 0.08);
  --ds-shadow-lg: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 20px 40px -12px rgba(15, 23, 42, 0.12);
  --ds-shadow-glow: 0 0 0 1px rgba(59, 130, 246, 0.12), 0 12px 40px -8px rgba(37, 99, 235, 0.35);
}

html { scroll-behavior: smooth; }
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(59, 130, 246, 0.09), transparent 55%),
    radial-gradient(900px 500px at -10% 20%, rgba(6, 182, 212, 0.07), transparent 50%),
    var(--ds-bg);
  color: var(--ds-ink);
}
::selection { background: #bfdbfe; color: #1e3a8a; }

/* ---------- Surfaces ---------- */
.ds-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.ds-card:hover {
  box-shadow: var(--ds-shadow-lg);
  border-color: rgba(59, 130, 246, 0.14);
}
.ds-card-static {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
}
.ds-glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
}

/* ---------- Buttons ---------- */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.25rem;
  font-size: .875rem;
  font-weight: 600;
  border-radius: .9rem;
  transition: all .18s ease;
  border: none;
  cursor: pointer;
  line-height: 1.25;
}
.ds-btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(37, 99, 235, 0.55);
}
.ds-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -6px rgba(37, 99, 235, 0.6);
  filter: brightness(1.05);
}
.ds-btn-primary:active { transform: translateY(0); }
.ds-btn-secondary {
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ds-btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.ds-btn-ghost {
  background: transparent;
  color: #64748b;
}
.ds-btn-ghost:hover { background: #f1f5f9; color: #0f172a; }
.ds-btn-danger {
  background: linear-gradient(135deg, #fb7185, #e11d48);
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(225, 29, 72, 0.45);
}
.ds-btn-sm { padding: .45rem .9rem; font-size: .8125rem; border-radius: .7rem; }
.ds-btn-lg { padding: .9rem 1.6rem; font-size: .95rem; border-radius: 1rem; }
.ds-btn-block { width: 100%; }

/* ---------- Inputs ---------- */
.ds-input {
  width: 100%;
  padding: .8rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: .9rem;
  font-size: .875rem;
  background: #fff;
  color: #0f172a;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ds-input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}
.ds-input-icon { padding-right: 2.5rem; }
.ds-label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: .4rem;
}

/* ---------- Badges ---------- */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .65rem;
  font-size: .7rem;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: .01em;
}
.ds-badge-green { background: #ecfdf5; color: #047857; }
.ds-badge-blue { background: #eff6ff; color: #1d4ed8; }
.ds-badge-amber { background: #fffbeb; color: #b45309; }
.ds-badge-rose { background: #fff1f2; color: #be123c; }
.ds-badge-violet { background: #f5f3ff; color: #6d28d9; }
.ds-badge-slate { background: #f1f5f9; color: #475569; }

/* ---------- Page chrome ---------- */
.ds-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
  line-height: 1.3;
}
.ds-page-sub {
  font-size: .875rem;
  color: #64748b;
  margin-top: .35rem;
}
.ds-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

/* ---------- Stat cards ---------- */
.ds-stat {
  position: relative;
  overflow: hidden;
  padding: 1.15rem 1.25rem;
  border-radius: var(--ds-radius);
  background: #fff;
  border: 1px solid var(--ds-border);
  box-shadow: var(--ds-shadow);
}
.ds-stat::after {
  content: '';
  position: absolute;
  inset-inline-end: -20%;
  top: -30%;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,.12), transparent 70%);
  pointer-events: none;
}
.ds-stat-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* ---------- Exam / product cards ---------- */
.ds-exam-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--ds-border);
  border-radius: 1.35rem;
  padding: 1.35rem;
  box-shadow: var(--ds-shadow);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s ease, border-color .22s ease;
  overflow: hidden;
}
.ds-exam-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #06b6d4, #60a5fa);
  opacity: 0;
  transition: opacity .2s ease;
}
.ds-exam-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--ds-shadow-lg);
  border-color: rgba(59, 130, 246, 0.18);
}
.ds-exam-card:hover::before { opacity: 1; }

/* ---------- Hero mesh ---------- */
.ds-hero {
  position: relative;
  overflow: hidden;
}
.ds-hero-mesh {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 40%, rgba(99,102,241,.18), transparent),
    radial-gradient(ellipse 70% 50% at 85% 20%, rgba(6,182,212,.14), transparent),
    radial-gradient(ellipse 50% 40% at 60% 90%, rgba(167,139,250,.12), transparent);
  pointer-events: none;
}
.ds-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148,163,184,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,.07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}

/* ---------- Header ---------- */
.ds-header {
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-bottom: 1px solid rgba(15,23,42,.06);
}
.ds-logo-mark {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: .85rem;
  background: linear-gradient(145deg, #60a5fa, #2563eb 60%, #1e40af);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 6px 16px -4px rgba(79,70,229,.5);
}

/* ---------- Empty state ---------- */
.ds-empty {
  text-align: center;
  padding: 3.5rem 1.5rem;
  border-radius: var(--ds-radius);
  background: #fff;
  border: 1px dashed #e2e8f0;
}
.ds-empty-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
  border-radius: 1.25rem;
  background: linear-gradient(145deg, #eff6ff, #dbeafe);
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* ---------- Table ---------- */
.ds-table-wrap {
  background: #fff;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow);
  overflow: hidden;
}
.ds-table-wrap table thead tr {
  background: #f8fafc;
}
.ds-table-wrap table th {
  font-size: .75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: none;
  letter-spacing: 0;
}

/* ---------- Auth split ---------- */
.ds-auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 1024px) {
  .ds-auth-shell { grid-template-columns: 1.05fr 1fr; }
}
.ds-auth-panel {
  position: relative;
  display: none;
  overflow: hidden;
  background: linear-gradient(160deg, #1e3a8a 0%, #2563eb 45%, #0e7490 100%);
  color: #fff;
}
@media (min-width: 1024px) {
  .ds-auth-panel { display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; }
}
.ds-auth-panel::before {
  content: '';
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 65%);
  top: -80px; left: -80px;
}
.ds-auth-panel::after {
  content: '';
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6,182,212,.35), transparent 70%);
  bottom: 10%; right: -40px;
}

/* ---------- Bottom nav ---------- */
.ds-bottom-nav {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(15,23,42,.06);
  box-shadow: 0 -8px 30px rgba(15,23,42,.04);
}

/* ---------- Animations ---------- */
@keyframes ds-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ds-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.ds-animate-in { animation: ds-fade-up .45s ease-out both; }
.ds-float { animation: ds-float 5s ease-in-out infinite; }

/* stagger children */
.ds-stagger > *:nth-child(1) { animation-delay: .04s; }
.ds-stagger > *:nth-child(2) { animation-delay: .08s; }
.ds-stagger > *:nth-child(3) { animation-delay: .12s; }
.ds-stagger > *:nth-child(4) { animation-delay: .16s; }
.ds-stagger > *:nth-child(5) { animation-delay: .2s; }
.ds-stagger > *:nth-child(6) { animation-delay: .24s; }
.ds-stagger > * { animation: ds-fade-up .45s ease-out both; }

/* safe area */
.safe-area-pb { padding-bottom: env(safe-area-inset-bottom, 0); }

/* line clamp helper */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Scroll reveal (صفحه اصلی) ---------- */
.reveal,
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.active,
.reveal.visible,
.reveal.revealed,
[data-reveal].active,
[data-reveal].visible,
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* بدون JS: بعد از لود کامل محتوا دیده شود */
@supports not (animation: reveal-fallback) {
  .reveal, [data-reveal] { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal, [data-reveal] { opacity: 1; transform: none; transition: none; }
}
