/* هوية FAFO Labs — منقولة عن `landing/style.css` كي يبدو الموقعان منتجاً واحداً.
   داكن فقط. الحركة المميزة: تدرّج أخضر←سماوي بزاوية 135° يُقصّ على النص
   للعناوين، ويُملأ به الزر بنصٍّ أسود. */
:root {
  --bg: #0a0a0f;
  --bg-card: rgba(15, 15, 25, .7);
  --bg-card-hover: rgba(20, 20, 35, .85);
  --border: rgba(255, 255, 255, .06);
  --border-hover: rgba(0, 255, 136, .3);
  --text: #e0e0e8;
  --text-muted: #7a7a8e;
  --accent-1: #00ff88;
  --accent-2: #00d4ff;
  --accent-3: #8b5cf6;
  --gradient: linear-gradient(135deg, #00ff88, #00d4ff);
  --gradient-bg: linear-gradient(135deg, #00ff8815, #00d4ff15);
  --radius: 16px;
  --radius-sm: 10px;
  /* لا خط من شبكة توصيل خارجية: سياسة المحتوى `script-src 'self'`، ولا سبب
     لتعليق صفحة دفع عليها طرفٌ ثالث. */
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-ar: "SF Arabic", "Noto Kufi Arabic", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}
html[lang="ar"] body { font-family: var(--font-ar); }

/* الأرقام لاتينية دائماً — 1,2,3 لا ١,٢,٣ — حتى في الواجهة العربية. */
html[lang="ar"] { font-variant-numeric: lining-nums; }
.num { font-family: var(--font); font-feature-settings: "tnum"; direction: ltr;
       unicode-bidi: isolate; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── الخلفية ─────────────────────────────────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size: 60px 60px;
}
.glow {
  position: fixed; border-radius: 50%; filter: blur(120px);
  pointer-events: none; z-index: 0; opacity: .07;
  animation: float 15s ease-in-out infinite;
}
.glow-a { width: 500px; height: 500px; background: var(--accent-1); top: -160px; inset-inline-start: -140px; }
.glow-b { width: 600px; height: 600px; background: var(--accent-2); bottom: -220px; inset-inline-end: -180px; animation-delay: -7s; }
@keyframes float { 0%,100% { transform: translate(0,0); } 50% { transform: translate(30px,-30px); } }
@media (prefers-reduced-motion: reduce) { .glow { animation: none; } }

/* ── الشريط العلوي ───────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px;
  backdrop-filter: blur(12px);
  background: rgba(10,10,15,.72);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: -.02em; color: var(--text);
         font-family: var(--font); }
.brand span { background: var(--gradient); -webkit-background-clip: text;
              background-clip: text; color: transparent; }
.brand:hover { text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 10px; }

.lang-toggle, .btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 13px; font: inherit; font-size: 13px; cursor: pointer;
}
.lang-toggle:hover, .btn-ghost:hover { color: var(--text); border-color: var(--border-hover); }

.wrap { position: relative; z-index: 1; max-width: 960px; margin: 0 auto; padding: 28px 20px 80px; }

/* ── مكوّنات ─────────────────────────────────────────────────────────── */
h1 { font-size: clamp(26px, 5vw, 38px); line-height: 1.2; margin: 0 0 10px;
     letter-spacing: -.02em; }
h1 .grad, .grad { background: var(--gradient); -webkit-background-clip: text;
                  background-clip: text; color: transparent; }
.sub { color: var(--text-muted); margin: 0 0 26px; line-height: 1.65; }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  backdrop-filter: blur(8px);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--gradient); color: #000; font-weight: 700;
  border: 0; border-radius: var(--radius-sm); padding: 13px 22px;
  font: inherit; font-weight: 700; cursor: pointer; text-align: center;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* بديلٌ ثانوي حين يوجد إجراء أساسي فوقه — تدرّجان متجاوران يتنافسان. */
.btn-alt { background: transparent; color: var(--text-muted);
           border: 1px solid var(--border); font-weight: 600; }
.btn-alt:hover { color: var(--text); border-color: var(--border-hover); filter: none; }

.pill { display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 999px;
        border: 1px solid var(--border); color: var(--text-muted); }
.pill.free { color: var(--accent-1); border-color: var(--border-hover); }
.pill.done { color: var(--accent-2); border-color: rgba(0,212,255,.3); }

/* ── تسجيل الدخول ────────────────────────────────────────────────────── */
.login-wrap { max-width: 480px; margin: 6vh auto 0; text-align: center; }
.hint { color: var(--text-muted); font-size: 13px; line-height: 1.7; }
.status-line { margin-top: 18px; min-height: 22px; font-size: 14px; color: var(--text-muted); }
.status-line.err { color: #ff6b6b; }

/* ── قائمة الدورة ────────────────────────────────────────────────────── */
.section { margin-bottom: 30px; }
.section h2 { font-size: 17px; margin: 0 0 12px; color: var(--text-muted);
              font-weight: 600; letter-spacing: .02em; }
.lesson {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 9px;
  transition: border-color .15s, background .15s;
}
.lesson:hover { background: var(--bg-card-hover); border-color: var(--border-hover);
                text-decoration: none; }
.lesson .idx { width: 26px; color: var(--text-muted); font-size: 13px; flex: none;
               font-feature-settings: "tnum"; direction: ltr; }
.lesson .body { flex: 1; min-width: 0; }
.lesson .t { color: var(--text); font-weight: 600; margin-bottom: 3px;
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson .m { font-size: 12px; color: var(--text-muted); display: flex; gap: 10px;
             align-items: center; }
.bar { height: 3px; background: rgba(255,255,255,.08); border-radius: 2px;
       margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gradient); }

/* ── مشغّل الفيديو ───────────────────────────────────────────────────── */
.vp-stage {
  position: relative; background: #000; border-radius: var(--radius);
  overflow: hidden; contain: layout paint; aspect-ratio: 16 / 9; width: 100%;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.vp-stage.fs {
  position: fixed; inset: 0; z-index: 200; border-radius: 0;
  aspect-ratio: auto; height: 100dvh; width: 100vw;
}
.vp-stage video { width: 100%; height: 100%; display: block; background: #000;
                  object-fit: contain; }

.vp-wm {
  position: absolute; inset: 0; z-index: 5; overflow: hidden;
  pointer-events: none; user-select: none; -webkit-user-select: none;
  contain: strict;
}
.vp-wm i {
  position: absolute; top: 0; inset-inline-start: 0;
  font: 600 12px/1.2 var(--font);
  color: rgba(255,255,255,.62);
  /* ظلٌّ على محورين: يبقى مقروءاً فوق شريحة بيضاء وفوق شارت داكن، بلا الحاجة
     إلى قياس إضاءة الإطار. */
  text-shadow: 0 1px 2px rgba(0,0,0,.92), 0 0 7px rgba(0,0,0,.65);
  white-space: nowrap; letter-spacing: .02em;
  /* اسم المستخدم مُدخَل من المستخدم والصفحة RTL — العزل يمنع محارف ثنائية
     الاتجاه من عكس العلامة أو إخفائها. */
  direction: ltr; unicode-bidi: isolate;
  transition: transform 1.4s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}
.vp-wm i[data-cell="b"] { opacity: .38; }

.vp-ctl {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 10;
  display: flex; flex-direction: column; gap: 6px;
  padding: 26px 14px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.82));
  transition: opacity .2s; opacity: 1;
}
.vp-stage.idle .vp-ctl { opacity: 0; pointer-events: none; }
.vp-stage.idle { cursor: none; }

/* الشريط الزمني يبقى LTR حتى في الواجهة العربية: كل مشغّل رآه أي أحد يجري من
   اليسار إلى اليمين، وعكسه يربك حتى قارئ العربية. */
.vp-time { direction: ltr; }
.vp-track { position: relative; height: 16px; display: flex; align-items: center;
            cursor: pointer; }
.vp-track .rail { position: absolute; inset-inline: 0; height: 4px;
                  background: rgba(255,255,255,.22); border-radius: 3px; }
.vp-track .buf  { position: absolute; inset-inline-start: 0; height: 4px;
                  background: rgba(255,255,255,.34); border-radius: 3px; }
.vp-track .fill { position: absolute; inset-inline-start: 0; height: 4px;
                  background: var(--gradient); border-radius: 3px; }
.vp-track .knob { position: absolute; width: 12px; height: 12px; border-radius: 50%;
                  background: #fff; transform: translateX(-50%);
                  box-shadow: 0 0 0 3px rgba(0,0,0,.35); }
.vp-track .chap { position: absolute; width: 2px; height: 10px;
                  background: rgba(255,255,255,.75); border-radius: 1px; }

.vp-row { display: flex; align-items: center; gap: 10px; }
.vp-row .spacer { flex: 1; }
.vp-btn {
  background: transparent; border: 0; color: #fff; cursor: pointer;
  padding: 7px; border-radius: 8px; line-height: 0;
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
}
.vp-btn:hover { background: rgba(255,255,255,.12); }
.vp-btn:focus-visible { outline: 2px solid var(--accent-1); outline-offset: 2px; }
.vp-btn svg { width: 20px; height: 20px; fill: currentColor; }
.vp-label { color: #fff; font-size: 12.5px; font-feature-settings: "tnum";
            direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.vp-menu { position: relative; }
.vp-menu ul {
  position: absolute; bottom: 100%; inset-inline-end: 0; margin: 0 0 8px;
  padding: 6px; list-style: none; min-width: 118px;
  background: rgba(12,12,20,.97); border: 1px solid var(--border);
  border-radius: var(--radius-sm); display: none;
}
.vp-menu.open ul { display: block; }
.vp-menu li { padding: 8px 12px; border-radius: 6px; cursor: pointer;
              font-size: 13px; color: var(--text); }
.vp-menu li:hover { background: rgba(255,255,255,.09); }
.vp-menu li[aria-selected="true"] { color: var(--accent-1); }

.vp-toast {
  position: absolute; inset-inline-start: 50%; bottom: 84px; z-index: 20;
  transform: translateX(-50%);
  background: rgba(12,12,20,.95); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 16px; font-size: 13.5px;
  display: flex; gap: 12px; align-items: center;
}
.vp-toast button { background: transparent; border: 0; color: var(--accent-1);
                   font: inherit; font-weight: 700; cursor: pointer; }

.vp-blocked {
  position: absolute; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 28px; text-align: center;
  background: rgba(6,6,10,.97); font-size: 15px; line-height: 1.7;
}
.vp-ripple {
  position: absolute; z-index: 8; width: 96px; height: 96px; border-radius: 50%;
  background: rgba(255,255,255,.14); pointer-events: none;
  transform: translate(-50%,-50%) scale(.4); opacity: 0;
}
.vp-ripple.on { animation: rip .45s ease-out; }
@keyframes rip { 0% { opacity: .9; transform: translate(-50%,-50%) scale(.4); }
                 100% { opacity: 0; transform: translate(-50%,-50%) scale(1.25); } }

.watch-head { margin: 20px 0 6px; }
.watch-desc { color: var(--text-muted); line-height: 1.75; margin: 8px 0 22px; }
.chapters { list-style: none; padding: 0; margin: 0; }
.chapters li { display: flex; gap: 12px; padding: 9px 12px; border-radius: 8px;
               cursor: pointer; align-items: center; }
.chapters li:hover { background: var(--bg-card-hover); }
.chapters .ct { color: var(--text-muted); font-size: 12.5px;
                font-feature-settings: "tnum"; direction: ltr; min-width: 46px; }

@media (max-width: 640px) {
  .wrap { padding: 18px 14px 60px; }
  .vp-ctl { padding: 22px 8px 8px; }
  .vp-label.hide-sm { display: none; }
}
