/* فيديوهات سرد القصة — ألوان ثانوية السراج: كحلي وذهبي */
:root { --navy: #1D3461; --navy2: #2B4A82; --gold: #E3A82B; --bg: #EEF1F6; --card: #fff; --ink: #1F2733; --mut: #6B7587;
        --line: #D9DFEA; --ok: #1F8A5B; --okbg: #E5F5EC; --warn: #7A5410; --warnbg: #FFF4DC; --err: #B03A2E; --errbg: #FCE9E6; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif; font-size: 16px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.top { background: var(--navy); color: #fff; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 14px 18px; display: flex; align-items: center; gap: 14px; }
.top h1 { margin: 0; font-size: 20px; } .top small { opacity: .8; font-size: 13px; display: block; }
.top .sp { flex: 1; }
.lang { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.5); border-radius: 10px; padding: 5px 12px; font-weight: 700; }
.lang:hover { background: rgba(255,255,255,.12); }

/* صفحة الطالب */
.wrap { max-width: 520px; margin: 18px auto 40px; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 2px 10px rgba(29,52,97,.06); }
label.f { display: block; font-weight: 700; font-size: 14px; margin: 12px 0 5px; }
label.f i { color: var(--err); font-style: normal; }
.in { width: 100%; border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 12px; background: #FBFCFE; color: var(--ink); }
.in:focus { border-color: var(--navy2); background: #fff; }
.in[readonly] { color: var(--mut); background: #F3F5F9; }
.two { display: flex; gap: 10px; } .two > div { flex: 1; min-width: 0; }
.drop { margin-top: 16px; border: 2px dashed var(--navy2); border-radius: 14px; padding: 18px 12px; text-align: center; background: #F4F7FD; cursor: pointer; display: block; }
.drop b { display: block; color: var(--navy); font-size: 16px; } .drop small { color: var(--mut); font-size: 13px; }
.drop.off { opacity: .5; cursor: not-allowed; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-top: 14px; font-weight: 700; }
.file span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 14px; background: #E3E8F1; border-radius: 99px; overflow: hidden; margin: 7px 0; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--navy2), var(--gold)); transition: width .3s; }
.msg { border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.msg.warn { background: var(--warnbg); border: 1px solid #F0CF85; color: var(--warn); }
.msg.err { background: var(--errbg); border: 1px solid #EDB9B2; color: var(--err); }
.msg.ok { background: var(--okbg); border: 1px solid #9FD3B3; color: var(--ok); font-weight: 800; text-align: center; font-size: 16px; padding: 16px; }
.btn { display: block; width: 100%; margin-top: 14px; background: var(--navy); color: #fff; border: 0; border-radius: 12px; padding: 13px; font-weight: 800; font-size: 16px; }
.btn:disabled { background: #AEB8CA; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }
.note { font-size: 12.5px; color: var(--mut); margin-top: 10px; text-align: center; }
[hidden] { display: none !important; }

/* صفحة الإدارة */
.admin { max-width: 1280px; margin: 16px auto 40px; padding: 0 16px; }
.login { max-width: 380px; margin: 60px auto; }
.panel { display: flex; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; min-height: 560px; }
.tree { width: 250px; flex: 0 0 auto; border-inline-end: 1px solid var(--line); background: #FAFBFD; padding: 12px; }
.tree h3 { margin: 4px 0 8px; font-size: 15px; color: var(--navy); }
.tree .node { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; cursor: pointer; font-size: 14px; user-select: none; }
.tree .node:hover { background: #EEF2F9; }
.tree .node.on { background: #E2E9F6; font-weight: 800; color: var(--navy); }
.tree .node .c { margin-inline-start: auto; font-size: 12px; color: var(--mut); }
.tree .node .new { background: #FFF3D6; color: var(--warn); border-radius: 99px; padding: 0 7px; font-size: 12px; font-weight: 700; }
.tree .kids { padding-inline-start: 16px; }
.tree .tw { width: 16px; text-align: center; color: var(--mut); font-size: 11px; }
.tree .act { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.lnk { background: none; border: 0; color: var(--navy2); font-weight: 700; padding: 4px 8px; text-align: start; border-radius: 8px; }
.lnk:hover { background: #EEF2F9; }
.lnk.red { color: var(--err); }
.main { flex: 1; min-width: 0; padding: 14px 16px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tools .in { width: auto; padding: 8px 10px; font-size: 14px; }
.tools .q { flex: 1; min-width: 180px; }
.chip { text-decoration: none; display: inline-block; border: 1.5px solid var(--line); border-radius: 10px; padding: 7px 12px; font-size: 14px; font-weight: 700; background: #fff; color: var(--ink); }
.chip:hover { border-color: var(--navy2); }
.chip.p { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.r { color: var(--err); border-color: #E9B7B0; }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.sum { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.sum div { flex: 1; min-width: 140px; background: #F4F7FD; border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--mut); }
.sum b { display: block; color: var(--navy); font-size: 18px; }
.crumb { font-weight: 800; color: var(--navy); margin: 4px 0 0; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { text-align: start; color: var(--mut); font-weight: 700; border-bottom: 1.5px solid var(--line); padding: 8px 6px; white-space: nowrap; }
.list td { border-bottom: 1px solid #EEF1F6; padding: 8px 6px; vertical-align: middle; }
.list tr.unseen td:nth-child(3) { font-weight: 800; }
.list tr.unseen td:nth-child(3)::after { content: " •"; color: var(--gold); }
.list tr:hover td { background: #FAFBFE; }
.play { white-space: nowrap; padding: 0 12px; height: 34px; border: 0; border-radius: 7px; background: linear-gradient(135deg, var(--navy2), #5C7DB8); color: #fff; font-size: 13px; }
.bulk { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.empty { text-align: center; color: var(--mut); padding: 40px 10px; }
dialog { border: 0; border-radius: 16px; padding: 0; max-width: min(92vw, 900px); width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(15,25,45,.55); }
.dlg-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--navy); color: #fff; }
.dlg-h b { flex: 1; } .dlg-h button { background: transparent; color: #fff; border: 0; font-size: 20px; }
.dlg-b { padding: 16px; }
.dlg-b video { width: 100%; max-height: 70vh; background: #000; border-radius: 10px; }
.dlg-b .in { margin-bottom: 10px; }
.foldpick { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.foldpick div { padding: 6px 8px; border-radius: 8px; cursor: pointer; } .foldpick div:hover, .foldpick div.on { background: #E2E9F6; }
.grid-cls { display: grid; grid-template-columns: 110px 1fr; gap: 8px; align-items: center; }
.toast { position: fixed; bottom: 18px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; z-index: 9; }
[dir="rtl"] .toast { transform: translateX(50%); }
@media (max-width: 820px) {
  .panel { flex-direction: column; } .tree { width: auto; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .list th:nth-child(6), .list td:nth-child(6) { display: none; }
}
@media (prefers-reduced-motion: reduce) { .bar span { transition: none; } }
