/* ==========================================================================
   پوستهٔ چهارتبی — هدر، ناوبری، پایه
   مشترک میان: گروه آمار · دانشمندان آمار · آموزش و یادگیری · مرکز مشاوره
   ========================================================================== */

/* ---------- ناوبری سه‌تبی ---------- */
.tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--r-full);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: .93rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.tab:hover { color: var(--fg); background: var(--surface-2); }

.tab[aria-current="page"] {
  color: #fff;
  background: var(--grad);
  box-shadow: 0 4px 14px -4px rgba(59, 130, 246, .5);
}
.tab[aria-current="page"] .tab__icon { opacity: 1; }
.tab__icon {
  width: 17px; height: 17px;
  opacity: .6;
  flex: none;
}
/* جای‌گاه نوار تب در هدر */
.nav__inner { position: relative; }
.nav__tabs { margin-inline-start: auto; margin-inline-end: 12px; }

@media (max-width: 900px) {
  .nav__tabs {
    order: 3;
    width: 100%;
    margin: 10px 0 0;
    justify-content: flex-start;
  }
  .nav__inner { flex-wrap: wrap; }
}

/* ---------- دکمهٔ جستجوی سریع ---------- */
.search-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-muted);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .16s var(--ease);
}
.search-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--surface-2);
}
.search-btn svg { width: 15px; height: 15px; flex: none; }
.search-btn kbd {
  font: inherit;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-dim);
  font-family: ui-monospace, monospace;
}
@media (max-width: 640px) { .search-btn kbd { display: none; } }

/* ---------- نوار پایین موبایل ----------
   فقط در صفحات learn/ فعال است (data-bottom-nav). چهار شریک:
   خانه / سرفصل‌ها / ابزارها / واژه‌نامه. */
.bottom-nav {
  display: none;
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
body[data-bottom-nav] .bottom-nav { display: flex; }
.bottom-nav__inner {
  flex: 1;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  max-width: 520px;
  margin: 0 auto;
}
.bn-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 7px 2px;
  border-radius: 12px;
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 700;
  transition: color .16s var(--ease), background .16s var(--ease);
}
.bn-item svg { width: 20px; height: 20px; flex: none; }
.bn-item[aria-current="page"] { color: var(--brand); background: var(--grad-soft); }
body[data-bottom-nav] main { padding-bottom: 84px; }

/* ---------- عنوان صفحه ---------- */
.page-head {
  padding: 46px 0 30px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}
.page-head__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--brand-2);
  background: rgba(34, 211, 238, .1);
  border: 1px solid rgba(34, 211, 238, .25);
  padding: 5px 13px;
  border-radius: var(--r-full);
  margin-bottom: 16px;
}
.page-head h1 {
  font-size: clamp(1.9rem, 4.2vw, 2.85rem);
  line-height: 1.22;
  margin: 0 0 12px;
  letter-spacing: -.02em;
}
.page-head__lede {
  font-size: 1.03rem;
  color: var(--fg-muted);
  max-width: 68ch;
  line-height: 1.85;
  margin: 0;
}

/* ---------- نوار ابزار فیلتر ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 26px;
  position: sticky;
  top: calc(var(--nav-h) + 8px);
  z-index: 20;
  backdrop-filter: blur(12px);
}

.search {
  flex: 1 1 260px;
  position: relative;
  min-width: 200px;
}
.search input {
  width: 100%;
  padding: 11px 40px 11px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--fg);
  font: inherit;
  font-size: .93rem;
}
.search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.search input::placeholder { color: var(--fg-dim); }
.search__icon {
  position: absolute;
  inset-inline-start: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--fg-dim);
  pointer-events: none;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 7px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .16s var(--ease);
}
.chip:hover { color: var(--fg); border-color: var(--brand); }
.chip[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ---------- شبکهٔ بخش‌ها (مسیر یادگیری) ----------
   الگو از مرجع: هر بخش یک کارتِ تمام‌عرض با عنوان، شمارش درس‌ها،
   نوار پیشرفت، پیش‌نمایش چند درس و لینک «مشاهده کامل بخش». */
.sec-list { display: grid; gap: 14px; margin-bottom: 34px; }

.sec-card {
  display: block;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: transform .2s var(--ease), border-color .2s var(--ease),
              box-shadow .2s var(--ease);
}
.sec-card::before {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: var(--grad);
  opacity: .55;
  transition: opacity .2s var(--ease);
}
.sec-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: var(--shadow);
}
.sec-card:hover::before { opacity: 1; }

/* ردیف عنوان بخش: شماره + عنوان + شمارش */
.sec-card__top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.sec-card__n {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 10px;
  background: var(--grad-soft);
  border: 1px solid var(--border);
  font-size: .85rem;
  font-weight: 800;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.sec-card h3 {
  font-size: 1.08rem;
  margin: 0;
  line-height: 1.45;
  flex: 1;
  min-width: 0;
}
.sec-card__count {
  flex: none;
  font-size: .76rem;
  font-weight: 700;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.sec-card__sub {
  font-size: .87rem;
  color: var(--fg-muted);
  margin: 0 0 14px;
  line-height: 1.7;
}

/* نوار پیشرفت — چون دادهٔ پیشرفت کاربر نداریم، فقط نشان می‌دهیم
   که این فضا برای پیشرفت است و مقدارش صفر است. */
.sec-card__bar {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.sec-card__bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--r-full);
  background: var(--grad);
  transition: width .5s var(--ease);
}
.sec-card__bar-note {
  display: flex;
  justify-content: space-between;
  font-size: .74rem;
  color: var(--fg-dim);
  margin: -6px 0 14px;
  font-weight: 600;
}

/* پیش‌نمایش درس‌های ابتدای بخش */
.sec-card__peek {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}
.peek-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: .85rem;
  color: var(--fg-muted);
}
.peek-row b { font-weight: 700; color: var(--fg); flex: 1; min-width: 0; }
.peek-row .lvl { flex: none; }
.peek-row__min {
  flex: none;
  font-size: .74rem;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.peek-row--more {
  justify-content: center;
  font-size: .8rem;
  color: var(--fg-dim);
  font-weight: 600;
}

.sec-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.pill {
  font-size: .74rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  white-space: nowrap;
}
/* دکمهٔ «مشاهده کامل بخش» در پایین کارت */
.sec-card__open {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .86rem;
  font-weight: 700;
  color: var(--brand);
}
.sec-card__open svg { width: 15px; height: 15px; }

/* ---------- نشان سطح ---------- */
.lvl {
  display: inline-block;
  font-size: .72rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--r-full);
  letter-spacing: .01em;
  white-space: nowrap;
}
/* پوستهٔ روشن: رنگ متن تیره برای کنتراست کافی */
.lvl[data-l="تازه‌کار"] { background: rgba(16,185,129,.14);  color: #047857; border: 1px solid rgba(16,185,129,.32); }
.lvl[data-l="کارآموز"]  { background: rgba(59,130,246,.12);  color: #1d4ed8; border: 1px solid rgba(59,130,246,.3); }
.lvl[data-l="متخصص"]    { background: rgba(139,92,246,.12);  color: #6d28d9; border: 1px solid rgba(139,92,246,.3); }
.lvl[data-l="حرفه‌ای"]  { background: rgba(217,119,6,.13);   color: #b45309; border: 1px solid rgba(217,119,6,.3); }
[data-theme="dark"] .lvl[data-l="تازه‌کار"] { color: #6ee7b7; }
[data-theme="dark"] .lvl[data-l="کارآموز"]  { color: #93c5fd; }
[data-theme="dark"] .lvl[data-l="متخصص"]    { color: #c4b5fd; }
[data-theme="dark"] .lvl[data-l="حرفه‌ای"]  { color: #fcd34d; }

/* ---------- کارت درس ---------- */
.lesson-list { display: grid; gap: 9px; }
.lesson-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  text-decoration: none;
  color: inherit;
  transition: border-color .16s var(--ease), background .16s var(--ease),
              transform .16s var(--ease);
}
.lesson-row:hover {
  border-color: var(--brand);
  background: var(--surface-2);
  transform: translateX(-3px);
}
.lesson-row__n {
  flex: none;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: .82rem;
  font-weight: 800;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
.lesson-row__body { flex: 1; min-width: 0; }
.lesson-row__title {
  font-size: .99rem;
  font-weight: 700;
  margin: 0 0 3px;
  line-height: 1.5;
}
.lesson-row__hook {
  font-size: .85rem;
  color: var(--fg-muted);
  margin: 0;
  line-height: 1.65;
}
.lesson-row__side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.lesson-row__min {
  font-size: .78rem;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- آمار کلی ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 22px 0 30px;
}
.stat {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-align: center;
}
.stat__n {
  font-size: 1.85rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat__l {
  font-size: .82rem;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* ---------- وضعیت خالی ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-dim);
}
.empty__icon { font-size: 2.4rem; margin-bottom: 12px; opacity: .5; }
.empty p { margin: 0 0 6px; }

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

/* ---------- صفحهٔ جستجو ---------- */
.search-meta {
  font-size: .88rem;
  color: var(--fg-muted);
  margin: -14px 0 20px;
  font-weight: 600;
}
mark {
  background: rgba(16, 185, 129, .18);
  color: inherit;
  border-radius: 4px;
  padding: 0 2px;
}
.search-more {
  text-align: center;
  color: var(--fg-dim);
  font-size: .85rem;
  margin: 20px 0 0;
}

/* ---------- صفحهٔ واژه‌نامه ---------- */
.glos-nav {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 26px;
}
.glos-nav button {
  padding: 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-muted);
  font: inherit;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .16s var(--ease);
}
.glos-nav button:hover { border-color: var(--brand); color: var(--brand); }
.glos-nav button[aria-pressed="true"] {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
}
.glos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.glos-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.glos-card h4 {
  margin: 0 0 6px;
  font-size: .96rem;
  color: var(--brand);
}
.glos-card p {
  margin: 0;
  font-size: .85rem;
  color: var(--fg-muted);
  line-height: 1.75;
}
.glos-card__src {
  margin-top: 9px;
  font-size: .74rem;
  color: var(--fg-dim);
}

/* ---------- صفحهٔ ابزارها ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}
.tool-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.tool-card__top {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 10px;
}
.tool-card__i {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--grad-soft);
  border: 1px solid var(--border);
  color: var(--brand);
}
.tool-card__i svg { width: 19px; height: 19px; }
.tool-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
}
.tool-card__d {
  margin: 0 0 13px;
  font-size: .87rem;
  color: var(--fg-muted);
  line-height: 1.75;
}
.tool-card__lessons {
  margin: 0 0 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tool-card__lessons--none {
  font-size: .8rem;
  color: var(--fg-dim);
}
.tool-card__lbl {
  font-size: .76rem;
  font-weight: 700;
  color: var(--fg-dim);
}
.tool-card__l {
  font-size: .78rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  text-decoration: none;
  transition: all .16s var(--ease);
}
.tool-card__l:hover { border-color: var(--brand); color: var(--brand); }
.tool-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- بخش‌های واژه‌نامه ---------- */
.glos-sec { margin-bottom: 34px; }
.glos-sec__h {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 1.15rem;
  margin: 0 0 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.glos-sec__n {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 10px;
  background: var(--grad-soft);
  border: 1px solid var(--border);
  font-size: .82rem;
  font-weight: 800;
  color: var(--brand);
}
.glos-sec__c {
  margin-inline-start: auto;
  font-size: .8rem;
  font-weight: 700;
  color: var(--fg-dim);
  font-variant-numeric: tabular-nums;
}
a.glos-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}
a.glos-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}


/* ─────────────── چهار تب روی موبایل ─────────────── */
@media (max-width: 640px) {
  .nav__tabs .tab { padding: 8px 12px; font-size: 13px; gap: 6px; }
  .nav__tabs .tab__icon { width: 15px; height: 15px; }
}
@media (max-width: 480px) {
  /* نمادها را برمی‌داریم تا هر چهار تب در یک نگاه جا شوند */
  .nav__tabs .tab__icon { display: none; }
  .nav__tabs .tab { padding: 8px 7px; font-size: 12px; flex: 1 1 auto; justify-content: center; white-space: nowrap; }
}
