/* ============================================================
   PyLearn — Shared Design System (common.css)
   ------------------------------------------------------------
   این فایل منبع واحد ظاهر پروژه است.
   برای تغییر بک‌گراند، رنگ‌ها، آیکون‌های نوار پایین،
   انیمیشن‌ها و دکمه‌های مشترک فقط اینجا را ویرایش کنید.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

/* ---------- Design Tokens (رنگ‌ها و اندازه‌ها) ---------- */
:root {
  /* برند */
  --primary: #6b4de6;
  --primary-dark: #4c32b8;
  --primary-soft: #eeeaff;
  --secondary: #8ccb45;
  --secondary-soft: #edf8df;
  --accent: #f4b83f;
  --accent-soft: #fff4d8;
  --orange: #f28b35;

  /* سطوح */
  --background: #f8f7fc;
  --surface: #ffffff;
  --text: #242137;
  --text-soft: #716d82;
  --border: #e3e0eb;

  /* کد و وضعیت */
  --code: #25263a;
  --code-border: #2e3048;
  --success: #4f7f22;
  --error: #c4453c;

  /* چیدمان */
  --page-max: 480px;
  --page-max-wide: 560px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --shadow-soft: 0 2px 8px rgba(36, 33, 55, 0.04);
  --shadow-card: 0 8px 24px rgba(36, 33, 55, 0.06);
  --nav-height: 78px;
}

/* ---------- Reset پایه ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: "Vazirmatn", sans-serif;
  background:
    radial-gradient(circle at 90% 4%, rgba(107, 77, 230, 0.10), transparent 25%),
    radial-gradient(circle at 5% 80%, rgba(140, 203, 69, 0.09), transparent 28%),
    var(--background);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: 0; cursor: pointer; color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- اسکلت صفحه موبایل ---------- */
.page-shell,
.path-page,
.lesson-page,
.quiz-page,
.practice-page,
.complete-page,
.leaderboard-page,
.profile-page,
.mistakes-page,
.offline-page,
.loading-page,
.splash-page,
.login-page {
  width: 100%;
  min-height: 100dvh;
  max-width: var(--page-max);
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
}

.lesson-page,
.practice-page {
  max-width: var(--page-max-wide);
}

/* صفحه با نوار پایین — فضای خالی پایین */
.has-bottom-nav {
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

/* ---------- بک‌گراند Orbs (دایره‌های محو) ----------
   برای تغییر ظاهر بک‌گراند کل اپ، همین بخش را ویرایش کنید. */
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}
.orb-1 {
  width: 200px;
  height: 200px;
  background: var(--primary);
  top: -50px;
  left: -60px;
}
.orb-2 {
  width: 160px;
  height: 160px;
  background: var(--secondary);
  bottom: 140px;
  right: -50px;
}
/* نسخهٔ سوم اختیاری برای صفحات خاص */
.orb-3 {
  width: 120px;
  height: 120px;
  background: var(--accent);
  top: 40%;
  left: -40px;
  opacity: 0.22;
}

/* ---------- کارت‌های مشترک ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

/* ---------- دکمه‌های مشترک ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-align: center;
  width: 100%;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 6px 18px rgba(107, 77, 230, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 8px 22px rgba(107, 77, 230, 0.4);
}

.btn-secondary {
  background: var(--primary-soft);
  color: var(--primary);
}
.btn-secondary:hover { background: #e0d8ff; }

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); }

/* ---------- نوار پیشرفت ---------- */
.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8b6ff0);
  border-radius: var(--radius-pill);
  transition: width 0.25s ease;
}

/* ---------- هدر بازگشت ---------- */
.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 18px;
  color: var(--text);
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}

/* ---------- Bottom Navigation (نوار پایین)
   برای تغییر آیکون‌ها یا رنگ دایره‌ها فقط اینجا را ویرایش کنید. */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--page-max);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 50;
  box-shadow: 0 -4px 20px rgba(36, 33, 55, 0.06);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 56px;
  padding: 4px 0;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.2s ease;
}
.nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.nav-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.nav-item.active .nav-circle {
  transform: scale(1.1);
  box-shadow:
    0 0 0 3px rgba(107, 77, 230, 0.22),
    0 4px 16px rgba(107, 77, 230, 0.4);
  filter: none;
}
.nav-item.active .nav-home {
  box-shadow:
    0 0 0 3px rgba(107, 77, 230, 0.28),
    0 4px 16px rgba(107, 77, 230, 0.45);
}
.nav-item.active .nav-mistakes,
.nav-item.active .nav-practice {
  box-shadow:
    0 0 0 3px rgba(242, 139, 53, 0.28),
    0 4px 16px rgba(242, 139, 53, 0.4);
}
.nav-item.active .nav-rank {
  box-shadow:
    0 0 0 3px rgba(244, 184, 63, 0.3),
    0 4px 16px rgba(201, 162, 39, 0.4);
}
.nav-item.active .nav-profile {
  box-shadow:
    0 0 0 3px rgba(140, 203, 69, 0.3),
    0 4px 16px rgba(79, 127, 34, 0.35);
}

/* رنگ دایره‌های آیکون — از اینجا تغییر دهید */
.nav-home     { background: linear-gradient(145deg, #eeeaff, #dcd4ff); }
.nav-practice { background: linear-gradient(145deg, #fff0e0, #ffd9b0); }
.nav-mistakes { background: linear-gradient(145deg, #fff0e0, #ffd9b0); }
.nav-rank     { background: linear-gradient(145deg, #fff8e0, #ffe89a); }
.nav-profile  { background: linear-gradient(145deg, #e8f8df, #c8ecc0); }

.nav-label { line-height: 1.2; }

/* ---------- انیمیشن‌های مشترک
   برای تغییر یا اضافه کردن انیمیشن سراسری اینجا ویرایش کنید. */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-soft {
  0%, 100% { box-shadow: 0 6px 20px rgba(107, 77, 230, 0.35); }
  50% { box-shadow: 0 6px 28px rgba(107, 77, 230, 0.55); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* کلاس‌های کمکی انیمیشن */
.anim-float { animation: float 3.5s ease-in-out infinite; }
.anim-fade-slide { animation: fadeSlide 0.25s ease; }
.anim-fade-in { animation: fadeIn 0.3s ease; }

/* ---------- آمار بالای صفحه (الماس / استریک / فرصت) ---------- */
.top-stats {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}
.stat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 7px 10px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow-soft);
}
.stat-icon { font-size: 14px; line-height: 1; }
.stat.gems .stat-value { color: var(--primary); }
.stat.streak .stat-value { color: var(--orange); }
.stat.chances .stat-value { color: #c9a227; }

/* ---------- Utility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ---------- Responsive پایه ---------- */
@media (min-width: 768px) {
  .path-page,
  .leaderboard-page,
  .profile-page,
  .mistakes-page {
    max-width: 460px;
  }
  .nav-circle { width: 40px; height: 40px; font-size: 17px; }
}

@media (min-width: 1024px) {
  .path-page { max-width: var(--page-max); }
}


/* قاب یکسان صفحات اصلی (خانه / مرور / لیگ / پروفایل) */
.page-frame,
.path-page {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  box-sizing: border-box;
}


/* محتوا داخل قاب — تمام عرض مفید (بدون padding اضافه) */
.page-frame > main,
.page-frame .profile-page,
.page-frame .content,
.path-page > section,
.leaderboard-page > section {
  width: 100%;
  box-sizing: border-box;
}
