/* ═══════════════════════════════════════════════════════════════
 *  inline-fixes.css
 *  أدوات (utility classes) لاستبدال خصائص style="..." المضمَّنة
 *  في v20.html — تَنقُل كل التنسيقات إلى مجلد css.
 * ═══════════════════════════════════════════════════════════════ */

/* الإخفاء الأولي للعناصر التي يُتحكَّم بها لاحقاً من JS */
.is-hidden {
  display: none !important;
}

/* الحالات الأولية لشرائط التقدّم */
.fill-zero {
  width: 0%;
}

.fill-full {
  width: 100%;
}

/* ── أدوات display مستخرجة من JS (كانت .style.display = ...) ── */
.js-hidden {
  display: none !important;
}

.js-block {
  display: block !important;
}

.js-flex {
  display: flex !important;
}

.js-inline {
  display: inline !important;
}

.js-inline-flex {
  display: inline-flex !important;
}

.js-grid {
  display: grid !important;
}

/* ── أدوات opacity ── */
.js-opacity-0 {
  opacity: 0;
}

.js-opacity-55 {
  opacity: 0.55;
}

.js-opacity-1 {
  opacity: 1;
}

/* ── أدوات visibility ── */
.js-invisible {
  visibility: hidden;
}

.js-visible {
  visibility: visible;
}

/* ── UX FIX: safe-area-inset for bottom nav (iPhone notch) ── */
.mob-bottom-nav {
  padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
  height: auto !important;
  min-height: 62px;
}

/* ── Mobile overflow fix: prevent topbar-actions from pushing ☰ off-screen ── */
.topbar-actions {
  overflow: hidden;
}

@media (max-width: 480px) {
  .xp-pill,
  .streak-pill {
    display: none !important;
  }
}
/* ═══════════════════════════════════════════════════════════════
 *  [FIX] btn-submit — ضمان الظهور في المكان الصحيح بعد آخر صفحة
 * ═══════════════════════════════════════════════════════════════ */
.exam-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.exam-nav #btn-submit.btn-submit:not(.is-hidden) {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  order: 99;
  margin-inline-start: auto;
  min-width: 120px;
  font-weight: 800;
  padding: 10px 22px;
  border-width: 2px;
  box-shadow: 0 2px 12px var(--correct-glow, rgba(46, 204, 113, .35));
}

.exam-nav #btn-submit.btn-submit:not(.is-hidden):hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* ═══════════════════════════════════════════════════════════════
 *  [FIX] st-pdf-frame-wrap — حصر overlay "تعذّر العرض" داخل إطار الـ PDF
 * ═══════════════════════════════════════════════════════════════ */
.st-pdf-frame-wrap {
  position: relative;
}

/* ═══════════════════════════════════════════════════════════════
 *  [FIX] st-pdf-actions — إبقاء زر "انتقل للاختبار" ظاهراً دائماً
 *  المشكلة: overflow-y:auto على player-body يخفي شريط الزر عند
 *  التمرير داخل PDF كبير.
 *  الحل: الـ scroll ينتقل لـ pdf-frame-wrap في مرحلة PDF فقط،
 *  بينما مرحلة الاختبار تحتفظ بـ overflow-y:auto الطبيعي.
 * ═══════════════════════════════════════════════════════════════ */

/* مرحلة PDF: تملأ الـ player-body وتتحكم في overflow داخلياً */
#st-player-overlay.open #st-phase-pdf {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* الـ iframe يأخذ المساحة المتبقية والـ scroll بداخله */
#st-player-overlay.open .st-pdf-frame-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

#st-player-overlay.open .st-pdf-frame-wrap iframe {
  height: 100%;
  min-height: unset;
}

/* شريط الزر ثابت في الأسفل دائماً */
#st-player-overlay.open .st-pdf-actions {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  box-shadow: 0 -2px 12px rgba(0,0,0,.25);
}

/* player-body: overflow:hidden فقط عند عرض مرحلة PDF */
#st-player-overlay.open .st-player-body:has(#st-phase-pdf[style*="flex"]) {
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════
 *  [FIX] st-phase-quiz — توسيع صفحة الاختبار لتملأ الشاشة
 *  المشكلة: max-width:720px في 27-study-tasks.css يضيّق الاختبار
 *  ويجعله يظهر في عمود صغير في منتصف الشاشة.
 * ═══════════════════════════════════════════════════════════════ */
#st-phase-quiz {
  max-width: 860px;
}
/* ═══════════════════════════════════════════════════════════════
 * [FIX] Bug 1: إخفاء جميع الشاشات عند تفعيل صفحة المهام الدراسية
 * يمنع تسرّب #last-exam-card وغيرها من بطاقات لوحة التحكم.
 * ═══════════════════════════════════════════════════════════════ */
body.st-active #welcome-screen,
body.st-active #start-screen,
body.st-active #exam-screen,
body.st-active #results-screen {
  display: none !important;
}
body.st-active #study-tasks-section {
  display: block !important;
}

/* [FIX] Bug 2: تنسيق checkbox الخلط عند تعطيله في وضع الممارسة */
#shuffle-toggle-label.disabled {
  opacity: .5;
  pointer-events: none;
}
 
/* ══════════════════════════════════════════════════
   Bayan-footer — نسخة مضغوطة متوافقة مع المنصة
══════════════════════════════════════════════════ */

/* ══ الحاوية الرئيسية ══ */
.Bayan-footer {
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  font-family: 'Cairo', 'Segoe UI', sans-serif;
  direction: rtl;
  margin-top: auto;        /* يدفع الفوتر لأسفل المحتوى */
  /* كسر padding الـ .main (28px كل جانب) للحصول على عرض كامل */
  width: calc(100% + 56px);
  margin-left: -28px;
  margin-right: -28px;
}

/* ══ خط الأورورا ══ */
.Bayan-footer .kf-aurora {
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--accent) 20%,
    #8b5cf6 50%,
    var(--info, #3498db) 80%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: kf-aurora-anim 4s ease-in-out infinite;
}
@keyframes kf-aurora-anim {
  0%   { background-position: 100% 0; }
  50%  { background-position:   0% 0; }
  100% { background-position: 100% 0; }
}

/* ══ شبكة نقاط خلفية خفيفة ══ */
.Bayan-footer::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(201,168,76,0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: 0;
}

/* ══ الصف الرئيسي ══ */
.kf-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px 10px;
}

/* ══ معلومات المطوّر ══ */
.kf-dev {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.kf-avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(201,168,76,0.2), rgba(139,92,246,0.2));
  border: 1.5px solid rgba(201,168,76,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

.kf-dev-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.Bayan-footer .kf-dev-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  background: linear-gradient(90deg, var(--accent), #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.Bayan-footer .kf-role {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ══ هوية المنصة ══ */
.kf-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.Bayan-footer .kf-logo-text {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--accent) 0%, #c4b5fd 60%, var(--info, #38bdf8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.Bayan-footer .kf-ver-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent-glow);
  border: 1px solid rgba(201,168,76,0.3);
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* ══ التواصل ══ */
.kf-contact {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.Bayan-footer .kf-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  font-family: inherit;
  transition: transform 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.Bayan-footer .kf-btn:hover { transform: translateY(-1px); opacity: 0.85; }

.Bayan-footer .kf-btn-phone {
  background: rgba(52, 152, 219, 0.1);
  border: 1px solid rgba(52, 152, 219, 0.3);
  color: var(--info, #3498db);
  direction: ltr;
}

.Bayan-footer .kf-btn-wa {
  background: rgba(37, 211, 102, 0.08);
  border: 1px solid rgba(37, 211, 102, 0.25);
  color: #25d366;
}

/* ══ أزرار السوشيال ══ */
.Bayan-footer .kf-social {
  display: flex;
  gap: 5px;
}

.Bayan-footer .kf-social-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 1px solid var(--border-light, rgba(58,74,107,1));
  background: var(--bg-card);
  color: var(--text-muted);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.Bayan-footer .kf-social-btn:hover {
  transform: translateY(-2px);
  background: var(--accent-glow);
  border-color: rgba(201,168,76,0.4);
  color: var(--accent);
}
.Bayan-footer .kf-social-btn svg { fill: currentColor; display: block; }

/* ══ شريط الحقوق ══ */
.kf-copyright {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 6px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  font-size: 10px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.kf-copyright strong { color: var(--accent); font-weight: 700; }
.kf-sep { opacity: 0.35; }

/* ══ موبايل: الـ .main يفقد 250px للشريط الجانبي، لذا نرفع الحد ══ */
@media (max-width: 700px) {
  .Bayan-footer {
    /* .main padding: 20px 16px → تعويض 16px*2=32px */
    width: calc(100% + 32px);
    margin-left: -16px;
    margin-right: -16px;
  }
  .kf-row {
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px 8px;
    text-align: center;
  }
  .kf-dev { justify-content: center; }
  .kf-contact { justify-content: center; }
  .Bayan-footer .kf-logo-text { font-size: 20px; }
  .kf-copyright { padding: 6px 14px; font-size: 9.5px; }
}

@media (max-width: 400px) {
  .Bayan-footer {
    /* .main padding: 12px 10px → تعويض 10px*2=20px */
    width: calc(100% + 20px);
    margin-left: -10px;
    margin-right: -10px;
  }
}

/* على الشاشات الكبيرة (> 900px) → 3 أعمدة أفقية */
@media (min-width: 701px) {
  .kf-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ═══════════════════════════════════════════════════════════════
 * [FIX] Bayan-footer — نفس عرض بطاقات الداشبور
 * المشكلة: negative margins تجعله أعرض من بقية الكروت
 * الحل: إلغاء التوسيع الجبري + border-radius يطابق الكروت
 * ═══════════════════════════════════════════════════════════════ */
.Bayan-footer {
  width: 100% !important;
  margin-left:  0 !important;
  margin-right: 0 !important;
  margin-top:   28px;
  border-radius: 16px;
  overflow: hidden;          /* يحصر الـ ::before و kf-aurora */
}

/* إلغاء override المحمول (700px) */
@media (max-width: 700px) {
  .Bayan-footer {
    width: 100% !important;
    margin-left:  0 !important;
    margin-right: 0 !important;
    border-radius: 12px;
  }
}

/* إلغاء override الضيق جداً (400px) */
@media (max-width: 400px) {
  .Bayan-footer {
    width: 100% !important;
    margin-left:  0 !important;
    margin-right: 0 !important;
    border-radius: 10px;
  }
}