/* ================================================
   نظام إدارة القدرات والتحصيل
   Dark Mode / Light Mode - Complete Theme System
   ================================================ */

/* ── تهيئة الانتقال السلس ── */
*, *::before, *::after {
    transition: background-color 0.3s ease, color 0.2s ease,
                border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ================================================
   زر التبديل - Theme Toggle Button
   ================================================ */
.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.3s ease !important;
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.theme-toggle-btn .theme-icon {
    font-size: 16px;
    line-height: 1;
}

.theme-toggle-btn .theme-label {
    font-size: 12px;
}

/* إخفاء الاسم على الشاشات الصغيرة */
@media (max-width: 576px) {
    .theme-toggle-btn .theme-label { display: none; }
}

/* ================================================
   وضع الظلام - DARK MODE
   ================================================ */

[data-theme="dark"] {
    color-scheme: dark;

    /* ── متغيرات عامة ── */
    --primary-color:   #5b9bd5;
    --secondary-color: #9d7de8;
    --success-color:   #4caf80;
    --danger-color:    #f87171;
    --warning-color:   #fbbf24;
    --info-color:      #38bdf8;
    --light-bg:        #1e293b;
    --border-color:    #334155;
    --dark-text:       #e2e8f0;
    --card-bg:         #1e293b;
    --body-bg:         #0f172a;
    --sidebar-bg:      #1e293b;
    --input-bg:        #0f172a;
    --muted-text:      #94a3b8;
    --hover-bg:        #253347;
    --shadow-color:    rgba(0, 0, 0, 0.4);
}

/* ── الجسم ── */
[data-theme="dark"] body {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
}

/* ── شريط التنقل - Navbar ── */
[data-theme="dark"] .navbar,
[data-theme="dark"] .navbar-custom {
    background: linear-gradient(135deg, #1a3a5c 0%, #2d1b69 100%) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5) !important;
}

/* ── الشريط الجانبي - Sidebar ── */
[data-theme="dark"] .sidebar {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .sidebar h5 {
    color: #5b9bd5 !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .sidebar-menu a,
[data-theme="dark"] .sidebar-item a {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .sidebar-menu a:hover,
[data-theme="dark"] .sidebar-menu a.active,
[data-theme="dark"] .sidebar-item a:hover {
    background-color: #253347 !important;
    color: #5b9bd5 !important;
    border-right-color: #5b9bd5 !important;
}

[data-theme="dark"] .sidebar-item {
    border-color: #334155 !important;
}

[data-theme="dark"] .menu-section {
    color: #64748b !important;
}

/* ── البطاقات - Cards ── */
[data-theme="dark"] .card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .sidebar.card,
[data-theme="dark"] .page-header,
[data-theme="dark"] .table-custom,
[data-theme="dark"] .footer-custom {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .card-body {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .card-footer {
    background-color: #162032 !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

[data-theme="dark"] .card-header {
    background-color: #1a3a5c !important;
    border-color: #334155 !important;
}

/* ── الجداول - Tables ── */
[data-theme="dark"] .table,
[data-theme="dark"] table {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .table thead,
[data-theme="dark"] .table-custom thead {
    background: linear-gradient(135deg, #1a3a5c 0%, #2d1b69 100%) !important;
    color: white !important;
}

[data-theme="dark"] .table thead th {
    border-color: #334155 !important;
    color: white !important;
}

[data-theme="dark"] .table tbody td {
    border-color: #334155 !important;
    color: #e2e8f0 !important;
    background-color: #1e293b !important;
}

[data-theme="dark"] .table tbody tr:hover td,
[data-theme="dark"] .table-custom tbody tr:hover {
    background-color: #253347 !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) td {
    background-color: #1a2535 !important;
}

[data-theme="dark"] .table-bordered {
    border-color: #334155 !important;
}

/* ── النماذج - Forms ── */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    background-color: #0f172a !important;
    border-color: #5b9bd5 !important;
    color: #e2e8f0 !important;
    box-shadow: 0 0 0 0.25rem rgba(91, 155, 213, 0.25) !important;
}

[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #64748b !important;
}

[data-theme="dark"] .form-label,
[data-theme="dark"] label {
    color: #94a3b8 !important;
}

[data-theme="dark"] .input-group-text {
    background-color: #253347 !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

/* ── التنبيهات - Alerts ── */
[data-theme="dark"] .alert-success {
    background-color: #14532d !important;
    color: #86efac !important;
    border-color: #166534 !important;
}

[data-theme="dark"] .alert-danger {
    background-color: #450a0a !important;
    color: #fca5a5 !important;
    border-color: #7f1d1d !important;
}

[data-theme="dark"] .alert-warning {
    background-color: #451a03 !important;
    color: #fcd34d !important;
    border-color: #78350f !important;
}

[data-theme="dark"] .alert-info,
[data-theme="dark"] .alert-info-custom {
    background-color: #0c2341 !important;
    color: #7dd3fc !important;
    border-color: #1e4d7a !important;
    border-right-color: #38bdf8 !important;
}

/* ── الأزرار ── */
[data-theme="dark"] .btn-light,
[data-theme="dark"] .btn-outline-secondary {
    background-color: #253347 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .btn-light:hover,
[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: #334155 !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .btn-outline-primary {
    border-color: #5b9bd5 !important;
    color: #5b9bd5 !important;
}

[data-theme="dark"] .btn-outline-primary:hover {
    background-color: #5b9bd5 !important;
    color: white !important;
}

[data-theme="dark"] .btn-outline-danger {
    border-color: #f87171 !important;
    color: #f87171 !important;
}

[data-theme="dark"] .btn-outline-danger:hover {
    background-color: #f87171 !important;
    color: white !important;
}

/* ── القوائم المنسدلة - Dropdowns ── */
[data-theme="dark"] .dropdown-menu {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .dropdown-item {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: #253347 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .dropdown-divider {
    border-color: #334155 !important;
}

/* ── المودالات - Modals ── */
[data-theme="dark"] .modal-content {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .modal-header {
    background-color: #162032 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .modal-body {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .modal-footer {
    background-color: #162032 !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .modal-title {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%) !important;
}

[data-theme="dark"] .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

/* ── التبويبات - Tabs ── */
[data-theme="dark"] .nav-tabs {
    border-color: #334155 !important;
}

[data-theme="dark"] .nav-tabs .nav-link {
    color: #94a3b8 !important;
    border-color: transparent !important;
}

[data-theme="dark"] .nav-tabs .nav-link:hover {
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #1e293b !important;
    border-color: #334155 #334155 #1e293b !important;
    color: #5b9bd5 !important;
}

[data-theme="dark"] .tab-content {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

/* ── الـ Badges ── */
[data-theme="dark"] .bg-light,
[data-theme="dark"] .badge.bg-light {
    background-color: #253347 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .bg-white {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

/* ── الـ hr والفواصل ── */
[data-theme="dark"] hr {
    border-color: #334155 !important;
    opacity: 1 !important;
}

/* ── الـ Progress bars ── */
[data-theme="dark"] .progress,
[data-theme="dark"] .progress-bar-container {
    background-color: #0f172a !important;
}

/* ── الـ List groups ── */
[data-theme="dark"] .list-group-item {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .list-group-item:hover {
    background-color: #253347 !important;
}

[data-theme="dark"] .list-group-item.active {
    background-color: #1a3a5c !important;
    border-color: #334155 !important;
}

/* ── النصوص ── */
[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary {
    color: #64748b !important;
}

[data-theme="dark"] .text-dark {
    color: #e2e8f0 !important;
}

[data-theme="dark"] h1, [data-theme="dark"] h2,
[data-theme="dark"] h3, [data-theme="dark"] h4,
[data-theme="dark"] h5, [data-theme="dark"] h6 {
    color: #e2e8f0 !important;
}

[data-theme="dark"] p, [data-theme="dark"] span,
[data-theme="dark"] li, [data-theme="dark"] td,
[data-theme="dark"] th, [data-theme="dark"] label {
    color: #e2e8f0 !important;
}

[data-theme="dark"] small,
[data-theme="dark"] .small {
    color: #94a3b8 !important;
}

/* ── الحاويات الخلفية ── */
[data-theme="dark"] .bg-light,
[data-theme="dark"] .bg-white {
    background-color: #1e293b !important;
}

[data-theme="dark"] .bg-dark {
    background-color: #0f172a !important;
}

/* ── الـ Accordion ── */
[data-theme="dark"] .accordion-item {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .accordion-header button {
    background-color: #1a2535 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .accordion-header button:not(.collapsed) {
    background-color: #1a3a5c !important;
    color: #93c5fd !important;
}

[data-theme="dark"] .accordion-body {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .accordion-button::after {
    filter: invert(1) !important;
}

/* ── الـ Footer ── */
[data-theme="dark"] footer,
[data-theme="dark"] .footer,
[data-theme="dark"] .footer-custom {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #64748b !important;
}

[data-theme="dark"] footer a,
[data-theme="dark"] .footer a {
    color: #5b9bd5 !important;
}

/* ── الـ Stat boxes ── */
[data-theme="dark"] .stat-box {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .stat-label,
[data-theme="dark"] .stat-card-title,
[data-theme="dark"] .stat-card-subtitle {
    color: #94a3b8 !important;
}

[data-theme="dark"] .stat-number,
[data-theme="dark"] .stat-card-value {
    color: #5b9bd5 !important;
}

[data-theme="dark"] .dashboard-card-label {
    color: #94a3b8 !important;
}

/* ── الـ Pagination ── */
[data-theme="dark"] .pagination .page-link {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #5b9bd5 !important;
}

[data-theme="dark"] .pagination .page-link:hover {
    background-color: #253347 !important;
    color: #93c5fd !important;
}

[data-theme="dark"] .pagination .page-item.active .page-link {
    background-color: #1a3a5c !important;
    border-color: #5b9bd5 !important;
    color: white !important;
}

[data-theme="dark"] .pagination .page-item.disabled .page-link {
    background-color: #162032 !important;
    color: #475569 !important;
}

/* ── الـ Breadcrumb ── */
[data-theme="dark"] .breadcrumb {
    background-color: transparent !important;
}

[data-theme="dark"] .breadcrumb-item {
    color: #94a3b8 !important;
}

[data-theme="dark"] .breadcrumb-item a {
    color: #5b9bd5 !important;
}

[data-theme="dark"] .breadcrumb-item.active {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: #64748b !important;
}

/* ── صفحة تسجيل الدخول ── */
[data-theme="dark"] .login-container,
[data-theme="dark"] .login-card {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .login-header {
    background: linear-gradient(135deg, #1a3a5c 0%, #2d1b69 100%) !important;
}

/* ── الـ Tooltips ── */
[data-theme="dark"] .tooltip-inner {
    background-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* ── الـ Popover ── */
[data-theme="dark"] .popover {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .popover-header {
    background-color: #162032 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .popover-body {
    color: #e2e8f0 !important;
}

/* ── الخاص بالطالب - Student Dashboard ── */
[data-theme="dark"] .welcome-card {
    background: linear-gradient(135deg, #1a3a5c 0%, #2d1b69 100%) !important;
}

[data-theme="dark"] .page-header h1 {
    color: #5b9bd5 !important;
}

[data-theme="dark"] .page-header p {
    color: #94a3b8 !important;
}

[data-theme="dark"] .al-section-title {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .table-custom tbody tr:hover {
    background-color: #253347 !important;
}

[data-theme="dark"] .badge-custom {
    filter: brightness(0.9) !important;
}

/* ── مؤشر اللون للـ spinner والتحميل ── */
[data-theme="dark"] .spinner-border,
[data-theme="dark"] .spinner-grow {
    color: #5b9bd5 !important;
}

/* ── الـ Code blocks ── */
[data-theme="dark"] pre,
[data-theme="dark"] code {
    background-color: #0f172a !important;
    color: #93c5fd !important;
    border-color: #334155 !important;
}

/* ── اللافتات المعلقة في Sidebar ── */
[data-theme="dark"] .badge.bg-warning {
    background-color: #d97706 !important;
    color: white !important;
}

/* ── الصور ── */
[data-theme="dark"] img:not(.no-dark-filter):not([src*=".svg"]) {
    opacity: 0.9;
}

/* ── Quill Editor ── */
[data-theme="dark"] .ql-container,
[data-theme="dark"] .ql-toolbar {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .ql-editor {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .ql-toolbar button,
[data-theme="dark"] .ql-toolbar .ql-picker-label {
    color: #94a3b8 !important;
}

[data-theme="dark"] .ql-toolbar button:hover,
[data-theme="dark"] .ql-toolbar button.ql-active {
    color: #5b9bd5 !important;
}

[data-theme="dark"] .ql-picker-options {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}

/* ── Overflow / Scrollbars ── */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #0f172a;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ── أيقونة اللون - Theme Icon animation ── */
.theme-toggle-btn .theme-icon {
    display: inline-block;
    transition: transform 0.4s ease, opacity 0.3s ease !important;
}

.theme-toggle-btn:active .theme-icon {
    transform: rotate(20deg) scale(1.2) !important;
}

/* ── إخفاء وإظهار الأيقونات حسب الوضع ── */
[data-theme="dark"] .icon-light-mode { display: none !important; }
[data-theme="dark"] .icon-dark-mode  { display: inline !important; }
.icon-light-mode { display: inline !important; }
.icon-dark-mode  { display: none !important; }

/* ── تعطيل الانتقال عند تحميل الصفحة ── */
.theme-no-transition * {
    transition: none !important;
}

/* ================================================
   تحسينات إضافية - صفحات ذات خلفية داكنة بالأصل
   (adaptive-test, challenge-take, adaptive-test-report)
   ================================================ */

/* هذه الصفحات لها gradient داكن في الـ body بالفعل
   في وضع Light نحتاج تعديلها لتصبح فاتحة */
[data-theme="light"] body.dark-bg-page {
    background: linear-gradient(135deg, #e8eaf6 0%, #ede7f6 50%, #e3f2fd 100%) !important;
    color: #1a1a2e !important;
}

/* ── Exam Monitor - top-nav ── */
[data-theme="dark"] .top-nav {
    background: linear-gradient(135deg, #1a3a5c 0%, #2d1b69 100%) !important;
}

/* ── قوائم الجانب في exam-monitor ── */
[data-theme="dark"] .sidebar .menu-sec {
    color: #64748b !important;
}

[data-theme="dark"] .sidebar a {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .sidebar a:hover,
[data-theme="dark"] .sidebar a.active {
    background: #253347 !important;
    color: #5b9bd5 !important;
}

/* ── Monitor cards ── */
[data-theme="dark"] .monitor-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .student-row {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .student-row:hover {
    background: #253347 !important;
}

/* ── Challenge pages - score cards ── */
[data-theme="dark"] .result-card,
[data-theme="dark"] .score-card,
[data-theme="dark"] .leaderboard-row {
    background: rgba(30, 41, 59, 0.9) !important;
    border-color: #334155 !important;
}

/* ── Report page خاص ── */
[data-theme="dark"] .r-section {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .qr-item {
    background: #162032 !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .qr-body {
    border-color: #253347 !important;
}

/* ── صفحة نتيجة الاختبار stat-box ── */
[data-theme="dark"] .stat-box {
    background: #1e293b !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.3) !important;
}

[data-theme="dark"] .stat-box .sv {
    color: #5b9bd5 !important;
}

[data-theme="dark"] .stat-box .sl {
    color: #94a3b8 !important;
}

/* ── Challenge take - option buttons ── */
[data-theme="dark"] .opt-btn {
    background: rgba(30, 41, 59, 0.85) !important;
    border-color: rgba(100, 116, 139, 0.4) !important;
    color: #e2e8f0 !important;
}

[data-theme="dark"] .opt-btn:hover {
    background: rgba(37, 51, 71, 0.95) !important;
    border-color: #5b9bd5 !important;
}

[data-theme="dark"] .question-card {
    background: rgba(30, 41, 59, 0.8) !important;
    border-color: rgba(71, 85, 105, 0.4) !important;
    color: #e2e8f0 !important;
}

/* ── إصلاح نصوص داخل الـ dark pages ── */
[data-theme="dark"] .text-white-50 {
    color: rgba(255,255,255,.5) !important;
}

[data-theme="dark"] .text-muted {
    color: #64748b !important;
}


/* ================================================
   إصلاح الـ Inline Styles - Student Dashboard
   (CSS fallback — الـ JS هو المسؤول الأول)
   ================================================ */

/* ── sidebar-info-chip (CSS class) ── */
[data-theme="dark"] .sidebar-info-chip {
    background: #253347 !important;
    color: #93c5fd !important;
    border: 1px solid #334155 !important;
}

/* ── بطاقة الاختبار: الخلفية العامة ── */
[data-theme="dark"] #assigned-assessments .col-md-6 > div,
[data-theme="dark"] #assigned-assessments .col-lg-4 > div,
[data-theme="dark"] #assigned-assessments [class*="col"] > div[style*="background:#fff"],
[data-theme="dark"] #assigned-assessments [class*="col"] > div[style*="background: #fff"] {
    background: #1e293b !important;
    color: #e2e8f0 !important;
}

/* ── شرائح #f1f5f9 في أي مكان في بطاقات الاختبار ── */
[data-theme="dark"] #assigned-assessments span[style*="#f1f5f9"],
[data-theme="dark"] #assigned-assessments a[style*="#f1f5f9"],
[data-theme="dark"] #assigned-assessments div[style*="background:#f1f5f9"],
[data-theme="dark"] #assigned-assessments div[style*="background: #f1f5f9"] {
    background: #253347 !important;
    color: #93c5fd !important;
}

/* ── لون النص #475569 في بطاقات الاختبار ── */
[data-theme="dark"] #assigned-assessments span[style*="color:#475569"],
[data-theme="dark"] #assigned-assessments span[style*="color: #475569"],
[data-theme="dark"] #assigned-assessments div[style*="color:#475569"],
[data-theme="dark"] #assigned-assessments div[style*="color: #475569"] {
    color: #93c5fd !important;
}

/* ── اسم الاختبار h6 color:#1e293b ── */
[data-theme="dark"] #assigned-assessments h6[style*="color:#1e293b"],
[data-theme="dark"] #assigned-assessments h6[style*="color: #1e293b"],
[data-theme="dark"] #assigned-assessments h6 {
    color: #e2e8f0 !important;
}

/* ── الوصف p color:#64748b ── */
[data-theme="dark"] #assigned-assessments p {
    color: #94a3b8 !important;
}

/* ── تاريخ الاستحقاق color:#94a3b8 ── */
[data-theme="dark"] #assigned-assessments [style*="color:#94a3b8"],
[data-theme="dark"] #assigned-assessments [style*="color: #94a3b8"] {
    color: #64748b !important;
}

/* ── ملاحظة المعلم ── */
[data-theme="dark"] #assigned-assessments [style*="background:#fffbeb"],
[data-theme="dark"] #assigned-assessments [style*="background: #fffbeb"] {
    background: #2d1e00 !important;
    color: #fcd34d !important;
}

/* ── نتيجة ناجحة ── */
[data-theme="dark"] #assigned-assessments [style*="background:#dcfce7"] {
    background: #14532d !important;
}
[data-theme="dark"] #assigned-assessments [style*="color:#16a34a"] {
    color: #4ade80 !important;
}

/* ── نتيجة راسبة (div) ── */
[data-theme="dark"] #assigned-assessments div[style*="background:#fee2e2"] {
    background: #450a0a !important;
}
[data-theme="dark"] #assigned-assessments [style*="color:#dc2626"] {
    color: #f87171 !important;
}

/* ── شارة "ينتهي قريباً" (span) ── */
[data-theme="dark"] #assigned-assessments span[style*="background:#fee2e2"] {
    background: #450a0a !important;
    color: #f87171 !important;
}

/* ── اسم الطالب في الـ Sidebar ── */
[data-theme="dark"] .sidebar h5[style*="border:none"],
[data-theme="dark"] .sidebar h5[style*="border: none"] {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .sidebar h5[style*="margin-top:20px"],
[data-theme="dark"] .sidebar h5[style*="margin-top: 20px"] {
    color: #94a3b8 !important;
}

/* الاسم الكامل تحت النيك نيم */
[data-theme="dark"] .sidebar [style*="font-size:.75rem"][style*="color:#94a3b8"] {
    color: #64748b !important;
}

/* زر تعديل الملف */
[data-theme="dark"] .sidebar button[style*="background:#f1f5f9"] {
    background: #253347 !important;
    color: #a5b4fc !important;
    border-color: #334155 !important;
}

/* ── Dropdown navbar ── */
[data-theme="dark"] .dropdown-menu [style*="color:#1e293b"] {
    color: #e2e8f0 !important;
}
[data-theme="dark"] .dropdown-menu [style*="color:#94a3b8"] {
    color: #64748b !important;
}

/* ================================================
   Light Mode — إصلاح صريح لضمان الألوان الأصلية
   ================================================ */

/* ضمان أن بطاقات الاختبارات تبدو صحيحة في الوضع النهاري */
[data-theme="light"] #assigned-assessments .col-md-6 > div,
[data-theme="light"] #assigned-assessments .col-lg-4 > div {
    background: #ffffff !important;
    color: #1e293b !important;
    box-shadow: 0 2px 12px rgba(0,0,0,.08) !important;
}

[data-theme="light"] #assigned-assessments span[style*="background:#f1f5f9"],
[data-theme="light"] #assigned-assessments span[style*="background: #f1f5f9"] {
    background: #f1f5f9 !important;
    color: #475569 !important;
}

[data-theme="light"] #assigned-assessments h6 {
    color: #1e293b !important;
}

[data-theme="light"] #assigned-assessments p[style*="color:#64748b"] {
    color: #64748b !important;
}

[data-theme="light"] #assigned-assessments [style*="background:#fffbeb"] {
    background: #fffbeb !important;
    color: #92400e !important;
}

[data-theme="light"] #assigned-assessments [style*="background:#dcfce7"] {
    background: #dcfce7 !important;
}

[data-theme="light"] #assigned-assessments [style*="background:#fee2e2"][style*="color:#dc2626"] {
    background: #fee2e2 !important;
}

/* ── Sidebar Light Mode ── */
[data-theme="light"] .sidebar-info-chip {
    background: #f1f5f9 !important;
    color: #64748b !important;
}

[data-theme="light"] .sidebar h5 {
    color: var(--primary-color) !important;
}

[data-theme="light"] .sidebar h5[style*="margin-top:20px"] {
    color: #667eea !important;
}

[data-theme="light"] .sidebar h5[style*="border:none"] {
    color: #333 !important;
}

/* ── Dropdown Light Mode ── */
[data-theme="light"] .dropdown-menu div[style*="color:#1e293b"] {
    color: #1e293b !important;
}
/* ── إصلاح رأس الجدول (thead inline style) ── */
[data-theme="dark"] thead[style*="background:#f8f9fa"],
[data-theme="dark"] thead[style*="background: #f8f9fa"],
[data-theme="dark"] thead[style*="background:#f8f9ff"],
[data-theme="dark"] thead[style*="background: #f8f9ff"] {
    background: linear-gradient(135deg, #1a3a5c 0%, #2d1b69 100%) !important;
}

[data-theme="dark"] thead[style] th,
[data-theme="dark"] thead[style] td {
    color: white !important;
    border-color: #334155 !important;
}