
/* ================= فونت‌ها ================= */
/* ایران‌سنس (در صورت قرار دادن فایل‌های لایسنس‌دار در fonts/) */
@font-face { font-family: 'IRANSans'; src: url('/static/fonts/IRANSansWeb.woff2') format('woff2');
  font-weight: 400; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('/static/fonts/IRANSansWeb_Medium.woff2') format('woff2');
  font-weight: 500; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('/static/fonts/IRANSansWeb_Bold.woff2') format('woff2');
  font-weight: 700; font-display: swap; }
/* وزیرمتن — بکاپ رایگان باندل‌شده */
@font-face { font-family: 'Vazirmatn'; src: url('/static/fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/static/fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url('/static/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700; font-display: swap; }

:root {
  --primary: #1f4e79; --primary-dark: #173a5a; --accent: #e8a33d;
  --bg: #f4f6f9; --card: #ffffff; --border: #d7dee8; --text: #243041; --muted: #64748b;
  --ok: #16a34a; --err: #dc2626; --warn: #d97706;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'IRANSans', 'IRANSansX', 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif; font-size: 15px;
}
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; padding: 14px 22px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
header h1 { font-size: 20px; margin: 0; flex: 1; }
header .chip { font-size: 12px; background: rgba(255,255,255,.15); padding: 4px 10px; border-radius: 20px; }
nav.stepper { display: flex; gap: 6px; background: #fff; padding: 10px 18px; border-bottom: 1px solid var(--border); overflow-x: auto; }
nav.stepper button {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; font-family: inherit; font-size: 14px;
  white-space: nowrap; display: flex; align-items: center; gap: 8px;
}
nav.stepper button .num {
  background: var(--primary); color: #fff; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
nav.stepper button.active { background: var(--primary); color: #fff; }
nav.stepper button.active .num { background: #fff; color: var(--primary); }
nav.stepper button:disabled { opacity: .45; cursor: not-allowed; }
main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
section.step { display: none; }
section.step.active { display: block; animation: fade .25s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 14px; font-size: 17px; color: var(--primary); }
.card h3 { margin: 12px 0 8px; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=number], select, textarea {
  border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font-family: inherit;
  font-size: 14px; background: #fff; color: var(--text); width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
.days { display: flex; flex-wrap: wrap; gap: 8px; }
.days label { display: flex; align-items: center; gap: 6px; background: #f1f5f9; padding: 7px 12px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.days label.on { background: #dbeafe; color: var(--primary); font-weight: bold; }
.btn {
  background: var(--primary); color: #fff; border: 0; border-radius: 10px; padding: 10px 20px;
  font-family: inherit; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.accent { background: var(--accent); color: #222; }
.btn.danger { background: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
table.editor { width: 100%; border-collapse: collapse; font-size: 14px; }
table.editor th { background: #f1f5f9; color: var(--muted); font-size: 12px; padding: 8px; text-align: right; }
table.editor td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.editor td input, table.editor td select { min-width: 90px; }
.teacher-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 14px; background: #fbfdff; }
.teacher-card .head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.teacher-card .head input.name { max-width: 180px; font-weight: bold; }
.tag { display: inline-block; background: #eef2ff; color: var(--primary); border-radius: 8px; padding: 3px 10px; font-size: 12px; }
.tag.warn { background: #fef3c7; color: #92400e; }
.msg { border-radius: 10px; padding: 10px 14px; margin: 8px 0; font-size: 14px; }
.msg.err { background: #fee2e2; color: #991b1b; }
.msg.ok { background: #dcfce7; color: #166534; }
.msg.info { background: #e0f2fe; color: #075985; }
.msg.warn { background: #fef3c7; color: #92400e; }
ul.plain { margin: 4px 0; padding-right: 18px; }
.progress { height: 8px; background: #e2e8f0; border-radius: 6px; overflow: hidden; margin: 12px 0; }
.progress > div { height: 100%; width: 35%; background: linear-gradient(90deg, var(--primary), var(--accent)); animation: slide 1.2s infinite; }
@keyframes slide { 0% { margin-right: 100%; } 100% { margin-right: -35%; } }
table.timetable { border-collapse: collapse; width: 100%; font-size: 13px; direction: rtl; }
table.timetable th, table.timetable td { border: 1px solid var(--border); padding: 7px 6px; text-align: center; }
table.timetable th { background: var(--primary); color: #fff; }
table.timetable td.alt { background: #fff2cc; }
table.timetable td.dir0 { background: #e2efda; }
table.timetable td.dir1 { background: #fce4ec; }
table.timetable td small { color: var(--muted); display: block; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--border); background: #fff; padding: 6px 14px; border-radius: 9px; cursor: pointer; font-family: inherit; }
.tabs button.active { background: var(--primary); color: #fff; }
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-bg.show { display: flex; }
.modal { background: #fff; border-radius: 14px; padding: 20px; width: min(520px, 92vw); max-height: 88vh; overflow: auto; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }
.hint { font-size: 12.5px; color: var(--muted); }
.badge { padding: 3px 10px; border-radius: 14px; font-size: 12px; font-weight: bold; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.err { background: #fee2e2; color: #991b1b; }

/* ================= آموزش و راهنما (نسخهٔ ۳) ================= */
.tour-overlay { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.tour-spot {
  position: fixed; z-index: 91; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 4px rgba(232,163,61,.95), 0 0 0 4000px rgba(15,23,42,.6);
  transition: all .3s ease;
}
.tour-tip {
  position: fixed; z-index: 95; background: #fff; border-radius: 14px; padding: 14px 16px;
  width: min(360px, 92vw); box-shadow: 0 12px 40px rgba(0,0,0,.35); border: 1px solid var(--border);
  pointer-events: auto;
}
.tour-tip h3 { margin: 0 0 8px; font-size: 15px; color: var(--primary); display:flex; align-items:center; gap:8px; }
.tour-tip p { margin: 0; font-size: 13.5px; line-height: 1.9; color: var(--text); }
.tour-tip .bar { display:flex; align-items:center; gap:8px; margin-top:12px; }
.tour-tip .bar .sp { flex:1 }
.tour-dots { display:flex; gap:4px }
.tour-dots i { width:7px; height:7px; border-radius:50%; background:#cbd5e1; display:block }
.tour-dots i.on { background: var(--primary) }
.check { list-style:none; padding:0; margin:12px 0 0; border:1px solid var(--border); border-radius:12px; overflow:hidden }
.check li { display:flex; gap:10px; align-items:flex-start; padding:9px 12px; border-bottom:1px solid var(--border); font-size:13.5px }
.check li:last-child { border-bottom:0 }
.check li .st { width:22px; height:22px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  background:#e2e8f0; color:#64748b; font-size:13px; flex:none; margin-top:1px }
.check li.done { background:#f0fdf4 }
.check li.done .st { background:var(--ok); color:#fff }
.help-drawer {
  position: fixed; top:0; bottom:0; right:-440px; width:min(430px,94vw); z-index:96;
  background:#fff; box-shadow:-8px 0 30px rgba(0,0,0,.18); transition:right .25s; display:flex; flex-direction:column;
}
.help-drawer.open { right:0 }
.help-drawer .hd-head { background:var(--primary); color:#fff; padding:14px 18px; display:flex; align-items:center; gap:10px }
.help-drawer .hd-head h2 { margin:0; font-size:16px; flex:1 }
.help-drawer .hd-body { overflow:auto; padding:14px 18px; flex:1 }
.help-sec { border:1px solid var(--border); border-radius:12px; margin-bottom:10px; overflow:hidden }
.help-sec summary { padding:11px 14px; cursor:pointer; font-weight:bold; font-size:14px; color:var(--primary); background:#f8fafc }
.help-sec .b { padding:4px 14px 12px; font-size:13.5px; line-height:2 }
.help-sec .b b { color: var(--primary-dark) }
.welcome-hero { text-align:center; padding:6px 4px 2px }
.welcome-hero .big { font-size:44px }
.welcome-hero h2 { margin:8px 0 6px; color: var(--primary) }
.welcome-hero p { color:var(--muted); font-size:13.5px; line-height:1.9 }
.wchoice { display:flex; flex-direction:column; gap:10px; margin-top:14px }
.wchoice button { text-align:right; padding:13px 16px; border:1.5px solid var(--border); background:#fff; border-radius:12px;
  cursor:pointer; font-family:inherit; display:flex; gap:12px; align-items:center; font-size:14.5px }
.wchoice button:hover { border-color: var(--primary); background:#f8fbff }
.wchoice button .ic { font-size:22px }
.wchoice button small { display:block; color:var(--muted); font-size:12px; margin-top:3px }
.qmark { display:inline-flex; width:18px; height:18px; border-radius:50%; background:var(--primary); color:#fff;
  font-size:11px; align-items:center; justify-content:center; cursor:pointer; margin-inline-start:6px; vertical-align:middle }

/* راهنمای مفصل */
.help-sec .b ul { margin: 6px 0; padding-right: 20px }
.help-sec .b li { margin-bottom: 4px }
.help-sec .b code { background:#eef2f7; border-radius:6px; padding:1px 6px; font-size:12.5px }
.help-sec .b table { border-collapse:collapse; width:100%; margin:8px 0; font-size:12.5px }
.help-sec .b th, .help-sec .b td { border:1px solid var(--border); padding:6px 8px; text-align:right }
.help-sec .b th { background:#f1f5f9 }
#helpSearch { border:1px solid var(--border); border-radius:10px; padding:8px 12px; font-family:inherit; font-size:13.5px }
.help-empty { color:var(--muted); text-align:center; padding:24px 8px; font-size:13.5px }

/* ================= موبایل ================= */
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tscroll table { margin-bottom: 0; }
@media (max-width: 480px) {
  body { font-size: 14px; }
  header h1 { font-size: 17px; }
  main { padding: 12px 8px 50px; }
  .card { padding: 12px; border-radius: 12px; }
  table.editor, table.timetable { font-size: 12px; }
  table.editor th, table.editor td { padding: 4px 5px; }
  table.timetable th, table.timetable td { padding: 5px 4px; }
  .btn { padding: 8px 14px; font-size: 13.5px; }
  .tour-tip { width: min(320px, 94vw); }
  .modal { padding: 14px; }
}
