/* ===== مُعين المعلّم — التنسيق العام (RTL) ===== */

:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1d2733;
  --muted: #64748b;
  --line: #dfe5ec;
  --brand: #0f766e;
  --brand-dark: #0b5d56;
  --brand-soft: #e6f4f1;
  --accent: #b45309;
  --danger: #b91c1c;
  --ok: #15803d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Tajawal", "Cairo", "Segoe UI", "Arial", sans-serif;
  font-size: 15px;
  line-height: 1.75;
  direction: rtl;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== الترويسة ===== */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--brand);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand img { display: block; border-radius: 9px; flex: none; }
.brand-text strong { display: block; font-weight: 800; font-size: 18px; line-height: 1.3; }
.brand-text small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
@media (max-width: 760px) { .brand-text small { display: none; } }
.nav { display: flex; gap: 6px; flex-wrap: wrap; margin-inline-start: auto; }
.nav a {
  padding: 7px 13px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
}
.nav a:hover { background: var(--brand-soft); text-decoration: none; }
.nav a.on { background: var(--brand); color: #fff; }

/* ===== التخطيط ===== */
.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }
.narrow { max-width: 620px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 4px; font-size: 19px; }
.card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }

h1 { font-size: 25px; margin: 0 0 6px; }
.page-sub { color: var(--muted); margin: 0 0 22px; }

.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

/* ===== النماذج ===== */
label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; }
.hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
textarea { min-height: 90px; resize: vertical; line-height: 1.7; }
.field { margin-bottom: 15px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: #f1f5f9; color: var(--ink); }
.btn.sm { padding: 6px 13px; font-size: 13px; font-weight: 600; }
.btn.danger { background: var(--danger); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ===== الرسائل ===== */
.msg { padding: 11px 15px; border-radius: 9px; margin-bottom: 15px; border: 1px solid; font-size: 14px; }
.msg.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.msg.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.msg.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: #eef2f7; color: var(--muted);
}
.pill.ok { background: #dcfce7; color: #166534; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.err { background: #fee2e2; color: #991b1b; }

/* ===== الجداول ===== */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td {
  padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; font-size: 14px;
}
table.list th { background: #f8fafc; font-size: 13px; color: var(--muted); font-weight: 700; }
table.list tr:hover td { background: #fafcfe; }
.table-scroll { overflow-x: auto; }

/* ===== شجرة الكتاب ===== */
.unit-box { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.unit-head { background: var(--brand-soft); padding: 11px 16px; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.lesson-row { display: flex; gap: 10px; align-items: center; padding: 9px 16px; border-top: 1px solid var(--line); }
.lesson-row input[type=text] { flex: 1; }
.lesson-row .pages { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

/* ===== شريط التقدّم ===== */
.progress { height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); transition: width .3s; }

/* ===== صفحة الهبوط ===== */
.hero { text-align: center; padding: 56px 20px 30px; }
.hero h1 { font-size: 36px; line-height: 1.4; }
.hero p { color: var(--muted); font-size: 17px; max-width: 620px; margin: 10px auto 26px; }
.steps { counter-reset: s; }
.steps li { margin-bottom: 12px; }

@media (max-width: 680px) {
  .topbar .wrap { flex-direction: column; align-items: stretch; gap: 10px; }
  .nav { margin-inline-start: 0; }
  .hero h1 { font-size: 27px; }
}
