/* ===== طراحی: باغچهٔ درس — پوستهٔ بصری اپ تکلیف دبستانی ===== */
/* پالت: صبح در باغچه — پس‌زمینهٔ مه‌آلود سبز، برگ تیره برای متن، زرد آفتاب و نارنجی مرجانی برای انرژی */

:root {
  --bg: #EAF4E9;
  --bg-soft: #F5FAF3;
  --surface: #FFFFFF;
  --ink: #21351F;
  --ink-soft: #4B5D48;
  --leaf: #3F7A52;
  --leaf-dark: #2A5238;
  --leaf-pale: #CFE7D2;
  --sun: #F6C453;
  --sun-dark: #D9A62E;
  --coral: #E8734A;
  --coral-dark: #C85A34;
  --sky: #BFE1E8;
  --sky-dark: #5B93A0;
  --line: #D8E8D6;
  --shadow: 0 10px 30px -12px rgba(33, 53, 31, 0.25);
  --shadow-sm: 0 4px 14px -6px rgba(33, 53, 31, 0.2);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: 'Vazirmatn', 'Tahoma', sans-serif;
  --font-body: 'Vazirmatn', 'Tahoma', sans-serif;
}

:root.dark {
  --bg: #142014;
  --bg-soft: #192619;
  --surface: #1F2E20;
  --ink: #E8F2E6;
  --ink-soft: #A9BFA6;
  --leaf: #6FBF86;
  --leaf-dark: #9CDCAE;
  --leaf-pale: #2A4530;
  --sun: #F6C453;
  --sun-dark: #E0B23F;
  --coral: #F0906B;
  --coral-dark: #E8734A;
  --sky: #375057;
  --sky-dark: #7FC2D1;
  --line: #2F452F;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 4px 14px -6px rgba(0, 0, 0, 0.45);
}
:root.dark body { background: var(--bg); color: var(--ink); }
:root.dark img.mono-invert { filter: none; }

.theme-toggle-btn {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  width: 42px; height: 42px; font-size: 1.1rem; cursor: pointer; display: grid; place-items: center;
}

@keyframes sproutPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(246,196,83,0)); }
  35% { transform: scale(1.12); filter: drop-shadow(0 0 14px rgba(246,196,83,.75)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(246,196,83,0)); }
}
.sprout-grow { animation: sproutPulse 1.1s ease-in-out; }

@keyframes floatUpFade {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(-46px); opacity: 0; }
}
.growth-float {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  font-weight: 800; color: var(--sun-dark); font-size: .95rem;
  animation: floatUpFade 1.6s ease-out forwards; pointer-events: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  direction: rtl;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3 { font-family: var(--font-display); color: var(--leaf-dark); margin: 0; line-height: 1.25; }
h1 { font-weight: 900; }
h2 { font-weight: 800; }
h3 { font-weight: 700; }
p { margin: 0; color: var(--ink-soft); line-height: 1.9; }

/* ===== لایوت پایه: سایدبار (دسکتاپ) + نوار پایین (موبایل) ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--line);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--leaf-dark);
}
.brand .leaf-badge {
  width: 38px; height: 38px;
  background: var(--leaf);
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.2rem;
}

.nav-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-weight: 600; color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.nav-item .ic { font-size: 1.15rem; }
.nav-item:hover { background: var(--bg-soft); color: var(--ink); }
.nav-item.active { background: var(--leaf-pale); color: var(--leaf-dark); }

.sidebar-foot { margin-top: auto; }
.role-switch {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px; border-radius: var(--radius-sm);
  background: var(--bg-soft); font-size: .8rem; color: var(--ink-soft);
}
.role-switch a { color: var(--leaf-dark); font-weight: 700; }

.main {
  flex: 1;
  min-width: 0;
  padding: 30px 34px 100px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 26px; gap: 16px; flex-wrap: wrap;
}
.greeting { display: flex; align-items: center; gap: 14px; }
.avatar-circle {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sun), var(--coral));
  display: grid; place-items: center; font-size: 1.4rem;
  box-shadow: var(--shadow-sm);
}
.streak-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: .85rem;
  box-shadow: var(--shadow-sm);
}

/* ===== بات‌نو موبایل ===== */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; right: 0; left: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(env(safe-area-inset-bottom, 0px) + 8px);
  justify-content: space-around;
  z-index: 40;
  box-shadow: 0 -6px 20px -10px rgba(33,53,31,.25);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: .68rem; font-weight: 700; color: var(--ink-soft);
  padding: 4px 10px; border-radius: 10px;
}
.bottom-nav a .ic { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--leaf-dark); background: var(--leaf-pale); }

/* ===== کارت‌ها ===== */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.card-stat .num { font-family: var(--font-display); font-weight: 900; font-size: 2rem; color: var(--leaf-dark); }
.card-stat .label { color: var(--ink-soft); font-size: .85rem; margin-top: 4px; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 14px; }
.section-head h2 { font-size: 1.1rem; }
.see-all { font-size: .82rem; font-weight: 700; color: var(--leaf); }

.task-scroll { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.task-scroll::-webkit-scrollbar { display: none; }
.task-card {
  min-width: 168px; background: var(--surface); border-radius: var(--radius-md);
  padding: 16px; border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px;
}
.task-type-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem;
}
.task-card .subject { font-weight: 700; font-size: .92rem; }
.task-card .due { font-size: .75rem; color: var(--ink-soft); }
.task-badge {
  align-self: flex-start; font-size: .68rem; font-weight: 800; padding: 3px 9px; border-radius: 999px;
}
.badge-new { background: #FDECD8; color: var(--coral-dark); }
.badge-done { background: var(--leaf-pale); color: var(--leaf-dark); }

/* رنگ‌های آیکون بر اساس نوع تکلیف */
.t-audio { background: #FDECD8; }
.t-photo { background: #E1EEFB; }
.t-draw { background: #F3E3F7; }
.t-color { background: #FFF2C6; }
.t-match { background: #DDF2E4; }
.t-connect { background: #E2F5F6; }

/* ===== شخصیت نشانه: نهالِ من ===== */
.sprout-panel {
  background: linear-gradient(180deg, var(--sky) 0%, var(--bg-soft) 70%);
  border-radius: var(--radius-lg);
  padding: 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
}
.sprout-panel .ground {
  position: absolute; bottom: 0; right: 0; left: 0; height: 46px;
  background: var(--leaf-dark);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.sprout-wrap { position: relative; z-index: 2; cursor: pointer; display: inline-block; }
.sprout-wrap svg { width: 128px; height: 128px; transform-origin: 50% 100%; }
.sprout-wrap.wiggle svg { animation: sprout-wiggle .6s ease; }
@keyframes sprout-wiggle {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-6deg); }
  55% { transform: rotate(5deg); }
  80% { transform: rotate(-2deg); }
  100% { transform: rotate(0deg); }
}
.sprout-title { font-family: var(--font-display); font-weight: 900; margin-top: 8px; color: var(--leaf-dark); }
.sprout-sub { font-size: .82rem; color: var(--ink-soft); margin-top: 2px; }
.sprout-progress {
  margin: 16px auto 0; max-width: 260px; height: 10px; background: rgba(255,255,255,.6);
  border-radius: 999px; overflow: hidden; border: 1px solid rgba(255,255,255,.8);
}
.sprout-progress > div { height: 100%; background: linear-gradient(90deg, var(--leaf), var(--sun)); border-radius: 999px; }

.garden-weather {
  position: absolute; top: 14px; left: 14px; z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 6px 10px; box-shadow: var(--shadow-sm);
}
.gw-icon { font-size: 1.35rem; display: inline-block; line-height: 1; }
.gw-label { font-size: .6rem; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.gw-sunny .gw-icon { animation: gw-pulse 2.4s ease-in-out infinite; }
.gw-partly .gw-icon { animation: gw-float 3.2s ease-in-out infinite; }
.gw-cloudy .gw-icon { animation: gw-drift 5s ease-in-out infinite; }
.gw-rainy .gw-icon { animation: gw-bounce 2.6s ease-in-out infinite; }
@keyframes gw-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
@keyframes gw-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes gw-drift { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }
@keyframes gw-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(2px); } }

/* ===== جدول‌های ساده (ادمین/معلم) ===== */
.simple-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.simple-table th { text-align: right; color: var(--ink-soft); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.simple-table td { padding: 12px; border-bottom: 1px solid var(--line); }
.simple-table tr:last-child td { border-bottom: none; }
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.pill-ok { background: var(--leaf-pale); color: var(--leaf-dark); }
.pill-warn { background: #FDECD8; color: var(--coral-dark); }
.pill-idle { background: #EDEDED; color: #6B6B6B; }
.muted { color: var(--ink-soft); font-size: .85rem; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 20px; border-radius: 14px; font-weight: 800; font-size: .9rem;
  border: none; transition: transform .12s, box-shadow .12s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--leaf); color: #fff; box-shadow: var(--shadow-sm); }
.btn-sun { background: var(--sun); color: var(--leaf-dark); box-shadow: var(--shadow-sm); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }

/* این سه کلاس در برخی صفحات (پنل مهارت، ساخت تکلیف هوشمند) استفاده شده‌اند
   بدون این‌که در جایی تعریف شوند — این تعاریف معادل بصری .btn/.btn-primary،
   .btn/.btn-ghost و .field input هستند تا همان‌جا رندر درست بشوند. */
.primary-btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 20px; border-radius: 14px; font-weight: 800; font-size: .9rem;
  border: none; background: var(--leaf); color: #fff; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.primary-btn:active { transform: scale(.97); }
.secondary-btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 20px; border-radius: 14px; font-weight: 800; font-size: .9rem;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.secondary-btn:active { transform: scale(.97); }
.input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); font-family: inherit; background: var(--bg-soft);
}

.progress-bar { height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.progress-bar > div { height: 100%; background: var(--leaf); border-radius: 999px; }

/* ===== ریسپانسیو ===== */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .sidebar { display: none; }
  .main { padding: 20px 16px 92px; }
  .bottom-nav { display: flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.4rem; }
}

/* ===== جشنواره ===== */
.festival-banner {
  display: flex; align-items: center; gap: 10px; background: linear-gradient(90deg, #FDECD8, #F6E3C4);
  border: 1px solid var(--sun-dark); border-radius: var(--radius-md); padding: 12px 16px; margin: 18px 0 4px;
  font-size: .85rem; font-weight: 700; color: var(--coral-dark);
}

/* ===== راهنمای هر داشبورد (help accordion) — مشترک بین admin/teacher/student/parent ===== */
.help-icon-btn {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  width: 42px; height: 42px; font-size: 1.1rem; cursor: pointer; flex-shrink: 0;
}
.help-section { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.help-section summary {
  cursor: pointer; padding: 12px 14px; font-weight: 800; font-size: .86rem;
  background: var(--bg); list-style: none; display: flex; align-items: center; gap: 8px;
}
.help-section summary::-webkit-details-marker { display: none; }
.help-section summary::after { content: '▾'; margin-inline-start: auto; color: var(--ink-soft); font-size: .75rem; transition: transform .15s; }
.help-section[open] summary::after { transform: rotate(180deg); }
.help-body { padding: 2px 14px 14px; font-size: .82rem; line-height: 2; color: var(--ink-soft); }
.help-body p { margin: 6px 0; }
.help-body ul { margin: 6px 0; padding-inline-start: 20px; }
.help-body li { margin: 4px 0; }
.help-body b { color: var(--ink); }
