/* =========================================================
   AmrStack — منطقة الطلاب (/learn)
   نفس الهوية: أخضر عميق + ذهبي + IBM Plex Sans Arabic
   ========================================================= */
body.learn { background: #04261D; color: var(--dark-text); min-height: 100vh; min-height: 100dvh; }
.flip { transform: scaleX(-1); }

/* ---------- حماية: منع التحديد والسحب والطباعة ---------- */
body.learn-player, body.learn-player * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.learn img { -webkit-user-drag: none; pointer-events: none; }
body.learn a img, body.learn .l-th img { pointer-events: none; }
@media print { body.learn * { display: none !important; } body.learn::after { content: "غير مسموح بالطباعة"; display: block !important; } }

/* ---------- auth (login / activate) ---------- */
.auth { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px var(--gutter); overflow: hidden; background: var(--grad-bg); }
.auth-bg { position: absolute; inset: 0; pointer-events: none; }
.auth-bg .orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.auth-bg .orb-1 { width: 420px; height: 420px; background: #0E8F6D; top: -120px; inset-inline-end: -120px; }
.auth-bg .orb-2 { width: 380px; height: 380px; background: rgba(198,161,91,.55); bottom: -140px; inset-inline-start: -120px; }
.auth-bg .grid-lines { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(circle at center, #000 30%, transparent 75%); }
.auth-card { position: relative; width: 100%; max-width: 460px; padding: 36px 28px; border-radius: var(--r-xl); background: linear-gradient(160deg, rgba(255,255,255,.12), rgba(255,255,255,.04)); border: var(--glass-border); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 30px 80px rgba(0,0,0,.35), var(--glow); text-align: center; }
.auth-logo img { height: 42px; width: auto; margin: 0 auto 18px; display: block; }
.auth-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; background: rgba(198,161,91,.16); color: var(--accent-light); border: 1px solid rgba(198,161,91,.35); }
.auth h1 { margin: 14px 0 6px; font-size: clamp(24px, 6vw, 30px); line-height: 1.35; color: #fff; }
.auth-sub { margin: 0 0 22px; color: var(--dark-muted); font-size: 15px; }
.auth-sub b { color: var(--accent-light); }
.auth-form { display: grid; gap: 14px; text-align: start; }
.auth-field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--dark-text); }
.auth-input { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 14px; border-radius: 16px; background: rgba(0,0,0,.22); border: 1.5px solid rgba(255,255,255,.14); color: var(--dark-muted); transition: border-color .2s, box-shadow .2s; }
.auth-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(198,161,91,.18); }
.auth-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; font: 500 16px var(--font-num); padding: 12px 0; -webkit-user-select: text; user-select: text; }
.auth-input input::placeholder { color: rgba(255,255,255,.35); }
.auth-eye { border: 0; background: none; color: var(--dark-muted); cursor: pointer; padding: 6px; display: grid; }
.auth-eye:hover { color: var(--accent-light); }
.auth-form .btn { margin-top: 6px; }
.auth-alert { display: flex; gap: 12px; align-items: flex-start; text-align: start; padding: 14px; margin-bottom: 18px; border-radius: 16px; background: rgba(224,99,90,.14); border: 1px solid rgba(224,99,90,.45); color: #FFD9D5; font-size: 14px; }
.auth-alert svg { flex: none; color: #F08A80; margin-top: 2px; }
.auth-alert b { display: block; font-weight: 600; line-height: 1.6; }
.auth-alert.is-blocked { background: rgba(198,161,91,.12); border-color: rgba(198,161,91,.45); color: var(--dark-text); }
.auth-alert.is-blocked svg { color: var(--accent-light); }
.auth-wa { margin-top: 10px; background: var(--wa); color: var(--wa-ink); }
.auth-wa:hover { color: var(--wa-ink); }
.auth-notes { list-style: none; margin: 20px 0 0; padding: 14px 0 0; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 8px; font-size: 13px; color: var(--dark-muted); text-align: start; }
.auth-notes li { display: flex; align-items: center; gap: 8px; }
.auth-notes svg { color: var(--accent); flex: none; }
.auth-foot { margin: 16px 0 0; font-size: 14px; color: var(--dark-muted); }
.auth-foot a { color: var(--accent-light); font-weight: 600; }
.act-ic { width: 76px; height: 76px; margin: 0 auto 6px; border-radius: 24px; display: grid; place-items: center; background: var(--grad-gold); color: var(--ink); box-shadow: 0 14px 34px rgba(198,161,91,.4); }
.act-device { margin: 0 0 18px; padding: 14px; border-radius: 16px; background: rgba(0,0,0,.22); border: 1px dashed rgba(198,161,91,.5); }
.act-device small { display: block; color: var(--dark-muted); font-size: 13px; }
.act-device b { font: 700 18px var(--font-num); color: var(--accent-light); }
.act-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 10px; text-align: start; font-size: 14px; }
.act-list li { display: flex; gap: 10px; align-items: flex-start; }
.act-list svg { flex: none; color: var(--accent); margin-top: 3px; }
.act-agree { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--dark-text); cursor: pointer; }
.act-agree input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin-top: 3px; }

/* ---------- header ---------- */
.lh { position: sticky; top: 0; z-index: 30; background: rgba(2,35,27,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid rgba(255,255,255,.08); }
.lh-in { max-width: 1480px; margin: 0 auto; height: 64px; padding: 0 var(--gutter); display: flex; align-items: center; gap: 18px; }
.lh-brand img { height: 32px; width: auto; display: block; }
.lh-course { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; }
.lh-course b { grid-column: 1 / -1; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.lh-prog { height: 6px; width: min(220px, 100%); border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; }
.lh-prog i { display: block; height: 100%; background: var(--grad-gold); border-radius: inherit; }
.lh-course small { font: 600 12px var(--font-num); color: var(--dark-muted); white-space: nowrap; }
.lh-user { display: flex; align-items: center; gap: 10px; }
.lh-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-gold); color: var(--ink); font-weight: 700; }
.lh-name { font-size: 14px; font-weight: 600; white-space: nowrap; }
.lh-admin { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: #E0635A; color: #fff; }
.lh-out { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.05); color: var(--dark-text); cursor: pointer; }
.lh-out:hover { color: var(--accent-light); border-color: var(--accent); }
@media (max-width: 720px) {
  .lh-in { gap: 10px; height: 58px; }
  .lh-course { grid-template-columns: 1fr; }
  .lh-course b, .lh-name { display: none; }
  .lh-prog { width: 100%; }
}

/* ---------- workspace ---------- */
.lw { max-width: 1480px; margin: 0 auto; padding: 20px var(--gutter) 48px; display: grid; gap: 22px; }
@media (min-width: 1024px) { .lw { grid-template-columns: 380px minmax(0, 1fr); align-items: start; } .l-side { order: -1; position: sticky; top: 84px; max-height: calc(100vh - 104px); } }
.l-main { min-width: 0; display: grid; gap: 18px; }
.l-empty { grid-column: 1 / -1; text-align: center; padding: 80px 16px; }
.l-empty h1 { color: #fff; margin: 16px 0 6px; }
.l-empty p { color: var(--dark-muted); }

/* ---------- player ---------- */
.lp { position: relative; aspect-ratio: 16 / 9; width: 100%; border-radius: 22px; overflow: hidden; background: #000; box-shadow: 0 24px 60px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.08); outline: none; isolation: isolate; }
.lp:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
/* الإطار أطول من الصندوق ومقصوص: شريط عنوان يوتيوب واللوجو بيقعوا برا المساحة الظاهرة */
.lp-stage { position: absolute; inset: 0; overflow: hidden; }
.lp-stage iframe, .lp-stage #lp-yt { position: absolute; left: 0; width: 100%; top: -60%; height: 220%; border: 0; pointer-events: none; }
.lp-shield { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
.lp-poster { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: #021a14; transition: opacity .35s; }
.lp-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.62) saturate(1.05); }
.lp-big { position: relative; width: 86px; height: 86px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--grad-gold); color: var(--ink); cursor: pointer; box-shadow: 0 0 0 10px rgba(198,161,91,.22), 0 18px 40px rgba(0,0,0,.4); transition: transform .25s var(--ease-enter); padding-inline-start: 6px; }
.lp-big:hover { transform: scale(1.07); }
.lp.is-started .lp-poster { opacity: 0; pointer-events: none; }
.lp.is-started.is-paused .lp-poster, .lp.is-ended .lp-poster { opacity: 1; pointer-events: auto; background: linear-gradient(0deg, rgba(2,26,20,.55), rgba(2,26,20,.15)); }
.lp.is-started .lp-poster img { display: none; }
.lp.is-ended .lp-poster img { display: block; }
.lp.is-ended .lp-big { display: none; }
.lp-spin { position: absolute; z-index: 5; top: 50%; left: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; border: 4px solid rgba(255,255,255,.18); border-top-color: var(--accent); animation: lpspin .8s linear infinite; display: none; }
.lp.is-loading .lp-spin { display: block; }
.lp.is-loading .lp-big { visibility: hidden; }
@keyframes lpspin { to { transform: rotate(360deg); } }
.lp-end { position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; gap: 14px; text-align: center; background: rgba(2,26,20,.82); }
.lp-end[hidden] { display: none; }
.lp-end p { margin: 0; font-size: 20px; font-weight: 700; color: #fff; }
.lp-end div { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* watermark متحرك باسم وإيميل الطالب (يمنع تسريب التسجيلات) */
.lp-wm { position: absolute; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
.lp-wm span { position: absolute; top: 6%; left: 6%; padding: 3px 10px; border-radius: 8px; font: 600 clamp(10px, 1.6vw, 14px) var(--font-num); color: rgba(255,255,255,.42); background: rgba(0,0,0,.14); text-shadow: 0 1px 2px rgba(0,0,0,.6); white-space: nowrap; }
.lp-wm.is-anim span { transition: top 1.6s var(--ease-soft), left 1.6s var(--ease-soft); }

/* controls */
.lp-bar { position: absolute; inset: auto 0 0 0; z-index: 8; padding: 28px 14px 10px; background: linear-gradient(0deg, rgba(0,0,0,.82), rgba(0,0,0,0)); transition: opacity .3s, transform .3s; }
.lp.is-started.is-playing.is-idle .lp-bar { opacity: 0; transform: translateY(8px); pointer-events: none; }
.lp.is-started.is-playing.is-idle { cursor: none; }
.lp:not(.is-started) .lp-bar { opacity: 0; pointer-events: none; }
.lp-seek { position: relative; height: 18px; display: flex; align-items: center; direction: ltr; }
.lp-seek input { -webkit-appearance: none; appearance: none; width: 100%; height: 5px; margin: 0; border-radius: 99px; outline: none; cursor: pointer; background: linear-gradient(90deg, var(--accent) 0 var(--p, 0%), rgba(255,255,255,.28) var(--p, 0%) 100%); }
.lp-seek input::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(198,161,91,.45); }
.lp-seek input::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: #fff; }
.lp-ctrls { display: flex; align-items: center; gap: 4px; direction: ltr; }
.lp-ctrls button { min-width: 42px; height: 42px; border: 0; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; background: transparent; color: #fff; cursor: pointer; font: 700 13px var(--font-num); transition: background-color .15s, color .15s; }
.lp-ctrls button:hover { background: rgba(255,255,255,.12); color: var(--accent-light); }
.lp-skip { position: relative; }
.lp-skip small { position: absolute; font-size: 8px; font-weight: 800; top: 50%; left: 50%; transform: translate(-50%, -42%); }
.lp-time { font: 600 13px var(--font-num); color: #E9ECEA; padding: 0 6px; white-space: nowrap; }
.lp-sp { flex: 1; }
.lp .i-pause, .lp.is-playing .i-play, .lp .i-mute, .lp.is-muted .i-vol, .lp .i-shr, .lp.is-fs .i-exp { display: none; }
.lp.is-playing .i-pause, .lp.is-muted .i-mute, .lp.is-fs .i-shr { display: inline-flex; }
.lp-speed { position: relative; }
.lp-speed > button { padding: 0 10px; }
.lp-menu { position: absolute; bottom: 48px; right: 0; min-width: 120px; padding: 6px; border-radius: 14px; background: rgba(10,38,32,.96); border: 1px solid rgba(255,255,255,.14); box-shadow: 0 16px 40px rgba(0,0,0,.5); display: grid; direction: rtl; }
.lp-menu[hidden] { display: none; }
.lp-menu button { justify-content: flex-start; height: 36px; padding: 0 12px; font: 600 14px var(--font); }
.lp-menu button[aria-checked="true"] { color: var(--accent-light); background: rgba(198,161,91,.14); }
.lp-toast { position: absolute; z-index: 9; top: 16px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 99px; background: rgba(0,0,0,.7); color: #fff; font: 700 14px var(--font); opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap; }
.lp-toast.is-on { opacity: 1; }
/* حماية: لما الصفحة تفقد التركيز (أداة قص الشاشة/تبديل التطبيق) المشغل يتغطى */
.lp-cover { position: absolute; inset: 0; z-index: 20; display: none; place-items: center; text-align: center; padding: 16px; background: #021a14; color: var(--dark-muted); font-weight: 600; }
body.is-shielded .lp-cover { display: grid; }

/* fullscreen (حقيقي + بديل للآيفون) */
.lp.is-fs { border-radius: 0; box-shadow: none; }
.lp:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border-radius: 0; }
.lp:-webkit-full-screen { width: 100vw; height: 100vh; border-radius: 0; }
.lp.is-pseudo-fs { position: fixed; inset: 0; z-index: 1000; width: 100vw; height: 100vh; height: 100dvh; aspect-ratio: auto; border-radius: 0; }
body.lp-lock { overflow: hidden; }
/* في ملء الشاشة نحافظ على نسبة 16:9 للفيديو داخل الشاشة */
.lp:fullscreen .lp-stage, .lp.is-pseudo-fs .lp-stage { inset: 0; margin: auto; width: min(100%, calc(100vh * 16 / 9)); height: min(100%, calc(100vw * 9 / 16)); }
.lp:fullscreen .lp-poster img, .lp.is-pseudo-fs .lp-poster img { object-fit: contain; }

@media (max-width: 640px) {
  .lp { border-radius: 16px; margin-inline: calc(var(--gutter) * -1); width: calc(100% + var(--gutter) * 2); border-radius: 0; }
  .lp-bar { padding: 22px 6px 4px; }
  .lp-ctrls button { min-width: 36px; height: 38px; }
  .lp-big { width: 68px; height: 68px; }
  .lp-vol { display: none !important; }
  .lp-time { font-size: 12px; padding: 0 2px; }
}

/* ---------- info under player ---------- */
.l-info { padding: 4px 2px; }
.l-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--accent-light); background: rgba(198,161,91,.12); border: 1px solid rgba(198,161,91,.3); padding: 3px 12px; border-radius: 99px; }
.l-info h1 { margin: 12px 0 8px; font-size: clamp(22px, 3.4vw, 30px); line-height: 1.4; color: #fff; }
.l-desc { color: var(--dark-muted); font-size: 16px; line-height: 1.9; max-width: 820px; }
.l-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.08); }
.l-prev { border: 1.5px solid rgba(255,255,255,.18); color: var(--dark-text); background: rgba(255,255,255,.04); }
.l-prev:hover { color: var(--accent-light); border-color: var(--accent); }

/* ---------- sidebar (sections accordion) ---------- */
.l-side { min-width: 0; display: flex; flex-direction: column; border-radius: 22px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09); overflow: hidden; }
.l-side-h { padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: baseline; justify-content: space-between; gap: 10px; background: rgba(0,0,0,.15); }
.l-side-h h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; color: #fff; }
.l-side-h h2 svg { color: var(--accent); }
.l-side-h small { color: var(--dark-muted); font: 600 12px var(--font); white-space: nowrap; }
.l-secs { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(198,161,91,.5) transparent; }
.l-sec { border-bottom: 1px solid rgba(255,255,255,.07); }
.l-sec summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; transition: background-color .15s; }
.l-sec summary::-webkit-details-marker { display: none; }
.l-sec summary:hover { background: rgba(255,255,255,.04); }
.l-sec-n { width: 34px; height: 34px; flex: none; border-radius: 11px; display: grid; place-items: center; font: 700 15px var(--font-num); background: rgba(198,161,91,.14); color: var(--accent-light); border: 1px solid rgba(198,161,91,.3); }
.l-sec[open] .l-sec-n { background: var(--grad-gold); color: var(--ink); border-color: transparent; }
.l-sec-t { flex: 1; min-width: 0; display: grid; line-height: 1.45; }
.l-sec-t b { font-size: 15px; color: #fff; }
.l-sec-t small { font-size: 12px; color: var(--dark-muted); }
.l-sec-c { color: var(--dark-muted); transition: transform .25s var(--ease-enter); display: grid; }
.l-sec[open] .l-sec-c { transform: rotate(180deg); color: var(--accent-light); }
.l-vids { list-style: none; margin: 0; padding: 0 10px 10px; display: grid; gap: 4px; }
.l-vid { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; color: var(--dark-text); transition: background-color .15s; }
.l-vid:hover { background: rgba(255,255,255,.06); color: #fff; }
.l-vid.is-current { background: linear-gradient(135deg, rgba(198,161,91,.22), rgba(198,161,91,.08)); box-shadow: inset 0 0 0 1px rgba(198,161,91,.45); }
.l-th { position: relative; flex: none; width: 112px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #021a14; }
.l-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.l-th small { position: absolute; bottom: 4px; left: 4px; padding: 0 5px; border-radius: 5px; font: 600 11px/1.6 var(--font-num); background: rgba(0,0,0,.75); color: #fff; }
.l-th-now { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(2,26,20,.55); color: var(--accent-light); }
.l-vt { flex: 1; min-width: 0; display: grid; line-height: 1.5; }
.l-vt small { font-size: 12px; color: var(--dark-muted); }
.l-vt b { font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.l-vs { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid rgba(255,255,255,.2); }
.l-vid.is-done .l-vs { background: var(--primary-light); border-color: var(--primary-light); color: #fff; }
.l-soon { margin: 12px; padding: 14px; border-radius: 16px; display: flex; gap: 12px; align-items: center; background: repeating-linear-gradient(135deg, rgba(198,161,91,.08) 0 12px, rgba(198,161,91,.03) 12px 24px); border: 1px dashed rgba(198,161,91,.45); }
.l-soon-ic { width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center; background: rgba(198,161,91,.18); color: var(--accent-light); }
.l-soon b { display: block; color: var(--accent-light); font-size: 16px; }
.l-soon small { color: var(--dark-muted); font-size: 13px; line-height: 1.6; display: block; }

/* ---------- security block overlay ---------- */
.sec-block { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 20px; background: rgba(2,20,15,.97); backdrop-filter: blur(20px); }
.sec-block[hidden] { display: none; }
.sec-card { max-width: 440px; text-align: center; }
.sec-ic { width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 24px; display: grid; place-items: center; background: rgba(224,99,90,.18); color: #F08A80; }
.sec-card h2 { color: #fff; font-size: 22px; margin: 0 0 8px; }
.sec-card p { color: var(--dark-muted); margin: 0 0 18px; }

/* ---------- شاشات صغيرة جداً (320px) ---------- */
.auth { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.auth-card { min-width: 0; }
.auth-chip { flex-wrap: wrap; justify-content: center; white-space: normal; text-align: center; max-width: 100%; }
@media (max-width: 380px) {
  .auth { padding: 20px 12px; }
  .auth-card { padding: 28px 16px; border-radius: 24px; }
  .auth-input { padding: 0 10px; gap: 8px; }
  .lh-in { gap: 8px; }
  .lh-brand img { height: 26px; }
}
.auth-form, .auth-field { grid-template-columns: minmax(0, 1fr); }
.auth-input input { width: 100%; }
