/* =====================================================================
   صفحة الطالب: البحث + بيان النتيجة + الطباعة (A4)
   ===================================================================== */

body.student { display: flex; flex-direction: column; background: var(--bg); }
body.student main { flex: 1 0 auto; }
body.student main:focus { outline: none; }
.wrap { width: 100%; max-width: 960px; margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- الشريط العلوي ---------- */
.topbar-public { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-public__inner { display: flex; align-items: center; gap: 0.75rem; min-height: 68px; }
.brand-logo { width: 44px; height: auto; flex: none; }
.brand-text { display: grid; line-height: 1.3; }
.brand-text strong { font-size: 1.02rem; color: var(--navy); }
.brand-text span { font-size: 0.78rem; color: var(--text-muted); direction: ltr; text-align: right; }

/* ---------- البحث ---------- */
.hero {
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(63, 114, 175, 0.35), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, #15365d 100%);
  color: #fff;
}
.hero__inner { padding-block: clamp(2.25rem, 7vw, 4rem) clamp(2.5rem, 7vw, 4.25rem); text-align: center; }
.eyebrow {
  display: inline-block; margin-bottom: 0.75rem; padding: 0.2rem 0.75rem;
  font-size: 0.8rem; font-weight: 600; color: var(--blue-100);
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 999px;
}
.hero h1 { color: #fff; margin-bottom: 0.35rem; font-size: clamp(1.7rem, 1.2rem + 2.4vw, 2.6rem); }
.hero__lead { margin: 0 auto 1.6rem; max-width: 34rem; color: #c9d6ea; }

.search {
  display: grid; gap: 0.5rem; max-width: 560px; margin: 0 auto; padding: 0.4rem;
  background: #fff; border-radius: 16px; box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.45);
}
.search__input {
  width: 100%; min-height: 54px; padding: 0 1rem; border: 0; border-radius: 12px;
  font: inherit; font-size: 1.12rem; font-weight: 500; color: var(--text); background: transparent; text-align: left;
}
.search__input::placeholder { color: #94a3b8; text-align: right; direction: rtl; font-weight: 400; }
.search__input:focus { outline: none; }
.search:focus-within { box-shadow: 0 0 0 3px rgba(219, 226, 239, 0.6), 0 20px 40px -18px rgba(0, 0, 0, 0.45); }
.search__btn { min-height: 52px; border-radius: 12px; font-size: 1rem; padding-inline: 1.4rem; }
@media (min-width: 560px) { .search { grid-template-columns: 1fr auto; } }
.search__error { margin: 0.75rem auto 0; max-width: 560px; color: #ffd4d6; font-weight: 500; }

/* ---------- منطقة النتيجة ---------- */
.result-region { padding-block: 1.5rem 3rem; }
.result-region:empty { display: none; }

.state {
  display: flex; gap: 1rem; align-items: flex-start; padding: 1.25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.state__icon { display: grid; place-items: center; flex: none; width: 2.75rem; height: 2.75rem; border-radius: 12px; background: var(--blue-50); color: var(--navy); }
.state.danger .state__icon { background: var(--danger-bg); color: var(--danger); }
.state.warning .state__icon { background: var(--warning-bg); color: var(--warning); }
.state h2 { font-size: 1.08rem; margin-bottom: 0.2rem; }
.state p { margin: 0 0 0.6rem; color: var(--text-muted); }

/* ---------- بيان النتيجة ---------- */
.transcript { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }

.transcript__head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; justify-content: space-between;
  padding: 1rem clamp(1rem, 3vw, 1.5rem); border-bottom: 1px solid var(--border);
}
.transcript__brand { display: flex; align-items: center; gap: 0.75rem; }
.transcript__brand img { width: 46px; height: auto; }
.transcript__brand strong { display: block; color: var(--navy); font-size: 1rem; }
.transcript__brand span { display: block; color: var(--text-muted); font-size: 0.84rem; }
.transcript__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.student-strip {
  display: grid; grid-template-columns: 1fr; gap: 1px; background: var(--border); border-bottom: 1px solid var(--border);
}
@media (min-width: 640px) { .student-strip { grid-template-columns: 1.4fr 1fr 1fr; } }
.student-strip > div { padding: 0.9rem clamp(1rem, 3vw, 1.5rem); background: var(--surface-2); min-width: 0; }
.student-strip dt { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.student-strip dd { margin: 0.1rem 0 0; font-size: 1.08rem; font-weight: 700; color: var(--text); }

.transcript__body { padding: clamp(1rem, 3vw, 1.5rem); }
.semester + .semester { margin-top: 1.75rem; padding-top: 1.75rem; border-top: 1px dashed var(--border-strong); }

.semester__head { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.semester__title h3 { margin: 0; font-size: 1.15rem; }
.semester__title p { margin: 0.15rem 0 0; color: var(--text-muted); font-size: 0.88rem; }

.gpa {
  display: grid; align-content: center; gap: 0.35rem; min-width: 190px; padding: 0.7rem 1rem;
  background: var(--blue-50); border: 1px solid #d5e1f0; border-radius: 14px;
}
.gpa__label { font-size: 0.78rem; font-weight: 600; color: var(--blue-600); }
.gpa__value { display: flex; align-items: baseline; gap: 0.35rem; direction: ltr; justify-content: flex-end; }
.gpa__value strong { font-size: 1.85rem; line-height: 1; color: var(--navy); font-variant-numeric: tabular-nums; }
.gpa__value span { color: var(--text-muted); font-weight: 600; }
.gpa__bar { height: 6px; background: #d7e2f1; border-radius: 999px; overflow: hidden; }
.gpa__bar i { display: block; height: 100%; background: var(--navy); border-radius: inherit; }

.grades { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.grades th, .grades td { padding: 0.75rem 1rem; text-align: start; border-bottom: 1px solid var(--border); }
.grades thead th { background: var(--surface-2); color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }
.grades tbody tr:last-child td { border-bottom: 0; }
.grades .num { width: 2.5rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.grades .grade-col { width: 1%; white-space: nowrap; text-align: center; }
.grades .module { font-weight: 600; }
.grades .held { color: var(--text-muted); font-size: 0.88rem; }

.hold-alert {
  display: flex; gap: 0.75rem; align-items: center; margin-bottom: 1rem; padding: 0.9rem 1rem;
  color: var(--danger); background: var(--danger-bg); border: 1px solid #f6cfd1; border-radius: var(--radius); font-weight: 700;
}

.grade-key { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 1.25rem; font-size: 0.8rem; color: var(--text-muted); }

.transcript__foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem;
  padding: 0.85rem clamp(1rem, 3vw, 1.5rem); font-size: 0.8rem; color: var(--text-muted);
  background: var(--surface-2); border-top: 1px solid var(--border);
}

.print-only { display: none; }

/* ---------- التذييل ---------- */
.site-footer { padding: 1.5rem 0 2rem; text-align: center; font-size: 0.86rem; color: var(--text-muted); border-top: 1px solid var(--border); background: var(--surface); }
.site-footer p { margin: 0.15rem 0; }

/* ---------- الطباعة A4 ---------- */
@media print {
  @page { size: A4; margin: 14mm 12mm 16mm; }
  html, body.student { background: #fff !important; }
  body.student { display: block; font-size: 10.5pt; color: #000; }
  .no-print, .skip-link, .transcript__actions, .toast-region, .grade-key { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .result-region { padding: 0; }
  .print-only { display: block; }

  .transcript { border: 0; box-shadow: none; border-radius: 0; }
  .transcript__head { padding: 0 0 4mm; border-bottom: 1.5pt solid #112d4e; }
  .transcript__brand img { width: 18mm; }
  .transcript__brand strong { font-size: 14pt; color: #112d4e; }
  .print-title { margin-inline-start: auto; text-align: left; }
  .print-title strong { display: block; font-size: 13pt; color: #112d4e; }
  .print-title span { font-size: 9pt; color: #444; }

  .student-strip { grid-template-columns: 1.4fr 1fr 1fr; margin: 5mm 0; background: #bbb; border: 0.75pt solid #bbb; }
  .student-strip > div { background: #fff; padding: 2.5mm 3.5mm; }
  .student-strip dd { font-size: 11pt; }

  .transcript__body { padding: 0; }
  .semester { break-inside: avoid; }
  .semester + .semester { margin-top: 6mm; padding-top: 5mm; border-top: 0.75pt dashed #999; }
  .gpa { background: #fff; border: 0.75pt solid #112d4e; min-width: 45mm; }
  .gpa__bar { background: #e5e5e5; }
  .grades { border: 0.75pt solid #999; border-radius: 0; }
  .grades th, .grades td { padding: 2mm 3mm; border-bottom: 0.5pt solid #bbb; }
  .grades thead th { background: #f1f1f1; color: #000; }
  .grade { border: 0.75pt solid #666 !important; background: #fff !important; color: #000 !important; }
  .hold-alert { background: #fff; border: 0.75pt solid #c0262d; }
  .transcript__foot { margin-top: 8mm; padding: 3mm 0 0; background: #fff; border-top: 0.75pt solid #bbb; color: #444; }
  a { color: #000; text-decoration: none; }
}

/* ---------- روابط الشريط العلوي ---------- */
.brand-link { display: flex; align-items: center; gap: 0.75rem; color: inherit; text-decoration: none; min-width: 0; }
.topnav { margin-inline-start: auto; display: flex; gap: 0.25rem; }
.topnav a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0.35rem 0.85rem;
  font-weight: 600; font-size: 0.9rem; color: var(--navy); text-decoration: none; border-radius: 10px;
}
.topnav a:hover { background: var(--blue-50); }
.topnav a.cta { color: #fff; background: var(--navy); }
.topnav a.cta:hover { background: var(--navy-900); }
@media (max-width: 420px) { .brand-text span { display: none; } .topnav a { padding-inline: 0.6rem; font-size: 0.84rem; } }

.hero__link { margin: 1rem 0 0; color: #c9d6ea; font-size: 0.92rem; }
.hero__link a { color: #fff; font-weight: 600; }

/* ---------- نموذج التسجيل ---------- */
.hero--compact .hero__inner { padding-block: clamp(1.75rem, 5vw, 2.75rem) clamp(4rem, 9vw, 5rem); }
.reg-wrap { max-width: 640px; margin-top: calc(-1 * clamp(3rem, 7vw, 3.75rem)); padding-bottom: 3rem; }
.reg-wrap > * + * { margin-top: 1rem; }
.reg-card { padding: clamp(1.25rem, 4vw, 2rem); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.reg-note { margin: 0.9rem 0 0; text-align: center; }
.reg-actions { margin: 0; }
.state.success .state__icon { background: var(--success-bg); color: var(--success); }

/* تعليق مؤقت لتصحيح البيانات */
.fix-card { display: grid; gap: 0.9rem; max-width: 560px; margin-inline: auto; padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--warning);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.fix-card__head { display: flex; gap: 0.9rem; align-items: flex-start; }
.fix-card__head .state__icon { background: var(--warning-bg); color: var(--warning); }
.fix-card h2 { font-size: 1.12rem; margin: 0 0 0.35rem; }
.fix-card > .muted { margin: 0; }
.fix-reason { margin: 0; padding: 0.6rem 0.8rem; border-radius: var(--radius); background: var(--warning-bg); color: var(--text); }
.fix-card .state { margin: 0; }
@media print { .fix-card { display: none; } }
