:root {
    --navy: #0A192F;
    --purple: #6C63FF;
    --emerald: #2DD4BF;
    --lavender: #C4C4F0;
    --white: #FFFFFF;
    --card-dark: #112240;
    --gold: #FFD700;
    --danger: #ff6b6b;
    --success: #2ecc71;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--navy);
    color: var(--white);
    font-size: 16px;
}

/* ===== كل النصوص بيضاء ===== */
h1, h2, h3, h4, h5, h6, p, span, label, .nav-link, .navbar-brand, .badge, .stat-card h6, .stat-card h3, .table, .modal-content, .form-control, .form-select, .btn {
    color: var(--white) !important;
}

h2 { color: var(--emerald) !important; font-size: 28px; }
label { color: var(--emerald) !important; font-weight: 500; }

.form-control, .form-select {
    background: rgba(10, 25, 47, 0.8);
    border: 1px solid rgba(108, 99, 255, 0.3);
    color: var(--white) !important;
}
.form-control:focus, .form-select:focus {
    background: rgba(10, 25, 47, 0.9);
    border-color: var(--emerald);
    box-shadow: 0 0 20px rgba(45, 212, 191, 0.2);
}
.form-control::placeholder { color: var(--lavender); }

/* ===== تسجيل الدخول ===== */
.login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--navy), #0D1F3A);
}
.login-card {
    background: var(--card-dark);
    padding: 40px;
    border-radius: 20px;
    width: 400px;
    max-width: 90%;
    border: 1px solid var(--purple);
    box-shadow: 0 0 40px rgba(108, 99, 255, 0.1);
}
.login-card h2 { color: var(--white) !important; }
.login-card p { color: var(--lavender) !important; }

/* ===== السايد بار ===== */
.sidebar {
    width: 280px;
    background: var(--card-dark);
    min-height: 100vh;
    border-left: 1px solid var(--purple);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.sidebar-header { padding: 20px; text-align: center; border-bottom: 1px solid var(--purple); }
.company-logo { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid var(--emerald); }
.sidebar .nav-link {
    color: var(--white) !important;
    padding: 12px 20px;
    transition: 0.3s;
    border-radius: 8px;
    margin: 4px 8px;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active { background: var(--purple); }
.sidebar .nav-link i { margin-left: 10px; color: var(--emerald); }
.sidebar-footer { position: absolute; bottom: 20px; width: 90%; padding: 10px; }

/* ===== المحتوى ===== */
.wrapper { display: flex; }
.content { flex: 1; padding: 20px; background: var(--navy); }

/* ===== البطاقات ===== */
.stat-card {
    background: var(--card-dark);
    border-radius: 15px;
    padding: 20px;
    border-bottom: 3px solid var(--emerald);
    transition: 0.3s;
    margin-bottom: 15px;
}
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(108, 99, 255, 0.1); }
.stat-card h6 { color: var(--lavender) !important; font-size: 14px; }
.stat-card h3 { color: var(--emerald) !important; font-size: 28px; margin-top: 10px; }
.stat-card .danger { color: var(--danger) !important; }
.stat-card .warning { color: var(--gold) !important; }
.stat-card .success { color: var(--success) !important; }

/* ===== KPI Cards ===== */
.kpi-card {
    background: var(--card-dark);
    border-radius: 15px;
    padding: 15px 20px;
    border: 1px solid rgba(108, 99, 255, 0.2);
    transition: 0.3s;
    margin-bottom: 10px;
}
.kpi-card:hover { transform: translateY(-3px); border-color: var(--emerald); }
.kpi-card .kpi-value { font-size: 24px; font-weight: bold; margin-top: 5px; }
.kpi-card .kpi-label { color: var(--lavender) !important; font-size: 13px; }
.kpi-card .kpi-change { font-size: 13px; margin-top: 5px; }
.kpi-card .kpi-change.up { color: var(--success); }
.kpi-card .kpi-change.down { color: var(--danger); }

/* ===== الجداول ===== */
.table {
    background: var(--card-dark);
    border-radius: 10px;
    overflow: hidden;
    color: var(--white) !important;
}
.table thead { background: var(--purple); }
.table td, .table th { border-color: rgba(108, 99, 255, 0.2); padding: 12px; color: var(--white) !important; }
.table tbody tr:hover { background: rgba(108, 99, 255, 0.1); }

/* ===== الأزرار ===== */
.btn-primary { background: var(--purple); border: none; color: var(--white) !important; }
.btn-primary:hover { background: #5850d1; transform: translateY(-2px); }
.btn-success { background: var(--success); border: none; color: var(--navy) !important; }
.btn-danger { color: var(--white) !important; }

/* ===== المودالات ===== */
.modal-content { background: var(--card-dark); border: 1px solid var(--purple); color: var(--white) !important; }
.modal-header { border-bottom: 1px solid var(--purple); }
.modal-header h5 { color: var(--emerald) !important; }
.modal-footer { border-top: 1px solid var(--purple); }

/* ===== التنبيهات ===== */
.alert-warning-custom { background: rgba(255, 215, 0, 0.1); border: 1px solid var(--gold); color: var(--gold) !important; padding: 15px; border-radius: 12px; }
.alert-danger-custom { background: rgba(255, 107, 107, 0.1); border: 1px solid var(--danger); color: var(--danger) !important; padding: 15px; border-radius: 12px; }
.alert-success-custom { background: rgba(46, 204, 113, 0.1); border: 1px solid var(--success); color: var(--success) !important; padding: 15px; border-radius: 12px; }

/* ===== تويست ===== */
.toast-notify {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--emerald);
    color: var(--navy) !important;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 9999;
    display: none;
    font-weight: bold;
}

/* ===== خدمات العميل ===== */
.service-tag {
    display: inline-block;
    background: rgba(108, 99, 255, 0.2);
    color: var(--white) !important;
    padding: 6px 15px;
    border-radius: 20px;
    margin: 4px;
    cursor: pointer;
    border: 1px solid var(--purple);
}
.service-tag:hover { background: var(--purple); }
.service-tag i { margin-right: 8px; color: var(--danger); }

/* ===== الفاتورة للطباعة ===== */
.invoice-print {
    background: white;
    color: #0A192F !important;
    padding: 40px;
    border-radius: 20px;
    max-width: 1000px;
    margin: 0 auto;
}
.invoice-print h1, .invoice-print h2, .invoice-print h3, .invoice-print h4, .invoice-print p, .invoice-print span, .invoice-print td, .invoice-print th {
    color: #0A192F !important;
}
.invoice-print .company-name { color: #6C63FF !important; font-size: 28px; font-weight: bold; }
.invoice-print .invoice-title { color: #2DD4BF !important; font-size: 32px; font-weight: bold; }
.invoice-print .bank-details { background: #f0f0f0; padding: 20px; border-radius: 10px; margin-top: 30px; }
.invoice-print .amount { color: #2DD4BF !important; font-size: 22px; font-weight: bold; }
.invoice-print .signature { margin-top: 40px; padding-top: 20px; border-top: 1px solid #ddd; display: flex; justify-content: space-between; }
.invoice-print .signature .line { border-bottom: 1px solid #333; margin-top: 40px; padding-bottom: 5px; }

/* ===== سكرول ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--navy); }
::-webkit-scrollbar-thumb { background: var(--purple); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--emerald); }

/* ===== استجابة ===== */
@media (max-width: 768px) {
    .sidebar { position: fixed; right: -280px; z-index: 1100; width: 280px; transition: 0.3s; }
    .sidebar.show { right: 0; }
    .content { width: 100%; }
    .login-card { padding: 25px; }
}
/* ===== الوضع المظلم والفاتح ===== */
body.light-mode {
    --navy: #f0f2f5;
    --card-dark: #ffffff;
    --white: #1a1a2e;
    --lavender: #4a4a6a;
    --glass-bg: rgba(255, 255, 255, 0.9);
}

body.light-mode .sidebar {
    background: #ffffff !important;
    border-left: 1px solid #6C63FF;
}

body.light-mode .sidebar .nav-link {
    color: #1a1a2e !important;
}

body.light-mode .sidebar .nav-link:hover,
body.light-mode .sidebar .nav-link.active {
    background: #6C63FF !important;
    color: #ffffff !important;
}

body.light-mode .stat-card {
    background: #ffffff !important;
    border-bottom: 3px solid #6C63FF;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

body.light-mode .stat-card h6 {
    color: #4a4a6a !important;
}

body.light-mode .stat-card h3 {
    color: #6C63FF !important;
}

body.light-mode .table {
    background: #ffffff !important;
}

body.light-mode .table td,
body.light-mode .table th {
    color: #1a1a2e !important;
    border-color: #e0e0e0 !important;
}

body.light-mode .modal-content {
    background: #ffffff !important;
    color: #1a1a2e !important;
}

body.light-mode .modal-header {
    border-bottom: 1px solid #e0e0e0;
}

body.light-mode .modal-header h5 {
    color: #6C63FF !important;
}

body.light-mode .form-control,
body.light-mode .form-select {
    background: #ffffff !important;
    border: 1px solid #d0d0d0 !important;
    color: #1a1a2e !important;
}

body.light-mode .form-control::placeholder {
    color: #999 !important;
}

body.light-mode label {
    color: #1a1a2e !important;
}

body.light-mode .kpi-card {
    background: #ffffff !important;
    border: 1px solid #e0e0e0;
}

body.light-mode .kpi-card .kpi-label {
    color: #4a4a6a !important;
}

body.light-mode .content {
    background: #f0f2f5;
}

body.light-mode .navbar {
    background: #ffffff !important;
    border-bottom: 1px solid #6C63FF !important;
}

body.light-mode .navbar .navbar-brand {
    color: #1a1a2e !important;
}

body.light-mode .login-card {
    background: #ffffff !important;
    border: 1px solid #6C63FF;
}

body.light-mode .login-card h2 {
    color: #1a1a2e !important;
}

body.light-mode .login-card p {
    color: #4a4a6a !important;
}

body.light-mode .login-card label {
    color: #1a1a2e !important;
}

body.light-mode .alert-warning-custom {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid #f39c12;
    color: #f39c12 !important;
}

body.light-mode .alert-danger-custom {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid #e74c3c;
    color: #e74c3c !important;
}

body.light-mode .alert-success-custom {
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid #27ae60;
    color: #27ae60 !important;
}

body.light-mode .service-tag {
    background: rgba(108, 99, 255, 0.1);
    border: 1px solid #6C63FF;
    color: #1a1a2e !important;
}

body.light-mode .service-tag:hover {
    background: #6C63FF;
    color: #ffffff !important;
}

/* ===== تعديل التبديل بين الوضعين ===== */
#themeToggle {
    transition: all 0.3s;
}

#themeToggle:hover {
    transform: rotate(20deg);
}

/* ===== تحسين ظهور الجداول ===== */
.table tbody tr {
    transition: all 0.3s;
    cursor: pointer;
}

.table tbody tr:hover {
    background: rgba(108, 99, 255, 0.1) !important;
    transform: scale(1.01);
}

/* ===== إصلاح ظهور العملاء والفواتير ===== */
.page-content {
    min-height: 300px;
}

.page-content table {
    width: 100% !important;
}
/* ===== تنسيقات لوحة التنفيذيين ===== */
.executive-card {
    background: var(--card-dark);
    border-radius: 15px;
    padding: 20px;
    border-left: 4px solid var(--purple);
    transition: 0.3s;
    margin-bottom: 15px;
}
.executive-card:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(108, 99, 255, 0.1);
}
.executive-card .number {
    font-size: 28px;
    font-weight: 700;
    color: var(--emerald);
}
.executive-card .label {
    font-size: 14px;
    color: var(--lavender);
}
.executive-card .trend-up { color: #2ecc71; }
.executive-card .trend-down { color: #e74c3c; }

/* ===== تنسيقات التقارير المخصصة ===== */
.custom-report-item {
    background: var(--card-dark);
    border-radius: 12px;
    padding: 15px 20px;
    border: 1px solid rgba(108, 99, 255, 0.1);
    transition: 0.3s;
    cursor: pointer;
    margin-bottom: 10px;
}
.custom-report-item:hover {
    border-color: var(--purple);
    transform: scale(1.01);
}
.custom-report-item .report-name {
    font-weight: 600;
    font-size: 16px;
}
.custom-report-item .report-fields {
    font-size: 13px;
    color: var(--lavender);
}

/* ===== أزرار التصدير ===== */
.export-btn {
    background: var(--purple);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    transition: 0.3s;
}
.export-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}
.export-btn i {
    margin-left: 8px;
}

/* ===== أزرار النسخ الاحتياطي ===== */
.backup-btn {
    background: var(--emerald);
    color: var(--navy);
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    transition: 0.3s;
    margin: 5px;
}
.backup-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(45, 212, 191, 0.3);
}

/* ===== شاشة البداية ===== */
#splashScreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0A192F, #1a1a3e);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
}
.splash-logo {
    font-size: 80px;
    color: #2DD4BF;
    animation: splashPulse 1.5s ease-in-out infinite;
}
.splash-title {
    font-size: 48px;
    font-weight: 800;
    color: #6C63FF;
    margin-top: 20px;
    letter-spacing: 2px;
}
.splash-sub {
    font-size: 18px;
    color: #C4C4F0;
    margin-top: 10px;
}
@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}