/* SimX Edu pages: the headset's start page, the teacher's console, the certificate.
   Colours come from tokens.css (TDSA App Standard §13.1). */
@import url('tokens.css');

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", "Noto Sans", "Noto Sans Arabic", Roboto, system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.45;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-raised); padding: 10px 16px; min-height: 44px; }
button:hover { border-color: var(--primary); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 600; }
button.primary:hover { background: var(--primary-hover); }
button.danger { color: var(--error); border-color: var(--error); }
button.ghost { background: transparent; }
button.big { font-size: 20px; padding: 14px 28px; min-height: 56px; }
input, select { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--bg); min-height: 44px; width: 100%; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
[hidden] { display: none !important; }
.ar { font-family: "Noto Sans Arabic", "Noto Naskh Arabic", "Segoe UI", sans-serif; }

/* ---------------- headset start page ---------------- */
body.headset { overflow: hidden; background: #0d1b2a; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.start { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(8, 14, 22, 0.55); overflow: auto; }
.card { width: min(560px, 100%); background: var(--surface-raised); color: var(--text); border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.card .logo { height: 40px; display: block; margin-bottom: 12px; }
.card h1 { margin: 0 0 4px; font-size: 32px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; }
.card h1 .ar { font-size: 24px; color: var(--text-muted); font-weight: 600; }
.lead { margin: 0 0 20px; color: var(--text-muted); }
.row { margin: 14px 0; }
.row label { display: block; font-weight: 600; margin-bottom: 6px; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; font-size: 20px; font-weight: 700; }
.seg button[aria-checked="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.status { padding: 10px 12px; border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.status.ok { background: var(--success-tint); color: var(--success); }
.status.warn { background: var(--warning-tint); color: var(--warning); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 8px; }
.actions .primary { flex: 1; }
.fine { font-size: 13px; color: var(--text-muted); margin: 8px 0 0; }
.preview-help { position: fixed; left: 16px; right: 16px; bottom: 12px; padding: 8px 12px; border-radius: 8px; background: rgba(8, 14, 22, 0.7); color: #dfe7ef; font-size: 13px; text-align: center; }

/* ---------------- teacher console ---------------- */
body.console { background: var(--surface); }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; height: var(--header-h); padding: 0 var(--page-margin); background: var(--surface-raised); border-bottom: 1px solid var(--border); }
.topbar img { height: 28px; }
.topbar h1 { font-size: 18px; margin: 0; flex: 1; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); margin-inline-end: 6px; }
.dot.on { background: var(--success); }
.wrap { max-width: 1400px; margin: 0 auto; padding: var(--space-6) var(--page-margin); }
.gate { max-width: 420px; margin: 12vh auto; background: var(--surface-raised); padding: 28px; border-radius: 16px; border: 1px solid var(--border); }
.gate h2 { margin-top: 0; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button[aria-selected="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.grid.lower { margin-top: 16px; }
.panel { background: var(--surface-raised); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.panel h2, .panel h3 { margin: 0 0 12px; font-size: 18px; }
.hs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hs-head b { font-size: 22px; }
.muted { color: var(--text-muted); font-size: 14px; }
.who { font-size: 18px; font-weight: 600; margin: 4px 0; }
.mode { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface); }
.mode.flying { background: var(--success-tint); color: var(--success); }
.mode.paused { background: var(--warning-tint); color: var(--warning); }
.mode.result { background: var(--info-tint); color: var(--info); }
.bar { height: 8px; background: var(--surface); border-radius: 4px; overflow: hidden; margin: 8px 0; }
.bar > i { display: block; height: 100%; background: var(--primary); width: 0; }
.tele { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; font-size: 14px; margin: 8px 0; }
.tele div { background: var(--surface); border-radius: 6px; padding: 6px 8px; }
.tele b { display: block; font-size: 17px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btns button { flex: 1 1 auto; }
.photo { width: 100%; border-radius: 8px; margin-top: 8px; display: block; }
.form { display: grid; gap: 10px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pin { font-size: 56px; font-weight: 800; letter-spacing: 12px; text-align: center; padding: 12px; border: 3px dashed var(--primary); border-radius: 12px; margin: 10px 0; color: var(--primary); }
.msg { padding: 10px 12px; border-radius: var(--radius); font-size: 14px; }
.msg.err { background: var(--error-tint); color: var(--error); }
.msg.ok { background: var(--success-tint); color: var(--success); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { width: 22px; height: 22px; min-height: 0; flex: none; margin-top: 2px; }
.student-card { background: var(--primary-tint); border-radius: 10px; padding: 12px; margin: 10px 0; }
.badges { font-size: 22px; letter-spacing: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-muted); font-weight: 600; font-size: 13px; }
td .btns { margin: 0; flex-wrap: nowrap; }
td button { min-height: 36px; padding: 6px 10px; }
.feed { display: grid; gap: 8px; max-height: 360px; overflow: auto; }
.feed div { background: var(--surface); border-radius: 8px; padding: 8px 10px; font-size: 14px; }

/* ---------------- certificate ---------------- */
body.cert { background: #e9ecf1; }
.cert-tools { text-align: center; padding: 16px; }
.sheet { width: 297mm; height: 210mm; margin: 0 auto 24px; background: #fff; color: #1d2433; position: relative; padding: 18mm 22mm; box-shadow: 0 10px 40px rgba(0,0,0,0.15); overflow: hidden; }
.sheet::before { content: ""; position: absolute; inset: 8mm; border: 3px solid #143894; border-radius: 6mm; }
.sheet::after { content: ""; position: absolute; inset: 11mm; border: 1px solid #ff7a1a; border-radius: 4mm; }
.sheet > * { position: relative; z-index: 1; }
.sheet .logo { height: 16mm; }
.sheet h1 { font-size: 30pt; margin: 8mm 0 0; color: #143894; text-align: center; }
.sheet h2 { font-size: 22pt; margin: 2mm 0 0; color: #143894; text-align: center; font-weight: 600; }
.sheet .name { font-size: 34pt; font-weight: 800; text-align: center; margin: 8mm 0 2mm; border-bottom: 2px solid #ff7a1a; display: table; margin-inline: auto; padding: 0 10mm 2mm; }
.sheet .body { text-align: center; font-size: 13pt; margin: 4mm 0; }
.sheet .missions { display: flex; justify-content: center; gap: 10mm; margin: 6mm 0; font-size: 12pt; }
.sheet .missions div { text-align: center; }
.sheet .missions b { display: block; font-size: 18pt; color: #e0a800; }
.sheet .foot { position: absolute; left: 22mm; right: 22mm; bottom: 18mm; display: flex; justify-content: space-between; align-items: flex-end; font-size: 11pt; }
.sheet .sig { border-top: 1px solid #1d2433; padding-top: 2mm; min-width: 60mm; text-align: center; }
@media print {
  @page { size: A4 landscape; margin: 0; }
  body.cert { background: #fff; }
  .cert-tools { display: none; }
  .sheet { margin: 0; box-shadow: none; }
}
@media (max-width: 640px) {
  .form .two { grid-template-columns: 1fr; }
  .card { padding: 20px; }
}
