/* ==========================================================================
   أنماط المستند المطبوع (اختبار / ورقة عمل / واجب / خطط)
   مبنية على الجداول لتبقى متوافقة مع التصدير إلى Word.
   لا تستخدم متغيرات CSS هنا لأن Word لا يدعمها.
   ========================================================================== */

.doc {
  direction: rtl;
  font-family: "Tajawal", "Traditional Arabic", Arial, sans-serif;
  color: #111827;
  font-size: 12.5pt;
  line-height: 1.75;
}

.doc .sheet {
  background: #ffffff;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 13mm 14mm 16mm;
  box-sizing: border-box;
}

.doc.landscape .sheet {
  width: 297mm;
  min-height: 210mm;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
}

.doc p {
  margin: 0;
}

/* ---------- الترويسة ---------- */

.doc .doc-head td {
  vertical-align: middle;
  font-weight: 700;
  font-size: 11pt;
  line-height: 1.7;
  padding: 0;
}

.doc .doc-head .h-right {
  width: 36%;
  text-align: right;
}

.doc .doc-head .h-center {
  width: 28%;
  text-align: center;
}

.doc .doc-head .h-left {
  width: 36%;
  text-align: left;
}

.doc .doc-head .h-left span {
  display: inline-block;
  text-align: right;
}

.doc .basmala {
  font-size: 13pt;
  font-weight: 700;
  margin-bottom: 4px;
}

.doc .school-logo {
  max-height: 64px;
  max-width: 150px;
  margin: 0 auto;
  display: block;
}

.doc .head-rule {
  border: 0;
  border-top: 2.5px solid #111827;
  margin: 10px 0 12px;
}

/* ---------- العنوان ---------- */

.doc .doc-title {
  text-align: center;
  margin: 6px 0 14px;
}

.doc .doc-title h1 {
  display: inline-block;
  margin: 0;
  padding: 4px 28px;
  font-size: 19pt;
  font-weight: 800;
  line-height: 1.5;
  border: 2px solid #111827;
  border-radius: 10px;
  background: #f3f6fb;
}

.doc .doc-title .sub {
  margin-top: 6px;
  font-size: 13pt;
  font-weight: 700;
  color: #1f2937;
}

/* ---------- جداول عامة ---------- */

.doc .grid th,
.doc .grid td {
  border: 1.2px solid #111827;
  padding: 5px 8px;
  vertical-align: middle;
  text-align: right;
}

.doc .grid th {
  background: #e8edf5;
  font-weight: 800;
  text-align: center;
}

.doc .grid td.c,
.doc .grid th.c {
  text-align: center;
}

.doc .grid .num {
  width: 34px;
  text-align: center;
  font-weight: 700;
}

.doc .info td {
  height: 34px;
}

.doc .info .lbl {
  width: 15%;
  font-weight: 800;
  background: #f6f8fb;
  white-space: nowrap;
}

.doc .block {
  margin-bottom: 14px;
}

.doc .label-row {
  font-weight: 700;
  margin: 4px 0 12px;
}

.doc .dotsfill {
  color: #6b7280;
  letter-spacing: 1px;
}

/* ---------- التعليمات والملخص ---------- */

.doc .instructions {
  border: 1.2px solid #111827;
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 14px;
  font-size: 11.5pt;
}

.doc .instructions b {
  text-decoration: underline;
}

.doc .instructions ol {
  margin: 4px 0 0;
  padding-right: 22px;
}

.doc .remember {
  border: 2px dashed #0c9486;
  border-radius: 12px;
  background: #effbf9;
  padding: 10px 16px;
  margin-bottom: 16px;
}

.doc .remember-h {
  font-weight: 800;
  color: #0c7c71;
  font-size: 13pt;
  margin-bottom: 4px;
}

.doc .remember ul {
  margin: 0;
  padding-right: 22px;
}

/* ---------- الأسئلة ---------- */

.doc .q-section {
  margin-bottom: 18px;
  page-break-inside: auto;
}

.doc .q-head {
  margin-bottom: 8px;
}

.doc .q-head td {
  vertical-align: bottom;
  padding: 0;
}

.doc .q-title {
  font-size: 13pt;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 5px;
  padding-left: 12px !important;
}

.doc .q-marks {
  width: 64px;
}

.doc .markbox td {
  border: 1.4px solid #111827;
  height: 22px;
  width: 60px;
  text-align: center;
  font-weight: 800;
  padding: 0 4px;
}

.doc .tf .ans {
  width: 70px;
  text-align: center;
  font-weight: 800;
  white-space: nowrap;
}

.doc .mcq .mcq-q td {
  background: #eef1f6;
  font-weight: 700;
}

.doc .mcq .opt td {
  width: 25%;
}

.doc .mcq .opt b {
  margin-left: 4px;
}

.doc .match .mid {
  width: 70px;
  text-align: center;
  font-weight: 800;
}

.doc .bank {
  margin-bottom: 10px;
}

.doc .bank td {
  border: 1.4px solid #111827;
  background: #f3f6fb;
  text-align: center;
  font-weight: 800;
  padding: 5px 6px;
}

.doc .fill-item {
  padding: 4px 0;
}

.doc .blank {
  color: #6b7280;
  letter-spacing: 1px;
}

.doc .terms td {
  width: 25%;
  padding: 6px;
  vertical-align: top;
}

.doc .term-card {
  border: 1.4px solid #111827;
  border-radius: 12px;
  overflow: hidden;
  text-align: center;
}

.doc .term-slot {
  padding: 10px 6px;
  border-bottom: 1.4px solid #111827;
  min-height: 24px;
}

.doc .term-def {
  padding: 8px 6px;
  font-size: 11.5pt;
}

.doc .sa-item {
  margin-bottom: 8px;
  page-break-inside: avoid;
}

.doc .sa-q {
  font-weight: 600;
}

.doc .line {
  border-bottom: 1.4px dotted #6b7280;
  height: 30px;
}

.doc .closing {
  text-align: center;
  font-weight: 800;
  font-size: 13pt;
  margin-top: 22px;
}

/* ---------- الخطط ---------- */

.doc .plan th,
.doc .plan td {
  font-size: 10.5pt;
  line-height: 1.6;
  vertical-align: top;
}

.doc .plan th {
  vertical-align: middle;
}

.doc .plan .day {
  width: 70px;
  text-align: center;
  font-weight: 800;
  vertical-align: middle;
  background: #f6f8fb;
}

.doc .cell-list {
  margin: 0;
  padding-right: 16px;
}

.doc .h2 {
  font-size: 13.5pt;
  font-weight: 800;
  margin: 16px 0 8px;
  padding-right: 10px;
  border-right: 5px solid #0c9486;
}

.doc .lead {
  margin-bottom: 10px;
  color: #1f2937;
}

.doc .bullets {
  margin: 0 0 10px;
  padding-right: 22px;
}

.doc .term-name {
  background: #e7f6f4;
  font-weight: 800;
  text-align: center;
  font-size: 12pt;
}

/* ---------- التذييل ---------- */

.doc .doc-foot {
  margin-top: 26px;
}

.doc .doc-foot td {
  font-weight: 700;
  padding: 4px 0;
  width: 33%;
}

.doc .doc-foot td.mid {
  text-align: center;
}

.doc .doc-foot td.end {
  text-align: left;
}

/* ---------- نموذج الإجابة ---------- */

.doc .key {
  display: none;
  color: #047857;
  font-weight: 800;
}

.doc.show-key .key {
  display: inline;
}

.doc.show-key .key-block {
  display: block;
}

.doc.show-key .blank-only {
  display: none;
}

.doc .key.no {
  color: #b91c1c;
}

.doc.show-key td.correct {
  background: #dcfce7;
  color: #065f46;
  font-weight: 800;
}

.doc .key-banner {
  display: none;
}

.doc.show-key .key-banner {
  display: block;
  text-align: center;
  margin: -4px auto 12px;
  width: fit-content;
  padding: 2px 18px;
  border-radius: 999px;
  background: #dcfce7;
  color: #065f46;
  font-weight: 800;
  font-size: 11pt;
}

.doc .sa-ans {
  display: none;
  color: #047857;
  font-weight: 700;
  padding: 4px 10px;
  border-right: 3px solid #10b981;
  background: #f0fdf4;
  margin-top: 4px;
}

/* ---------- الطباعة ---------- */

@page {
  size: A4;
  margin: 10mm;
}

@page landscape-page {
  size: A4 landscape;
  margin: 10mm;
}

@media print {
  .doc .sheet {
    width: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  .doc.landscape {
    page: landscape-page;
  }

  .doc .grid tr,
  .doc .term-card,
  .doc .mcq tbody {
    page-break-inside: avoid;
  }

  .doc .q-head {
    page-break-after: avoid;
  }

  .doc .doc-title h1,
  .doc .grid th,
  .doc .remember,
  .doc td.correct,
  .doc .info .lbl,
  .doc .mcq .mcq-q td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
