/* Site UI — العمدة | al3mdah visual identity, light (sand) theme.
   Tokens copied from F:\al3mdah-site\design-system\tokens.css ([data-theme="light"]).
   Orange guides the eye only (buttons, a single highlighted word); as text on light use --accent-text.
   The printed exam paper (exam.css) keeps the official ministry layout. */
:root {
  --bg: #ebe4d8; --surface: #f7f3ec; --surface-2: #e2d9ca; --line: #d8ccb9; --line-strong: #c4b59e;
  --text: #14213d; --muted: #5f584d;
  --accent: #ff7a1a; --accent-ink: #1a0d02; --accent-text: #a5400c; --accent-tint: rgba(255,122,26,.14); --accent-border: rgba(255,122,26,.45);
  --marker: #ff9a4d; --on-marker: #14213d; --strong: #14213d; --on-strong: #f7f3ec; --strong-accent: #ff9a4d;
  --grad-start: #ff8a2a; --grad-end: #ff4d4d;
  --good: #1e6b34; --good-tint: #dcebd9; --bad: #a3261e; --bad-tint: #f4dcd5;
  --shadow-card: 0 4px 14px rgba(70,50,25,.09);
  --radius-sm: 10px; --radius-md: 12px; --radius-lg: 14px; --radius-pill: 999px;
  --font-sans: Alexandria, "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  /* aliases used by older markup */
  --card: var(--surface); --ink: var(--text); --brand: var(--strong); --brand-ink: var(--on-strong); --brand-soft: var(--accent-tint);
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 16px; direction: rtl; line-height: 1.7 }
a { color: var(--accent-text) }
h1, h2, h3 { line-height: 1.4 }

/* top bar: navy strip with an orange underline */
header.top { background: var(--strong); color: var(--on-strong); padding: 14px 16px; border-bottom: 3px solid var(--accent) }
header.top .in { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap }
header.top h1 { margin: 0; font-size: 1.15rem; font-weight: 800 }
header.top a, header.top span { color: var(--on-strong); text-decoration: none; opacity: .9; font-weight: 500 }
main { max-width: 1100px; margin: 0 auto; padding: 24px }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow-card) }
.card h2 { margin: 0 0 14px; font-size: 1.15rem; font-weight: 800 }
.card h3 { font-size: 1rem; font-weight: 700 }
.mark { background: var(--marker); color: var(--on-marker); border-radius: var(--radius-pill); padding: 0 10px }

/* forms */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px }
label.f, div.f { display: flex; flex-direction: column; gap: 6px; font-weight: 500 }
label.f small, .f small { font-weight: 400; color: var(--muted) }
input[type=text], input[type=number], select, textarea { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); width: 100% }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent-border) }
.seg { display: flex; flex-wrap: wrap; gap: 8px }
.seg label { border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 6px 16px; cursor: pointer; background: var(--surface); user-select: none; font-weight: 500 }
.seg input { display: none }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-text); font-weight: 700 }
.seg label:has(input:disabled) { opacity: .45; cursor: not-allowed }
.units { display: grid; gap: 10px }
.unit { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 14px; background: var(--surface) }
.unit > label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer }
.unit.off { opacity: .55 }
.unit .meta { color: var(--muted); font-size: .85rem }
.unit details summary { cursor: pointer; color: var(--accent-text); font-size: .88rem; margin-top: 4px }
.lessons { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 14px; margin-top: 6px }
.lessons label { font-size: .88rem; display: flex; gap: 6px; align-items: flex-start }

/* buttons: orange = primary action */
.btn { font: inherit; font-weight: 700; border: 0; border-radius: var(--radius-md); padding: 10px 20px; cursor: pointer; background: var(--accent); color: var(--accent-ink); text-decoration: none; display: inline-block }
.btn:hover { filter: brightness(.96) }
.btn.sec { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong) }
.btn.dark { background: var(--strong); color: var(--on-strong) }
.btn:disabled { opacity: .5; cursor: wait }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center }
.note { color: var(--muted); font-size: .9rem }
.err { color: var(--bad); font-weight: 700 }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap }
.tabs button { font: inherit; font-weight: 500; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: var(--radius-pill); padding: 6px 18px; cursor: pointer }
.tabs button.on { background: var(--strong); color: var(--on-strong); border-color: var(--strong) }
.preview { overflow-x: auto; background: var(--surface-2); border-radius: var(--radius-md); padding: 14px 0 }

/* home */
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px }
.hero a.card { text-decoration: none; color: inherit; display: block; transition: transform .15s, border-color .15s }
.hero a.card:hover { transform: translateY(-2px); border-color: var(--accent-border) }
.hero .big { font-size: 1.3rem; font-weight: 800; color: var(--text) }
.hero .big em { font-style: normal; color: var(--accent-text) }
.badge { display: inline-block; background: var(--accent-tint); color: var(--accent-text); border-radius: var(--radius-pill); padding: 2px 12px; font-size: .8rem; font-weight: 700 }
.callout { border-inline-start: 4px solid var(--accent); background: var(--accent-tint); border-radius: var(--radius-sm); padding: 10px 14px }

/* student quiz */
.qcard { font-size: 1.2rem }
.qcard .qimg { max-width: 100%; height: auto; max-height: 220px; margin: 10px auto; display: block; background: #fff; border-radius: var(--radius-sm); padding: 6px }
.choices { display: grid; gap: 10px; margin-top: 12px }
.choices button { font: inherit; text-align: right; padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; color: var(--text) }
.choices button:hover:not(:disabled) { border-color: var(--accent-border) }
.choices button.right { border-color: var(--good); background: var(--good-tint) }
.choices button.wrong { border-color: var(--bad); background: var(--bad-tint) }
.feedback { margin-top: 12px; font-weight: 700 }
.feedback.good { color: var(--good) } .feedback.bad { color: var(--bad) }
.progress { height: 8px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 12px }
.progress div { height: 100%; background: var(--accent) }
.report table { width: 100%; border-collapse: collapse }
.report td, .report th { border: 1px solid var(--line); padding: 6px 8px; text-align: right }
.report th { background: var(--surface-2) }
.score { font-size: 2.1rem; font-weight: 800; color: var(--text) }
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.05; margin: 0 2px; font-size: .9em }
.frac > span:first-child { border-bottom: 2px solid currentColor; padding: 0 3px }
sup { font-size: .7em }
/* Nafis analysis in the student report */
.chartbox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px; margin: 8px 0 }
.analysis p { margin: 6px 0 }
.report .plan td { vertical-align: top; font-size: .92rem }
.plist { list-style: none; margin: 0; padding: 0 }
.plist li { position: relative; padding-inline-start: 20px; margin-bottom: 6px }
.plist li::before { content: ''; position: absolute; inset-inline-start: 0; top: .5em; width: 10px; height: 10px; background: var(--strong); border-radius: 2px; -webkit-print-color-adjust: exact; print-color-adjust: exact }
.signs { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 22px }
@media (max-width: 600px) { main { padding: 16px } .card { padding: 14px } }

@media print {
  body { background: #fff }
  body.printing > *:not(#printHost) { display: none !important }
  #printHost { display: block !important }
  .noprint { display: none !important }
  header.top { display: none }
  main { max-width: none !important; padding: 0 }
  .card { border: 0; padding: 0; box-shadow: none; background: #fff }
  .report table, .report tr, .chartbox { break-inside: avoid }
  .report h3 { break-after: avoid }
  .chartbox path, .score { -webkit-print-color-adjust: exact; print-color-adjust: exact }
}

/* ---------- page frame: big site title, content + side panel ("البرامج والمسابقات") ---------- */
.site-title { text-align: center; font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 800; margin: 26px 16px 18px; color: var(--text) }
.site-title em { font-style: normal; color: var(--accent-text) }
.layout { max-width: 1280px; margin: 0 auto 32px; padding: 0 24px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start }
.layout .col-main { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card) }
.layout .col-main > header.top { border-radius: 0 }
.layout .col-main > main { max-width: none; background: var(--bg) }
.side { position: sticky; top: 16px; border: 2px solid var(--accent-border); border-radius: var(--radius-lg); background: var(--surface-2); overflow: hidden }
.side-head { display: flex; align-items: center; gap: 8px; background: var(--strong); color: var(--on-strong); padding: 14px 16px; font-weight: 800; font-size: 1.05rem; border-bottom: 3px solid var(--accent) }
.side-card { margin: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-card) }
.side-card.on { border-color: var(--accent) }
.side-card h3 { margin: 0 0 6px; font-size: 1.2rem; font-weight: 800 }
.side-card p { margin: 0 0 12px; font-size: .92rem; color: var(--text) }
.side-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 0 12px }
  .side { position: static }           /* on phones the panel comes after the content (document order) */
}
@media print { .site-title, .side { display: none !important } .layout { display: block; padding: 0 } .layout .col-main { border: 0; box-shadow: none } }

/* ---------- results page, header links, footer, ads ---------- */
header.top .toplinks { display: flex; gap: 16px; flex-wrap: wrap }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 14px }
.tile { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 14px }
.tile span { display: block; color: var(--muted); font-size: .85rem }
.tile b { font-size: 1.6rem; font-weight: 800 }
.bigcode { font-size: 2.4rem; font-weight: 800; letter-spacing: .15em; text-align: center; background: var(--accent-tint); border: 2px dashed var(--accent-border); border-radius: var(--radius-md); padding: 10px; margin: 8px 0 14px; font-family: Consolas, monospace }
.dbar { display: grid; grid-template-columns: 150px 1fr 52px; align-items: center; gap: 10px; margin: 8px 0 }
.dlab { font-weight: 700; font-size: .92rem }
.dtrack { height: 16px; background: var(--surface-2); border-radius: 4px; overflow: hidden }
.dfill { display: block; height: 100%; background: var(--strong); border-radius: 0 4px 4px 0 }
.linkbtn { font: inherit; font-size: .85rem; background: none; border: 0; color: var(--bad); cursor: pointer; text-decoration: underline }
.ad-slot { margin: 10px 0 20px; text-align: center; min-height: 90px }
.ad-label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px }
.site-foot { max-width: 1280px; margin: 0 auto 28px; padding: 0 24px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; font-size: .9rem; color: var(--muted) }
.site-foot a { color: var(--muted) }
@media (max-width: 600px) { .dbar { grid-template-columns: 1fr 46px } .dlab { grid-column: 1 / -1 } }
@media print { .site-foot, .ad-slot { display: none !important } }
