/* admin.css - تنسيقات خاصة بلوحة تحكم المشرف */

/* 1. شبكة الإحصائيات */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.stat-card .icon {
    font-size: 2.5rem;
    padding: 15px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
}
/* ألوان الأيقونات */
.stat-card.users .icon {
    color: #2563eb; /* أزرق */
    background-color: #eff6ff;
}
.stat-card.subjects .icon {
    color: #10b981; /* أخضر */
    background-color: #f0fdf4;
}
.stat-card.lessons .icon {
    color: #f59e0b; /* أصفر */
    background-color: #fffbeb;
}

.stat-card .info h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}
.stat-card .info p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* 2. كارت إدارة المحتوى */
.admin-card {
    background-color: var(--bg-secondary);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}
.admin-card h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}
.admin-card .form-group {
    margin-bottom: 20px;
}

/* 3. جدول المحتوى */
.content-table-wrapper {
    overflow-x: auto; /* للسماح بالتمرير على الشاشات الصغيرة */
}
.content-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.content-table th,
.content-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #e2e8f0;
}
.content-table th {
    background-color: var(--bg-primary);
    font-weight: 700;
    color: var(--text-primary);
}
.content-table td {
    color: var(--text-secondary);
}
.content-table td .icon {
    margin-left: 8px;
    font-size: 1.1rem;
    color: var(--color-primary);
}

/* 4. أزرار التحكم (تعديل/حذف) */
.action-buttons {
    display: flex;
    gap: 10px;
}
.action-btn {
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.action-btn.edit {
    background-color: #eff6ff;
    color: #2563eb;
}
.action-btn.edit:hover {
    background-color: #dbeafe;
}
.action-btn.delete {
    background-color: #fef2f2;
    color: #ef4444;
}
.action-btn.delete:hover {
    background-color: #fee2e2;
}

/* 5. الوضع الليلي */
body.dark-mode .stat-card,
body.dark-mode .admin-card {
    border-color: #334155;
}
body.dark-mode .admin-card h3 {
    border-bottom-color: #334155;
}
body.dark-mode .content-table th {
    background-color: #1e293b;
}
body.dark-mode .content-table td {
    border-bottom-color: #334155;
}
body.dark-mode .stat-card.users .icon {
    background-color: #1e3a8a;
}
body.dark-mode .stat-card.subjects .icon {
    background-color: #064e3b;
}
body.dark-mode .stat-card.lessons .icon {
    background-color: #78350f;
}

/* admin.css (إضافة تنسيقات جديدة) */

/* 6. جدول المستخدمين */
.content-table td .role-user {
    color: var(--text-secondary);
    font-weight: 500;
}
.content-table td .role-admin {
    color: var(--color-primary); /* أزرق */
    font-weight: 700;
}
.action-btn.promote {
    background-color: #f0fdf4; /* أخضر فاتح */
    color: #15803d;
}
.action-btn.promote:hover {
    background-color: #dcfce7;
}

/* 7. النافذة المنبثقة (Modal) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    position: relative;
    padding: 30px;
    /* (نستخدم نفس كلاس .admin-card) */
}

.modal-close {
    position: absolute;
    top: 10px;
    left: 20px; /* (لأننا RTL) */
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover {
    color: var(--text-primary);
}


/* admin.css (إضافة تنسيقات المحرر) */

/* 8. محرر الدروس والاختبارات */
.lesson-content-input {
    width: 100%;
    min-height: 120px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}
body.dark-mode .lesson-content-input {
    background-color: #0f172a;
    border-color: #334155;
}

.quiz-option-editor {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.quiz-option-editor input[type="radio"] {
    accent-color: var(--color-primary);
    width: 20px;
    height: 20px;
}
.quiz-option-editor input[type="text"] {
    flex: 1;
    /* (إعادة استخدام تنسيق موجود) */
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    background-color: #fff;
    color: var(--text-primary);
}
body.dark-mode .quiz-option-editor input[type="text"] {
    background-color: #1e293b;
    border-color: #475569;
}

/* admin.css (إضافة تنسيقات محرر الأيقونات) */

/* 9. محرر الأيقونات (Icon Picker) */
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    background-color: var(--bg-primary);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    max-height: 150px;
    overflow-y: auto;
}
body.dark-mode .icon-picker-grid {
    background-color: #0f172a;
    border-color: #334155;
}

.icon-option {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}
.icon-option:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}
.icon-option.selected {
    border-color: var(--color-primary);
    background-color: #eff6ff; /* أزرق فاتح */
    color: var(--color-primary);
}
body.dark-mode .icon-option.selected {
    background-color: #1e3a8a;
    border-color: #3b82f6;
}

/* admin.css (إضافة تنسيقات المعاينة) */

/* 10. تنسيق المعاينة المباشرة داخل النافذة */
#subject-card-preview {
    background-color: var(--bg-primary); /* لون خلفية مختلف */
    border: 2px dashed var(--color-primary); /* إطار متقطع */
    box-shadow: none;
    cursor: default;
    text-align: center;
}
#subject-card-preview:hover {
    transform: none; /* (إلغاء حركة الهوفر) */
    box-shadow: none;
}
#subject-card-preview p {
    color: var(--text-secondary);
}
body.dark-mode #subject-card-preview {
    background-color: var(--dark-bg-primary);
    border-color: var(--color-primary);
}

/* admin.css (إضافة تنسيقات حقول الإدخال) */

/* 11. تحسين شكل حقول الإدخال (Inputs) و (Textareas) */
.admin-card .form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.admin-card .form-group input[type="text"],
.admin-card .form-group input[type="password"],
.admin-card .form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0; /* (حدود بلون الخلفية) */
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    background-color: var(--bg-primary); /* (خلفية رمادية فاتحة) */
    color: var(--text-primary);
    transition: all var(--transition-speed);
}

.admin-card .form-group textarea {
    min-height: 80px;
    resize: vertical; /* (السماح بتغيير الحجم رأسيًا فقط) */
}

/* 12. تحسين الشكل عند الضغط (Focus) */
.admin-card .form-group input[type="text"]:focus,
.admin-card .form-group input[type="password"]:focus,
.admin-card .form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary); /* (حدود زرقاء) */
    background-color: var(--bg-secondary); /* (خلفية بيضاء نقية) */
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); /* (ظل أزرق) */
}

/* 13. دعم الوضع الليلي */
body.dark-mode .admin-card .form-group input[type="text"],
body.dark-mode .admin-card .form-group input[type="password"],
body.dark-mode .admin-card .form-group textarea {
    background-color: #0f172a; /* (خلفية كحلية داكنة) */
    border-color: #334155;
    color: var(--dark-text-primary);
}

body.dark-mode .admin-card .form-group input[type="text"]:focus,
body.dark-mode .admin-card .form-group input[type="password"]:focus,
body.dark-mode .admin-card .form-group textarea:focus {
    background-color: #1e293b; /* (خلفية كحلية أفتح) */
    border-color: var(--color-primary);
}








/* ========================================= */
/* تحسين قسم إعدادات المادة (Settings Card) */
/* ========================================= */

.settings-card {
    border-top: 4px solid var(--color-accent); /* خط ملون علوي */
    padding: 30px;
}

.settings-card h3 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* الشبكة (Grid) */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* عمودين */
    gap: 25px;
    margin-bottom: 20px;
}

/* عند الشاشات الصغيرة تصبح عمود واحد */
@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* --- تحسين حقول الإدخال والقوائم --- */

.input-wrapper,
.select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* الأيقونات داخل الحقول */
.input-icon,
.select-icon-start {
    position: absolute;
    right: 15px; /* لأننا RTL */
    color: var(--text-secondary);
    font-size: 1.1rem;
    pointer-events: none; /* للسماح بالنقر فوق الأيقونة */
    z-index: 1;
}

/* سهم القائمة المخصص */
.select-arrow {
    position: absolute;
    left: 15px; /* يسار في RTL */
    color: var(--text-secondary);
    font-size: 0.9rem;
    pointer-events: none;
    transition: transform 0.3s ease;
}

/* تنسيق الـ Input و Select */
.settings-card input[type="text"],
.settings-card select,
.settings-card textarea {
    width: 100%;
    padding: 14px 20px;
    padding-right: 45px; /* مسافة للأيقونة اليمنى */
    background-color: var(--bg-primary);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    appearance: none; /* إخفاء الشكل الافتراضي للمتصفح */
    -webkit-appearance: none;
}

/* عند التركيز (Focus) */
.settings-card input:focus,
.settings-card select:focus,
.settings-card textarea:focus {
    border-color: var(--color-primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); /* وهج أزرق خفيف */
    outline: none;
}

/* تدوير سهم القائمة عند الفتح */
.settings-card select:focus + .select-arrow {
    transform: rotate(180deg);
    color: var(--color-primary);
}

.settings-card input:focus ~ .input-icon,
.settings-card select:focus ~ .select-icon-start {
    color: var(--color-primary);
}

/* --- الوضع الليلي (Dark Mode) --- */
body.dark-mode .settings-card input[type="text"],
body.dark-mode .settings-card select,
body.dark-mode .settings-card textarea {
    background-color: var(--dark-bg-primary); /* خلفية داكنة */
    border-color: #334155;
    color: var(--dark-text-primary);
}

body.dark-mode .settings-card input:focus,
body.dark-mode .settings-card select:focus {
    background-color: #1e293b;
    border-color: var(--color-primary);
}






/* ========================================= */
/* 11. تحسين القوائم المنسدلة من الداخل (Options) */
/* ========================================= */

/* تنسيق الخيارات داخل القائمة */
select option {
    font-family: 'Cairo', sans-serif !important; /* إجبار المتصفح على استخدام خط كايرو */
    font-size: 1rem;
    padding: 15px; /* توسيع المسافة بين الخيارات (قد لا يظهر في كل المتصفحات) */
    background-color: #ffffff;
    color: var(--text-primary);
    cursor: pointer;
}

/* تحسين شكل الخيارات عند التحويم (Hover) - (يعمل في بعض المتصفحات الحديثة) */
select option:hover {
    background-color: var(--color-primary);
    color: white;
}

/* --- دعم الوضع الليلي للقائمة المنسدلة --- */
body.dark-mode select option {
    background-color: var(--dark-bg-primary); /* لون الخلفية الداكن */
    color: var(--dark-text-primary); /* لون النص الفاتح */
}

/* تخصيص إضافي لقائمة المراحل في الإعدادات */
.settings-card select option {
    font-weight: 600; /* جعل الخط سميكاً قليلاً ليكون أوضح */
    border-bottom: 1px solid #eee; /* خط فاصل خفيف (اختياري) */
}













/* تحسين شكل صندوق الـ Select بالكامل */
.settings-card .select-wrapper {
    position: relative;
    width: 100%;
}

.settings-card select {
    width: 100%;
    height: 55px;
    border-radius: 16px;
    border: 2px solid #cbd5e1;
    background-color: #ffffff;

    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    font-family: 'Cairo', sans-serif !important;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);

    padding: 0 20px;
    padding-right: 50px; 
    padding-left: 40px;

    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.settings-card select:hover {
    border-color: var(--color-primary);
    background-color: #f8fafc;
    transform: translateY(-1px);
}

.settings-card select:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* أيقونة القبعة */
.select-icon-start {
    position: absolute;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--text-secondary);
    pointer-events: none;
    transition: color 0.3s;
}

/* السهم */
.select-arrow {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    font-size: 0.9rem;
    color: var(--text-secondary);
    pointer-events: none;
    transition: transform 0.3s ease, color 0.3s;
}

.settings-card select:focus ~ .select-arrow {
    transform: translateY(-50%) rotate(180deg);
    color: var(--color-primary);
}

.settings-card select:focus ~ .select-icon-start {
    color: var(--color-primary);
}

/* الوضع الليلي */
body.dark-mode .settings-card select {
    background-color: var(--dark-bg-primary);
    border-color: #334155;
    color: var(--color-primary);
}

body.dark-mode .settings-card select:focus {
    background-color: #1e293b;
    border-color: var(--color-primary);
}

body.dark-mode .select-icon-start,
body.dark-mode .select-arrow {
    color: var(--dark-text-primary);
}




















/* ========================================= */
/* تصميم نافذة الاختبار الاحترافية (Quiz Modal Pro) */
/* ========================================= */

/* 1. الحاوية الرئيسية للمودال */
.modern-quiz-modal {
    background-color: #f8fafc; /* خلفية رمادية فاتحة جداً للتباين */
    width: 95%;
    max-width: 700px;
    border-radius: 20px; /* حواف دائرية قوية */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    max-height: 85vh; /* أقصى ارتفاع للشاشة */
    padding: 0; /* إزالة الحشوة الافتراضية للتحكم الكامل */
    border: 1px solid rgba(255,255,255,0.5);
    overflow: hidden; /* لضمان عدم خروج المحتوى عن الحواف */
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2. الرأس (Header) */
.modal-header-pro {
    background: white;
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-primary);
}

.header-title i {
    font-size: 1.4rem;
    background: #eff6ff;
    padding: 10px;
    border-radius: 12px;
}

.header-title h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
}

.close-btn-pro {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    padding: 0 10px;
}
.close-btn-pro:hover { color: #ef4444; }

/* 3. الجسم (Body - Container for Questions) */
.modal-body-pro {
    flex: 1; /* يأخذ المساحة المتبقية */
    overflow-y: auto; /* تمرير عمودي */
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px; /* مسافة بين بطاقات الأسئلة */
}

/* شريط التمرير المخصص (Scrollbar) */
.custom-scrollbar::-webkit-scrollbar { width: 8px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background-color: #94a3b8; }

/* 4. بطاقة السؤال (Question Card) - التصميم الجديد */
.question-card-pro {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 25px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.question-card-pro:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.06);
    border-color: #cbd5e1;
}

.q-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.q-number-badge {
    background: var(--color-primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

/* حقول الإدخال المحسنة */
.input-field-pro {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #f1f5f9;
    border-radius: 10px;
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    background: #f8fafc;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.input-field-pro:focus {
    background: white;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

.input-field-pro::placeholder { color: #94a3b8; }

/* خيارات الإجابة (Options Grid) */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* عمودين للخيارات */
    gap: 12px;
    margin-top: 15px;
}

@media (max-width: 600px) {
    .options-grid { grid-template-columns: 1fr; } /* عمود واحد للموبايل */
}

.option-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px;
    transition: border-color 0.2s;
}
.option-wrapper:focus-within { border-color: var(--color-primary); }

.option-radio {
    width: 18px; height: 18px;
    margin: 0 10px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.option-input {
    border: none;
    background: transparent;
    width: 100%;
    padding: 5px;
    font-family: 'Cairo', sans-serif;
    color: var(--text-primary);
}
.option-input:focus { outline: none; }


/* 5. الذيل (Footer Buttons) */
.modal-footer-pro {
    background: white;
    padding: 20px 30px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 15px;
    justify-content: flex-end; /* الأزرار لليسار */
}

.btn-pro {
    padding: 12px 24px;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary-pro {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    flex: 2; /* الزر الرئيسي يأخذ مساحة أكبر */
    justify-content: center;
}
.btn-primary-pro:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.4);
}

.btn-secondary-pro {
    background: #f1f5f9;
    color: var(--text-primary);
    flex: 1;
    justify-content: center;
    border: 1px solid #cbd5e1;
}
.btn-secondary-pro:hover { background: #e2e8f0; }

/* زر الحذف الصغير */
.delete-icon-btn {
    background: #fee2e2;
    color: #ef4444;
    border: none;
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}
.delete-icon-btn:hover { background: #fecaca; }

/* 6. أنيميشن الظهور */
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* الوضع الليلي للمودال الجديد */
body.dark-mode .modern-quiz-modal,
body.dark-mode .modal-header-pro,
body.dark-mode .modal-footer-pro,
body.dark-mode .question-card-pro,
body.dark-mode .option-wrapper {
    background-color: var(--dark-bg-secondary);
    border-color: #334155;
}
body.dark-mode .modal-body-pro { background-color: #0f172a; } /* خلفية أغمق للجسم */
body.dark-mode .input-field-pro {
    background-color: var(--dark-bg-primary);
    border-color: #334155;
    color: var(--dark-text-primary);
}
body.dark-mode .header-title i { background: #1e3a8a; }












/* ================================================= */
/* إصلاحات الوضع الليلي للمودال (High Contrast Fixes) */
/* ================================================= */

body.dark-mode .btn-secondary-pro {
    background-color: #334155; /* لون خلفية أفتح قليلاً من الأسود */
    color: #ffffff !important; /* نص أبيض ناصع إجباري */
    border: 1px solid #475569;
}

body.dark-mode .btn-secondary-pro:hover {
    background-color: #475569; /* تفتيح عند التحويم */
}

/* تحسين لون النصوص التوضيحية (Label) فوق الحقول */
body.dark-mode .question-card-pro label {
    color: #cbd5e1 !important; /* رمادي فاتح جداً بدلاً من الداكن */
}

/* تحسين حقول الإدخال في الوضع الليلي */
body.dark-mode .input-field-pro,
body.dark-mode .option-input {
    background-color: #0f172a;
    color: #ffffff;
    border-color: #334155;
}

body.dark-mode .input-field-pro:focus,
body.dark-mode .option-input:focus {
    border-color: var(--color-primary);
    background-color: #1e293b;
}

/* تحسين حاوية الخيار (Option Wrapper) */
body.dark-mode .option-wrapper {
    background-color: #1e293b;
    border-color: #334155;
}

/* تحسين زر "سؤال جديد" تحديداً */
body.dark-mode #modal-add-q-btn {
    background-color: #f0f7fd; /* خلفية فاتحة جداً (أخضر باهت) */
    color: #163865 !important; /* نص أخضر غامق */
    font-weight: 800;
}
body.dark-mode #modal-add-q-btn:hover {
    background-color: #c4e9ff;
}

/* تحسين رسالة "لا توجد أسئلة" */
body.dark-mode #modal-quiz-container p {
    color: #94a3b8;
}











/* تنسيقات إضافية للتحسين */
.text-center {
    text-align: center;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.py-12 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.text-4xl {
    font-size: 2.25rem;
}

.text-gray-300 {
    color: #d1d5db;
}

.text-gray-400 {
    color: #9ca3af;
}

.text-gray-500 {
    color: #6b7280;
}

.text-gray-600 {
    color: #4b5563;
}

.text-gray-700 {
    color: #374151;
}

.text-sm {
    font-size: 0.875rem;
}

.font-medium {
    font-weight: 500;
}

.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-top: 20px;
    border: 1px solid #e2e8f0;
}













/* admin.css - إصلاح مشاكل الوضع الليلي لقسم المستخدمين */

/* ========================================= */
/* إصلاحات قسم إدارة المستخدمين في الوضع الليلي */
/* ========================================= */

/* 14. إصلاح جدول المستخدمين في الوضع الليلي */
body.dark-mode .content-table {
    background-color: var(--dark-bg-secondary);
}

body.dark-mode .content-table th {
    background-color: #1e293b;
    color: #e2e8f0;
    border-bottom: 1px solid #334155;
}

body.dark-mode .content-table td {
    background-color: var(--dark-bg-secondary);
    color: #cbd5e1;
    border-bottom: 1px solid #334155;
}

body.dark-mode .content-table tr:hover td {
    background-color: #334155;
}

/* 15. إصلاح بطاقات الإحصائيات في الوضع الليلي */
body.dark-mode .stat-card {
    background-color: var(--dark-bg-secondary);
    border-color: #334155;
}

body.dark-mode .stat-card .info h3 {
    color: #f1f5f9;
}

body.dark-mode .stat-card .info p {
    color: #94a3b8;
}

/* 16. إصلاح بطاقات الإدارة في الوضع الليلي */
body.dark-mode .admin-card {
    background-color: var(--dark-bg-secondary);
    border-color: #334155;
}

body.dark-mode .admin-card h3 {
    color: #f1f5f9;
    border-bottom-color: #334155;
}

/* 17. إصلاح أزرار الترقية والعزل في الوضع الليلي */
body.dark-mode .action-btn.promote {
    background-color: #064e3b;
    color: #10b981;
}

body.dark-mode .action-btn.promote:hover {
    background-color: #047857;
}

body.dark-mode .action-btn.demote {
    background-color: #450a0a;
    color: #ef4444;
}

body.dark-mode .action-btn.demote:hover {
    background-color: #7f1d1d;
}

body.dark-mode .action-btn.edit {
    background-color: #1e3a8a;
    color: #60a5fa;
}

body.dark-mode .action-btn.edit:hover {
    background-color: #2563eb;
    color: white;
}

body.dark-mode .action-btn.delete {
    background-color: #7f1d1d;
    color: #fca5a5;
}

body.dark-mode .action-btn.delete:hover {
    background-color: #dc2626;
    color: white;
}

/* 18. إصلاح قوائم الاختيار (Dropdowns) في جدول المستخدمين */
body.dark-mode .role-select {
    background-color: #1e293b;
    color: #cbd5e1;
    border: 1px solid #475569;
}

body.dark-mode .role-select option {
    background-color: #1e293b;
    color: #cbd5e1;
}

/* 19. إصلاح النصوص والتوضيحات في قسم المستخدمين */
body.dark-mode .user-email {
    color: #60a5fa;
}

body.dark-mode .user-name {
    color: #f1f5f9;
}

body.dark-mode .user-grade {
    color: #94a3b8;
}

body.dark-mode .last-login {
    color: #9ca3af;
    font-size: 0.85rem;
}

/* 20. إصلاح العناوين الرئيسية في قسم المستخدمين */
body.dark-mode .section-title {
    color: #f1f5f9;
    border-bottom: 2px solid #334155;
}

/* 21. إصلاح رسائل الحالة (Success/Error) */
body.dark-mode .success-message {
    background-color: #064e3b;
    color: #10b981;
    border: 1px solid #10b981;
}

body.dark-mode .error-message {
    background-color: #7f1d1d;
    color: #fca5a5;
    border: 1px solid #ef4444;
}

/* 22. إصلاح نمط الأدوار في جدول المستخدمين */
body.dark-mode .role-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

body.dark-mode .role-badge.admin {
    background-color: #1e3a8a;
    color: #93c5fd;
}

body.dark-mode .role-badge.user {
    background-color: #374151;
    color: #d1d5db;
}

/* 23. إصلاح حقل البحث في الوضع الليلي */
body.dark-mode .search-box {
    background-color: #1e293b;
    border: 1px solid #475569;
    color: #cbd5e1;
}

body.dark-mode .search-box::placeholder {
    color: #94a3b8;
}

body.dark-mode .search-box:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 24. إصلاح ترويسة الجدول (Table Header) */
body.dark-mode .table-header {
    background-color: #0f172a;
    border-bottom: 2px solid #334155;
}

/* 25. تحسين تجربة المستخدم للروابط في الوضع الليلي */
body.dark-mode a {
    color: #60a5fa;
}

body.dark-mode a:hover {
    color: #93c5fd;
}

/* 26. إصلاح النصوص المساعدة (Help Text) */
body.dark-mode .help-text {
    color: #9ca3af;
    font-size: 0.9rem;
}

/* 27. إصلاح تنسيق التواريخ والأوقات */
body.dark-mode .timestamp {
    color: #9ca3af;
    font-family: monospace;
}

/* 28. إصلاح حالة عدم وجود بيانات */
body.dark-mode .empty-state {
    color: #94a3b8;
    background-color: #1e293b;
    border: 1px dashed #475569;
}

/* 29. إصلاح الأيقونات في جدول المستخدمين */
body.dark-mode .table-icon {
    color: #94a3b8;
}

body.dark-mode .table-icon:hover {
    color: #cbd5e1;
}

/* 30. إصلاح تنسيق الصفحات (Pagination) */
body.dark-mode .pagination {
    background-color: #1e293b;
    border: 1px solid #334155;
}

body.dark-mode .page-link {
    color: #cbd5e1;
    background-color: #1e293b;
}

body.dark-mode .page-link:hover {
    background-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .page-link.active {
    background-color: #3b82f6;
    color: white;
}

/* ========================================= */
/* تحسينات إضافية للواجهة الإدارية */
/* ========================================= */

/* تحسين عرض الجدول على الشاشات الصغيرة */
@media (max-width: 768px) {
    body.dark-mode .content-table {
        font-size: 0.9rem;
    }
    
    body.dark-mode .action-buttons {
        flex-direction: column;
        gap: 5px;
    }
    
    body.dark-mode .action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* تحسينات للرسائل المنبثقة (Toasts) */
body.dark-mode .toast {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
}

body.dark-mode .toast.success {
    border-left: 4px solid #10b981;
}

body.dark-mode .toast.error {
    border-left: 4px solid #ef4444;
}

body.dark-mode .toast.warning {
    border-left: 4px solid #f59e0b;
}

/* تحسينات للأشكال (Forms) في الوضع الليلي */
body.dark-mode .form-label {
    color: #e2e8f0;
}

body.dark-mode .form-control {
    background-color: #1e293b;
    border-color: #475569;
    color: #f1f5f9;
}

body.dark-mode .form-control:focus {
    background-color: #0f172a;
    border-color: #3b82f6;
    color: #f1f5f9;
}

/* تحسينات للبطاقات (Cards) في الوضع الليلي */
body.dark-mode .card {
    background-color: var(--dark-bg-secondary);
    border-color: #334155;
}

body.dark-mode .card-header {
    background-color: #1e293b;
    border-bottom-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .card-footer {
    background-color: #1e293b;
    border-top-color: #334155;
}

/* تحسينات للأزرار العامة */
body.dark-mode .btn {
    transition: all 0.3s ease;
}

body.dark-mode .btn-primary {
    background-color: #2563eb;
    border-color: #2563eb;
    color: white;
}

body.dark-mode .btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

body.dark-mode .btn-secondary {
    background-color: #475569;
    border-color: #475569;
    color: #e2e8f0;
}

body.dark-mode .btn-secondary:hover {
    background-color: #334155;
    border-color: #334155;
}

/* تحسينات للأيقونات داخل الأزرار */
body.dark-mode .btn i {
    opacity: 0.9;
}

body.dark-mode .btn:hover i {
    opacity: 1;
}

/* ========================================= */
/* نهاية إصلاحات الوضع الليلي */
/* ========================================= */


/* admin.css - تنسيقات خاصة بلوحة تحكم المشرف */

/* 1. شبكة الإحصائيات */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.stat-card .icon {
    font-size: 2.5rem;
    padding: 15px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
}
/* ألوان الأيقونات */
.stat-card.users .icon {
    color: #2563eb; /* أزرق */
    background-color: #eff6ff;
}
.stat-card.subjects .icon {
    color: #10b981; /* أخضر */
    background-color: #f0fdf4;
}
.stat-card.lessons .icon {
    color: #f59e0b; /* أصفر */
    background-color: #fffbeb;
}

.stat-card .info h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}
.stat-card .info p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

/* 2. كارت إدارة المحتوى */
.admin-card {
    background-color: var(--bg-secondary);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}
.admin-card h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}
.admin-card .form-group {
    margin-bottom: 20px;
}

/* 3. جدول المحتوى */
.content-table-wrapper {
    overflow-x: auto; /* للسماح بالتمرير على الشاشات الصغيرة */
}
.content-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
.content-table th,
.content-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #e2e8f0;
}
.content-table th {
    background-color: var(--bg-primary);
    font-weight: 700;
    color: var(--text-primary);
}
.content-table td {
    color: var(--text-secondary);
}
.content-table td .icon {
    margin-left: 8px;
    font-size: 1.1rem;
    color: var(--color-primary);
}

/* 4. أزرار التحكم (تعديل/حذف) */
.action-buttons {
    display: flex;
    gap: 10px;
}
.action-btn {
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.action-btn.edit {
    background-color: #eff6ff;
    color: #2563eb;
}
.action-btn.edit:hover {
    background-color: #dbeafe;
}
.action-btn.delete {
    background-color: #fef2f2;
    color: #ef4444;
}
.action-btn.delete:hover {
    background-color: #fee2e2;
}

/* 5. الوضع الليلي */
body.dark-mode .stat-card,
body.dark-mode .admin-card {
    border-color: #334155;
}
body.dark-mode .admin-card h3 {
    border-bottom-color: #334155;
}
body.dark-mode .content-table th {
    background-color: #1e293b;
}
body.dark-mode .content-table td {
    border-bottom-color: #334155;
}
body.dark-mode .stat-card.users .icon {
    background-color: #1e3a8a;
}
body.dark-mode .stat-card.subjects .icon {
    background-color: #064e3b;
}
body.dark-mode .stat-card.lessons .icon {
    background-color: #78350f;
}

/* admin.css (إضافة تنسيقات جديدة) */

/* 6. جدول المستخدمين */
.content-table td .role-user {
    color: var(--text-secondary);
    font-weight: 500;
}
.content-table td .role-admin {
    color: var(--color-primary); /* أزرق */
    font-weight: 700;
}
.action-btn.promote {
    background-color: #f0fdf4; /* أخضر فاتح */
    color: #15803d;
}
.action-btn.promote:hover {
    background-color: #dcfce7;
}

/* 7. النافذة المنبثقة (Modal) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    position: relative;
    padding: 30px;
    /* (نستخدم نفس كلاس .admin-card) */
}

.modal-close {
    position: absolute;
    top: 10px;
    left: 20px; /* (لأننا RTL) */
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover {
    color: var(--text-primary);
}


/* admin.css (إضافة تنسيقات المحرر) */

/* 8. محرر الدروس والاختبارات */
.lesson-content-input {
    width: 100%;
    min-height: 120px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}
body.dark-mode .lesson-content-input {
    background-color: #0f172a;
    border-color: #334155;
}

.quiz-option-editor {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.quiz-option-editor input[type="radio"] {
    accent-color: var(--color-primary);
    width: 20px;
    height: 20px;
}
.quiz-option-editor input[type="text"] {
    flex: 1;
    /* (إعادة استخدام تنسيق موجود) */
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    background-color: #fff;
    color: var(--text-primary);
}
body.dark-mode .quiz-option-editor input[type="text"] {
    background-color: #1e293b;
    border-color: #475569;
}

/* admin.css (إضافة تنسيقات محرر الأيقونات) */

/* 9. محرر الأيقونات (Icon Picker) */
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 10px;
    background-color: var(--bg-primary);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    max-height: 150px;
    overflow-y: auto;
}
body.dark-mode .icon-picker-grid {
    background-color: #0f172a;
    border-color: #334155;
}

.icon-option {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}
.icon-option:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}
.icon-option.selected {
    border-color: var(--color-primary);
    background-color: #eff6ff; /* أزرق فاتح */
    color: var(--color-primary);
}
body.dark-mode .icon-option.selected {
    background-color: #1e3a8a;
    border-color: #3b82f6;
}

/* admin.css (إضافة تنسيقات المعاينة) */

/* 10. تنسيق المعاينة المباشرة داخل النافذة */
#subject-card-preview {
    background-color: var(--bg-primary); /* لون خلفية مختلف */
    border: 2px dashed var(--color-primary); /* إطار متقطع */
    box-shadow: none;
    cursor: default;
    text-align: center;
}
#subject-card-preview:hover {
    transform: none; /* (إلغاء حركة الهوفر) */
    box-shadow: none;
}
#subject-card-preview p {
    color: var(--text-secondary);
}
body.dark-mode #subject-card-preview {
    background-color: var(--dark-bg-primary);
    border-color: var(--color-primary);
}

/* admin.css (إضافة تنسيقات حقول الإدخال) */

/* 11. تحسين شكل حقول الإدخال (Inputs) و (Textareas) */
.admin-card .form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.admin-card .form-group input[type="text"],
.admin-card .form-group input[type="password"],
.admin-card .form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0; /* (حدود بلون الخلفية) */
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    background-color: var(--bg-primary); /* (خلفية رمادية فاتحة) */
    color: var(--text-primary);
    transition: all var(--transition-speed);
}

.admin-card .form-group textarea {
    min-height: 80px;
    resize: vertical; /* (السماح بتغيير الحجم رأسيًا فقط) */
}

/* 12. تحسين الشكل عند الضغط (Focus) */
.admin-card .form-group input[type="text"]:focus,
.admin-card .form-group input[type="password"]:focus,
.admin-card .form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary); /* (حدود زرقاء) */
    background-color: var(--bg-secondary); /* (خلفية بيضاء نقية) */
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); /* (ظل أزرق) */
}

/* 13. دعم الوضع الليلي */
body.dark-mode .admin-card .form-group input[type="text"],
body.dark-mode .admin-card .form-group input[type="password"],
body.dark-mode .admin-card .form-group textarea {
    background-color: #0f172a; /* (خلفية كحلية داكنة) */
    border-color: #334155;
    color: var(--dark-text-primary);
}

body.dark-mode .admin-card .form-group input[type="text"]:focus,
body.dark-mode .admin-card .form-group input[type="password"]:focus,
body.dark-mode .admin-card .form-group textarea:focus {
    background-color: #1e293b; /* (خلفية كحلية أفتح) */
    border-color: var(--color-primary);
}

/* ========================================= */
/* إصلاحات قسم إدارة المستخدمين في الوضع الليلي */
/* ========================================= */

/* 14. إصلاح جدول المستخدمين في الوضع الليلي */
body.dark-mode .content-table {
    background-color: var(--dark-bg-secondary);
}

body.dark-mode .content-table th {
    background-color: #1e293b;
    color: #e2e8f0;
    border-bottom: 1px solid #334155;
}

body.dark-mode .content-table td {
    background-color: var(--dark-bg-secondary);
    color: #cbd5e1;
    border-bottom: 1px solid #334155;
}

body.dark-mode .content-table tr:hover td {
    background-color: #334155;
}

/* 15. إصلاح بطاقات الإحصائيات في الوضع الليلي */
body.dark-mode .stat-card {
    background-color: var(--dark-bg-secondary);
    border-color: #334155;
}

body.dark-mode .stat-card .info h3 {
    color: #f1f5f9;
}

body.dark-mode .stat-card .info p {
    color: #94a3b8;
}

/* 16. إصلاح بطاقات الإدارة في الوضع الليلي */
body.dark-mode .admin-card {
    background-color: var(--dark-bg-secondary);
    border-color: #334155;
}

body.dark-mode .admin-card h3 {
    color: #f1f5f9;
    border-bottom-color: #334155;
}

/* 17. إصلاح أزرار الترقية والعزل في الوضع الليلي */
body.dark-mode .action-btn.promote {
    background-color: #064e3b;
    color: #10b981;
}

body.dark-mode .action-btn.promote:hover {
    background-color: #047857;
}

body.dark-mode .action-btn.demote {
    background-color: #450a0a;
    color: #ef4444;
}

body.dark-mode .action-btn.demote:hover {
    background-color: #7f1d1d;
}

body.dark-mode .action-btn.edit {
    background-color: #1e3a8a;
    color: #60a5fa;
}

body.dark-mode .action-btn.edit:hover {
    background-color: #2563eb;
    color: white;
}

body.dark-mode .action-btn.delete {
    background-color: #7f1d1d;
    color: #fca5a5;
}

body.dark-mode .action-btn.delete:hover {
    background-color: #dc2626;
    color: white;
}

/* 18. إصلاح قوائم الاختيار (Dropdowns) في جدول المستخدمين */
body.dark-mode .role-select {
    background-color: #1e293b;
    color: #cbd5e1;
    border: 1px solid #475569;
}

body.dark-mode .role-select option {
    background-color: #1e293b;
    color: #cbd5e1;
}

/* 19. إصلاح النصوص والتوضيحات في قسم المستخدمين */
body.dark-mode .user-email {
    color: #60a5fa;
}

body.dark-mode .user-name {
    color: #f1f5f9;
}

body.dark-mode .user-grade {
    color: #94a3b8;
}

body.dark-mode .last-login {
    color: #9ca3af;
    font-size: 0.85rem;
}

/* 20. إصلاح العناوين الرئيسية في قسم المستخدمين */
body.dark-mode .section-title {
    color: #f1f5f9;
    border-bottom: 2px solid #334155;
}

/* 21. إصلاح رسائل الحالة (Success/Error) */
body.dark-mode .success-message {
    background-color: #064e3b;
    color: #10b981;
    border: 1px solid #10b981;
}

body.dark-mode .error-message {
    background-color: #7f1d1d;
    color: #fca5a5;
    border: 1px solid #ef4444;
}

/* 22. إصلاح نمط الأدوار في جدول المستخدمين */
body.dark-mode .role-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

body.dark-mode .role-badge.admin {
    background-color: #1e3a8a;
    color: #93c5fd;
}

body.dark-mode .role-badge.user {
    background-color: #374151;
    color: #d1d5db;
}

/* 23. إصلاح حقل البحث في الوضع الليلي */
body.dark-mode .search-box {
    background-color: #1e293b;
    border: 1px solid #475569;
    color: #cbd5e1;
}

body.dark-mode .search-box::placeholder {
    color: #94a3b8;
}

body.dark-mode .search-box:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 24. إصلاح ترويسة الجدول (Table Header) */
body.dark-mode .table-header {
    background-color: #0f172a;
    border-bottom: 2px solid #334155;
}

/* 25. تحسين تجربة المستخدم للروابط في الوضع الليلي */
body.dark-mode a {
    color: #60a5fa;
}

body.dark-mode a:hover {
    color: #93c5fd;
}

/* 26. إصلاح النصوص المساعدة (Help Text) */
body.dark-mode .help-text {
    color: #9ca3af;
    font-size: 0.9rem;
}

/* 27. إصلاح تنسيق التواريخ والأوقات */
body.dark-mode .timestamp {
    color: #9ca3af;
    font-family: monospace;
}

/* 28. إصلاح حالة عدم وجود بيانات */
body.dark-mode .empty-state {
    color: #94a3b8;
    background-color: #1e293b;
    border: 1px dashed #475569;
}

/* 29. إصلاح الأيقونات في جدول المستخدمين */
body.dark-mode .table-icon {
    color: #94a3b8;
}

body.dark-mode .table-icon:hover {
    color: #cbd5e1;
}

/* 30. إصلاح تنسيق الصفحات (Pagination) */
body.dark-mode .pagination {
    background-color: #1e293b;
    border: 1px solid #334155;
}

body.dark-mode .page-link {
    color: #cbd5e1;
    background-color: #1e293b;
}

body.dark-mode .page-link:hover {
    background-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .page-link.active {
    background-color: #3b82f6;
    color: white;
}

/* ========================================= */
/* تحسينات إضافية للواجهة الإدارية */
/* ========================================= */

/* تحسين عرض الجدول على الشاشات الصغيرة */
@media (max-width: 768px) {
    body.dark-mode .content-table {
        font-size: 0.9rem;
    }
    
    body.dark-mode .action-buttons {
        flex-direction: column;
        gap: 5px;
    }
    
    body.dark-mode .action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* تحسينات للرسائل المنبثقة (Toasts) */
body.dark-mode .toast {
    background-color: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
}

body.dark-mode .toast.success {
    border-left: 4px solid #10b981;
}

body.dark-mode .toast.error {
    border-left: 4px solid #ef4444;
}

body.dark-mode .toast.warning {
    border-left: 4px solid #f59e0b;
}

/* تحسينات للأشكال (Forms) في الوضع الليلي */
body.dark-mode .form-label {
    color: #e2e8f0;
}

body.dark-mode .form-control {
    background-color: #1e293b;
    border-color: #475569;
    color: #f1f5f9;
}

body.dark-mode .form-control:focus {
    background-color: #0f172a;
    border-color: #3b82f6;
    color: #f1f5f9;
}

/* تحسينات للبطاقات (Cards) في الوضع الليلي */
body.dark-mode .card {
    background-color: var(--dark-bg-secondary);
    border-color: #334155;
}

body.dark-mode .card-header {
    background-color: #1e293b;
    border-bottom-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .card-footer {
    background-color: #1e293b;
    border-top-color: #334155;
}

/* تحسينات للأزرار العامة */
body.dark-mode .btn {
    transition: all 0.3s ease;
}

body.dark-mode .btn-primary {
    background-color: #2563eb;
    border-color: #2563eb;
    color: white;
}

body.dark-mode .btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

body.dark-mode .btn-secondary {
    background-color: #475569;
    border-color: #475569;
    color: #e2e8f0;
}

body.dark-mode .btn-secondary:hover {
    background-color: #334155;
    border-color: #334155;
}

/* تحسينات للأيقونات داخل الأزرار */
body.dark-mode .btn i {
    opacity: 0.9;
}

body.dark-mode .btn:hover i {
    opacity: 1;
}

/* ========================================= */
/* نهاية إصلاحات الوضع الليلي */
/* ========================================= */






























/* ========================================= */
/* إصلاحات كروت آخر دخول/نشاط في الوضع الليلي */
/* ========================================= */

/* 31. تنسيقات كروت آخر نشاط في الوضع الفاتح */
.last-activity-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
    min-width: 180px;
}

.last-activity-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #cbd5e1;
}

/* عناصر داخل كرت النشاط */
.last-activity-card .activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.last-activity-card .activity-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.last-activity-card .activity-time {
    font-size: 12px;
    color: #94a3b8;
}

.last-activity-card .activity-status {
    background: #f1f5f9;
    color: #475569;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.last-activity-card .activity-full-date {
    font-size: 11px;
    color: #94a3b8;
    text-align: center;
    margin-top: 6px;
    direction: ltr;
    font-family: monospace;
}

/* 32. تنسيقات كروت آخر نشاط في الوضع الداكن */
body.dark-mode .last-activity-card {
    background: #1e293b;
    border: 1px solid #334155;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body.dark-mode .last-activity-card:hover {
    background: #1e293b;
    border-color: #475569;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

body.dark-mode .last-activity-card .activity-label {
    color: #cbd5e1;
}

body.dark-mode .last-activity-card .activity-time {
    color: #94a3b8;
}

body.dark-mode .last-activity-card .activity-status {
    background: #334155;
    color: #e2e8f0;
}

body.dark-mode .last-activity-card .activity-full-date {
    color: #64748b;
}

/* 33. تنسيقات محددة للحالات المختلفة */
/* حالة "الآن" (أخضر) */
.last-activity-card.status-online .activity-status {
    background: #d1fae5;
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
body.dark-mode .last-activity-card.status-online .activity-status {
    background: #064e3b;
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* حالة "قبل دقائق" (أزرق) */
.last-activity-card.status-recent .activity-status {
    background: #dbeafe;
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}
body.dark-mode .last-activity-card.status-recent .activity-status {
    background: #1e3a8a;
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* حالة "اليوم" (بنفسجي) */
.last-activity-card.status-today .activity-status {
    background: #ede9fe;
    color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.2);
}
body.dark-mode .last-activity-card.status-today .activity-status {
    background: #2e1b5b;
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* حالة "هذا الأسبوع" (أصفر) */
.last-activity-card.status-week .activity-status {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}
body.dark-mode .last-activity-card.status-week .activity-status {
    background: #78350f;
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* حالة "قديم" (رمادي) */
.last-activity-card.status-old .activity-status {
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid rgba(107, 114, 128, 0.2);
}
body.dark-mode .last-activity-card.status-old .activity-status {
    background: #374151;
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

/* حالة "غير معروف" (رمادي فاتح) */
.last-activity-card.status-unknown .activity-status {
    background: #f8fafc;
    color: #64748b;
    border: 1px dashed #cbd5e1;
}
body.dark-mode .last-activity-card.status-unknown .activity-status {
    background: #1e293b;
    color: #94a3b8;
    border: 1px dashed #475569;
}

/* 34. إصلاحات للصفوف في جدول المستخدمين في الوضع الداكن */
body.dark-mode .content-table tr {
    background-color: var(--dark-bg-secondary);
}

body.dark-mode .content-table tr:hover {
    background-color: #334155;
}

/* 35. إصلاحات للنصوص داخل خلايا جدول المستخدمين */
body.dark-mode .content-table td .user-name {
    color: #f1f5f9;
}

body.dark-mode .content-table td .user-email {
    color: #94a3b8;
}

body.dark-mode .content-table td .user-grade {
    color: #60a5fa;
    background: #1e3a8a;
    border: 1px solid #2563eb;
}

body.dark-mode .content-table td .user-role {
    color: #cbd5e1;
}

/* 36. إصلاحات لتنسيقات الصفوف عند التحويم */
body.dark-mode .content-table tr:hover .last-activity-card {
    border-color: #475569;
    background: #0f172a;
}

/* 37. تحسينات للاستجابة على الشاشات الصغيرة */
@media (max-width: 768px) {
    .last-activity-card {
        min-width: 100%;
        margin-top: 10px;
    }
    
    body.dark-mode .last-activity-card {
        background: #1e293b;
    }
}

/* 38. تنسيقات إضافية لتحسين التباين */
body.dark-mode .last-activity-card .activity-icon {
    opacity: 0.9;
}

body.dark-mode .last-activity-card:hover .activity-icon {
    opacity: 1;
}

/* 39. إصلاح تدرجات الألوان للوضع الداكن */
body.dark-mode .last-activity-card .activity-status {
    background: linear-gradient(135deg, #334155, #475569);
}

/* 40. إصلاح حدود الأيقونات في الوضع الداكن */
body.dark-mode .activity-icon {
    border: 1px solid rgba(255, 255, 255, 0.1);
}
