/* ==========================================================================
   1. التنسيقات الأساسية للنظام والهيدر (/templates/)
   ========================================================================== */
body { 
    font-family: 'Cairo', sans-serif; 
    background-color: #f0f2f5; 
    overflow-x: hidden; 
    width: 100%; 
}
.hidden { display: none !important; }

/* شريط تقدم التحميل أوفلاين */
#offline-progress-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 5px;
    background: rgba(0,0,0,0.1); z-index: 9999; display: none;
}
#offline-progress-bar {
    width: 0%; height: 100%; background: #28a745; 
    box-shadow: 0 0 10px #28a745; transition: width 0.3s ease;
}

/* القائمة الجانبية */
.sidebar { 
    position: fixed; top: 0; right: 0; height: 100%; width: 288px; 
    background: white; transform: translateX(100%); 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    z-index: 2000; box-shadow: -5px 0 30px rgba(0,0,0,0.1); 
}
.sidebar.open { transform: translateX(0); }
.sidebar-overlay { 
    background-color: rgba(0,0,0,0.5); z-index: 1500; 
    position: fixed; inset: 0; display: none; backdrop-filter: blur(4px); 
}
.nav-link.active { 
    background-color: #eff6ff; color: #1d4ed8; 
    font-weight: 700; border-left: 4px solid #1d4ed8; 
}

/* زر البصمة في الهيدر */
.fingerprint-id { 
    display: flex; align-items: center; background: #fff; 
    border: 2px solid #e2e8f0; padding: 2px 12px; border-radius: 50px; 
    cursor: pointer; transition: all 0.3s ease; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); height: 40px; 
}
.fingerprint-id:hover { 
    border-color: #3b82f6; transform: translateY(-2px); 
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2); 
}
.fingerprint-id i { color: #3b82f6; font-size: 1.2rem; margin-left: 8px; }

/* النوافذ المنبثقة والحركات */
.modal-blur { 
    backdrop-filter: blur(8px); background: rgba(0,0,0,0.4); 
    display: none; position: fixed; inset: 0; z-index: 3000; 
    align-items: center; justify-content: center; 
}
@keyframes ring-bell { 
    0%, 100% { transform: rotate(0deg); } 
    10%, 30%, 50%, 70%, 90% { transform: rotate(12deg); } 
    20%, 40%, 60%, 80% { transform: rotate(-12deg); } 
}
.animate-ring { animation: ring-bell 1.5s ease-in-out infinite; transform-origin: top center; }

/* ==========================================================================
   2. تنسيقات الصفحة الرئيسية للمواد (/home/)
   ========================================================================== */
.dept-scroll { display: flex; overflow-x: auto; white-space: nowrap; gap: 8px; scrollbar-width: none; }
.dept-scroll::-webkit-scrollbar { display: none; }

/* ==========================================================================
   3. تنسيقات صفحة الزوار (/guest/)
   ========================================================================== */
.stat-slide-main { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.5s ease-in-out; pointer-events: none; }
.stat-slide-main.active { opacity: 1; pointer-events: auto; }
@keyframes gentlePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.heartbeat-num { animation: gentlePulse 2s infinite ease-in-out; }

/* ==========================================================================
   4. أي صفحة جديدة مستقبلاً -> أضف تنسيقاتها هنا في الأسفل فقط
   ========================================================================== */
   /* ==========================================================================
   4. تنسيقات صفحة تسجيل الدخول (/login/) وزر المساعدة والفيديو
   ========================================================================== */
html.login-page { visibility: hidden; opacity: 0; transition: opacity 0.3s ease; }
html.login-page.loaded { visibility: visible; opacity: 1; }

.help-btn-wrapper { position: fixed; bottom: 30px; right: 30px; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.help-btn { width: 50px; height: 50px; background: #1d3a8a; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; z-index: 10; box-shadow: 0 4px 15px rgba(29, 58, 138, 0.4); animation: float-animation 3s ease-in-out infinite; }
.help-btn span { font-size: 26px; font-weight: bold; line-height: 1; display: block; }
.pulse-ring { position: absolute; width: 100%; height: 100%; border-radius: 50%; background: rgba(29, 58, 138, 0.6); animation: pulse-ring-animation 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite; }
@keyframes float-animation { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes pulse-ring-animation { 0% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }

.video-modal { display: none; position: fixed; z-index: 99999; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.85); align-items: center; justify-content: center; }
.video-modal-content { position: relative; background-color: #000; width: 90%; max-width: 750px; border-radius: 12px; overflow: hidden; box-shadow: 0 5px 25px rgba(0,0,0,0.5); }
.close-video-btn { position: absolute; top: 10px; right: 15px; color: #fff; font-size: 28px; font-weight: bold; cursor: pointer; z-index: 10; background: rgba(0,0,0,0.6); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; line-height: 1; transition: 0.3s; }
.close-video-btn:hover { background: #e74c3c; }
.video-modal-content video { width: 100%; height: auto; display: block; }
/* ==========================================================================
   5. تنسيقات صفحة عرض المادة (/exam/) وإصلاح الآيفون
   ========================================================================== */
.fa-spin-fast { animation: fa-spin 1s infinite linear; }
.quiz-item-card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.quiz-item-card:hover { transform: translateY(-2px); }
.start-quiz-btn, .continue-quiz-btn {
    cursor: pointer !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
/* ==========================================================================
   6. تنسيقات مشغل الاختبار (/player/) وصفحة النتائج
   ========================================================================== */
   /* ==========================================================================
   6. تنسيقات مشغل الاختبار (/player/) وصفحة النتائج
   ========================================================================== */
:root {
    --background: #f0f4f8; --card: #ffffff; --text-primary: #102a43; --text-secondary: #5a6e82; 
    --border: #d9e2ec; --primary: #2563eb; --primary-hover: #1d4ed8; 
    --green: #16a34a; --red: #dc2626; --gold: #f59e0b; --gold-light: #fef9c3;
}
.exam-nav-btn { background-color: transparent; border: 1px solid var(--border); color: var(--text-secondary); padding: 0.4rem 1rem; font-size: 0.9rem; transition: all 0.2s ease; }
#prev-btn, #next-btn { padding: 0.6rem 1.5rem; }
.exam-nav-btn:hover:not(:disabled) { background-color: var(--primary-hover); border-color: var(--primary-hover); color: white; }
.exam-nav-btn.next { background-color: var(--green); border-color: var(--green); color: white; }
.exam-nav-btn.next:hover:not(:disabled) { background-color: #14833d; border-color: #14833d; }
.exam-nav-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.option-selected-feedback { border-color: var(--gold) !important; background-color: var(--gold-light) !important; }
.question-content-main-area { opacity: 0; transition: opacity 0.2s ease-in-out; }
.question-content-main-area.active { opacity: 1; }

/* القائمة المنسدلة لأرقام الأسئلة (مخفية افتراضياً وبخلفية بيضاء صلبة) */
.dropdown-container { position: relative; display: inline-block; }
.dropdown-content { 
    display: none !important; 
    position: absolute; 
    bottom: 110%; 
    left: 50%; 
    transform: translateX(-50%); 
    background-color: #ffffff !important; 
    min-width: 150px; 
    box-shadow: 0px 10px 25px rgba(0,0,0,0.18); 
    z-index: 999; 
    border-radius: 0.75rem; 
    border: 1px solid var(--border); 
    padding: 0.5rem; 
    max-height: 250px; 
    overflow-y: auto; 
}
.dropdown-container.active .dropdown-content { display: block !important; }
.dropdown-list { display: flex; flex-direction: column; gap: 0.25rem; }
.dropdown-list button { width: 100%; padding: 0.5rem 0.75rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 700; display: flex; align-items: center; justify-content: flex-start; transition: all 0.2s; }

/* تنسيقات صفحة نتيجة الاختبار */
.result-card-anim { animation: slideUp 0.5s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.tab-btn { border-bottom: 3px solid transparent; transition: all 0.3s; padding: 12px; font-weight: bold; color: #94a3b8; }
.tab-btn.active { border-bottom-color: #2563eb; color: #2563eb; font-weight: bold; background-color: #eff6ff; }
.result-option { border: 1px solid #e5e7eb; transition: all 0.2s; }
.result-option.correct { background-color: #f0fdf4; border-color: #22c55e; }
.result-option.incorrect { background-color: #fef2f2; border-color: #ef4444; }
.result-option.user-choice { box-shadow: 0 0 0 2px #3b82f6; }
.opt-number { display: none; }
.hide-on-print { display: block; }
/* ==========================================================================
   7. تنسيقات صفحة المراجعة الذكية (/review/)
   ========================================================================== */
.smart-tab { transition: all 0.3s; cursor: pointer; }
.q-card { border-right: 4px solid transparent; transition: all 0.3s ease; }
.q-card:hover { border-right-color: #8b5cf6; box-shadow: 0 4px 15px -3px rgba(139, 92, 246, 0.15); transform: translateY(-2px); }
.anim-fade-in { animation: fadeIn 0.4s ease-out forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
/* ==========================================================================
   8. تنسيقات صفحة النتائج والتحليلات (/results/)
   ========================================================================== */
.glass { 
    background: rgba(255, 255, 255, 0.78); 
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px); 
    border: 1px solid rgba(255, 255, 255, 0.6); 
}
/* ==========================================================================
   9. تنسيقات صفحة طلبات المراجعة (/communities/)
   ========================================================================== */
.accordion-content { transition: max-height 0.3s ease-out; overflow: hidden; will-change: max-height; }
.rotate-180 { transform: rotate(180deg); }
.admin-action-btn { transition: transform 0.2s; will-change: transform; }
.admin-action-btn:hover { transform: translateY(-2px); }