/* ================================================
   DARK MODE FIX
   إصلاحات الوضع الليلي
   ================================================ */

/* Dark Mode Base */
body.dark-mode {
    background: #1a202c !important;
    color: #e2e8f0 !important;
}

body.dark-mode * {
    color: #e2e8f0;
}

/* Dark Mode Cards */
body.dark-mode .card {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .card-header {
    background: #374151 !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

body.dark-mode .card-body {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

/* Dark Mode Tables */
body.dark-mode .table {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .table thead th {
    background: #1a202c !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

body.dark-mode .table tbody td {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

body.dark-mode .table tbody tr:hover {
    background: #374151 !important;
}

/* Dark Mode Forms */
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: #374151 !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus,
body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    background: #374151 !important;
    color: #e2e8f0 !important;
    border-color: #667eea !important;
}

body.dark-mode label {
    color: #e2e8f0 !important;
}

/* Dark Mode Dropdowns */
body.dark-mode .dropdown-menu {
    background: #374151 !important;
    border-color: #4a5568 !important;
}

body.dark-mode .dropdown-item {
    color: #e2e8f0 !important;
}

body.dark-mode .dropdown-item:hover {
    background: #4a5568 !important;
    color: #fff !important;
}

/* Dark Mode Header */
body.dark-mode .header,
body.dark-mode .navbar:not(.bg-primary) {
    background: #2d3748 !important;
    border-color: #4a5568 !important;
}

/* Dark Mode Page Header */
body.dark-mode .page-header {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

/* Dark Mode Modals */
body.dark-mode .modal-content {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .modal-header {
    background: #374151 !important;
    border-color: #4a5568 !important;
}

body.dark-mode .modal-body {
    background: #2d3748 !important;
}

body.dark-mode .modal-footer {
    background: #374151 !important;
    border-color: #4a5568 !important;
}

/* Keep some elements with their original colors */
body.dark-mode .btn-primary,
body.dark-mode .btn-success,
body.dark-mode .btn-danger,
body.dark-mode .btn-warning,
body.dark-mode .btn-info,
body.dark-mode .badge-primary,
body.dark-mode .badge-success,
body.dark-mode .badge-danger,
body.dark-mode .badge-warning,
body.dark-mode .badge-info {
    color: white !important;
}

/* Dark Mode Sidebar - Keep original gradient */
body.dark-mode .sidebar {
    background: linear-gradient(180deg, #5b21b6 0%, #7c3aed 100%) !important;
}

/* Dark Mode Main Content */
body.dark-mode .main-wrapper,
body.dark-mode .main-content,
body.dark-mode .content-wrapper {
    background: #1a202c !important;
}

/* Dark Mode Alerts */
body.dark-mode .alert {
    background: #374151 !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

/* Dark Mode Pagination */
body.dark-mode .page-link {
    background: #374151 !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}

body.dark-mode .page-item.active .page-link {
    background: #667eea !important;
    border-color: #667eea !important;
    color: white !important;
}

/* Dark Mode Breadcrumb */
body.dark-mode .breadcrumb {
    background: #374151 !important;
}

body.dark-mode .breadcrumb-item {
    color: #e2e8f0 !important;
}

/* Dark Mode Text Colors */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
body.dark-mode p,
body.dark-mode span,
body.dark-mode div {
    color: #e2e8f0 !important;
}

/* Keep text visible in specific components */
body.dark-mode .navbar.bg-primary *,
body.dark-mode .sidebar * {
    color: inherit !important;
}

/* Dark Mode Toggle Button Animation */
#darkModeToggle {
    transition: transform 0.3s ease;
}

#darkModeToggle:hover {
    transform: rotate(20deg);
}

/* إصلاح مشكلة الجداول ذات الخلفية الفاتحة في الوضع الليلي */
body.dark-mode .table .table-light th,
body.dark-mode .table thead.table-light th,
body.dark-mode .table-light thead th {
    background: #374151 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .table .table-light td,
body.dark-mode .table tbody.table-light td,
body.dark-mode .table-light tbody td {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
}

/* إصلاح الجداول المتداخلة في الوضع الليلي */
body.dark-mode .table .table thead.table-light th {
    background: #374151 !important;
    color: #e2e8f0 !important;
}

body.dark-mode .table .table tbody td {
    background: #2d3748 !important;
    color: #e2e8f0 !important;
    border-color: #4a5568 !important;
}
