/* =====================================================
   RUKN AL NEBRAS - Unified Stylesheet
   نظام إدارة المحاسبة والمخزون
   ===================================================== */

/* =====================================================
   1. CSS Variables - المتغيرات
   ===================================================== */
:root {
    /* ألوان الشركة الرئيسية */
    --primary-color: #1a1a4e;
    --primary-dark: #12123a;
    --primary-light: #2a2a6e;
    --secondary-color: #ffa500;
    --accent-color: #f5a623;
    --gold-color: #d4a017;
    
    /* ألوان الحالات */
    --success-color: #28a745;
    --success-light: #d4edda;
    --danger-color: #dc3545;
    --danger-light: #f8d7da;
    --warning-color: #ffc107;
    --warning-light: #fff3cd;
    --info-color: #17a2b8;
    --info-light: #d1ecf1;
    
    /* ألوان الخلفية */
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --bg-dark: #1a1a4e;
    --bg-gradient: linear-gradient(135deg, #1a1a4e 0%, #2a2a6e 100%);
    
    /* ألوان النص */
    --text-dark: #212529;
    --text-muted: #6c757d;
    --text-light: #ffffff;
    
    /* ألوان الحدود */
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    
    /* الظلال */
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --shadow-glow: 0 0 20px rgba(245, 166, 35, 0.3);
    
    /* الانتقالات */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* الأبعاد */
    --sidebar-width: 280px;
    --header-height: 60px;
    --border-radius: 0.5rem;
    --border-radius-lg: 1rem;
}

/* =====================================================
   2. Base Styles - الأنماط الأساسية
   ===================================================== */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* الخطوط للغة العربية والكردية */
body[dir="rtl"],
html[lang="ar"] body,
html[lang="ku"] body {
    font-family: 'Noto Naskh Arabic', 'Segoe UI', Tahoma, sans-serif;
}

/* =====================================================
   3. Typography - الطباعة
   ===================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

.page-title {
    background: var(--bg-gradient);
    color: var(--text-light);
    padding: 1.5rem 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.page-title::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.page-title h1,
.page-title h2 {
    color: var(--text-light);
    margin: 0;
    position: relative;
    z-index: 1;
}

.page-title .subtitle {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* =====================================================
   4. Layout - التخطيط
   ===================================================== */
.main-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, #1a1a4e 0%, #2a2a6e 50%, #1a1a4e 100%);
    color: var(--text-light);
    position: fixed;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition-normal);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
}

/* RTL Support for Sidebar */
[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
    direction: ltr; /* Scrollbar on left */
}

[dir="rtl"] .sidebar > * {
    direction: rtl; /* Content stays RTL */
}

[dir="ltr"] .sidebar {
    left: 0;
    right: auto;
}

/* Custom Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.main-content {
    flex: 1;
    padding: 1.5rem;
    transition: var(--transition-normal);
}

[dir="rtl"] .main-content {
    margin-right: var(--sidebar-width);
}

[dir="ltr"] .main-content {
    margin-left: var(--sidebar-width);
}

/* =====================================================
   5. Sidebar Navigation - قائمة التنقل الجانبية
   ===================================================== */
.sidebar-header {
    padding: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 0.5rem;
}

.sidebar-title {
    color: var(--secondary-color);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.sidebar-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 1rem;
}

.nav-section-title {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.5rem 1.5rem;
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    margin: 0.25rem 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.nav-link:hover::before {
    left: 100%;
}

[dir="ltr"] .nav-link {
    border-right: none;
    border-left: none;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-light);
    transform: translateX(-5px) scale(1.02);
    box-shadow: 0 4px 15px rgba(255, 165, 0, 0.3), 
                inset 0 0 20px rgba(255, 165, 0, 0.1);
}

[dir="ltr"] .nav-link:hover {
    transform: translateX(5px) scale(1.02);
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.3) 0%, rgba(255, 165, 0, 0.15) 100%);
    color: #ffd700;
    font-weight: 600;
    box-shadow: 0 5px 20px rgba(255, 165, 0, 0.4),
                inset 0 0 30px rgba(255, 165, 0, 0.2),
                0 0 0 1px rgba(255, 165, 0, 0.5);
    transform: translateX(-8px);
    border-left: 4px solid #ffa500;
}

[dir="ltr"] .nav-link.active {
    transform: translateX(8px);
    border-left: none;
    border-right: 4px solid #ffa500;
}

.nav-link.active i {
    color: #ffd700;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
    animation: iconGlow 2s ease-in-out infinite;
}

@keyframes iconGlow {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(255, 215, 0, 1));
    }
}

.nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

/* =====================================================
   6. Header - الترويسة
   ===================================================== */
.top-header {
    background: var(--bg-white);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-dropdown:hover {
    background: var(--border-light);
}

/* =====================================================
   7. Cards - البطاقات
   ===================================================== */
.card {
    background: var(--bg-white);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
    transition: var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
    padding: 1rem 1.25rem;
}

/* Colored Cards */
.card-primary {
    border-top: 4px solid var(--primary-color);
}

.card-success {
    border-top: 4px solid var(--success-color);
}

.card-warning {
    border-top: 4px solid var(--warning-color);
}

.card-danger {
    border-top: 4px solid var(--danger-color);
}

.card-info {
    border-top: 4px solid var(--info-color);
}

.card-gold {
    border-top: 4px solid var(--secondary-color);
}

/* Stat Cards */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 4rem;
    opacity: 0.1;
    color: var(--primary-color);
}

[dir="rtl"] .stat-card .stat-icon {
    left: 1rem;
}

[dir="ltr"] .stat-card .stat-icon {
    right: 1rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =====================================================
   8. Buttons - الأزرار
   ===================================================== */
.btn {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--text-light);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: var(--gold-color);
}

.btn-success {
    background: var(--success-color);
    color: var(--text-light);
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: var(--danger-color);
    color: var(--text-light);
}

.btn-danger:hover {
    background: #c82333;
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: var(--text-light);
}

.btn-glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px var(--secondary-color);
    }
    to {
        box-shadow: 0 0 20px var(--secondary-color), 0 0 30px var(--secondary-color);
    }
}

/* =====================================================
   9. Forms - النماذج
   ===================================================== */
.form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.625rem 1rem;
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 26, 78, 0.15);
    transform: translateY(-2px);
    outline: none;
}

.form-control:hover {
    border-color: var(--primary-light);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-color);
}

.input-group-text {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 1rem;
}

/* Validation */
.field-validation-error,
.validation-summary-errors {
    color: var(--text-light) !important;
    background: linear-gradient(135deg, var(--danger-color), #c82333);
    padding: 0.4rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    margin-top: 0.35rem;
    display: inline-block;
}

/* Required field asterisk - just red text, no background */
.text-danger,
span.text-danger:not(.field-validation-error) {
    color: var(--danger-color) !important;
    background: none !important;
    padding: 0 !important;
    font-weight: bold;
}

.validation-summary-errors ul {
    margin: 0;
    padding-right: 1rem;
}

[dir="ltr"] .validation-summary-errors ul {
    padding-right: 0;
    padding-left: 1rem;
}

.is-invalid,
.form-control.input-validation-error,
.form-select.input-validation-error,
input.input-validation-error,
select.input-validation-error,
textarea.input-validation-error {
    border-color: var(--danger-color) !important;
    background-color: #fff8f8 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15) !important;
}

.is-invalid:focus,
.form-control.input-validation-error:focus,
.form-select.input-validation-error:focus {
    border-color: var(--danger-color) !important;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.25) !important;
}

.is-valid,
.form-control.valid,
.form-control.input-validation-valid {
    border-color: var(--success-color) !important;
    background-color: #f8fff8 !important;
}

/* Fix text color inside input fields */
.form-control.input-validation-error,
.form-select.input-validation-error,
input.input-validation-error,
select.input-validation-error,
textarea.input-validation-error {
    color: var(--text-dark) !important;
}

/* Error message display fix */
.field-validation-error:empty {
    display: none !important;
}

/* Validation messages under fields */
span.field-validation-error,
.input-validation-error + span.text-danger {
    color: var(--text-light) !important;
    background: linear-gradient(135deg, var(--danger-color), #c82333) !important;
    padding: 0.4rem 0.75rem !important;
    border-radius: var(--border-radius) !important;
    font-size: 0.8rem !important;
    margin-top: 0.35rem !important;
    display: inline-block !important;
}

/* =====================================================
   10. Tables - الجداول
   ===================================================== */
.table-container {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead {
    background: var(--primary-color);
    color: var(--text-light);
}

.table thead th {
    border: none;
    padding: 1rem;
    font-weight: 600;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-light);
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

/* =====================================================
   11. Badges & Status - الشارات والحالات
   ===================================================== */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-weight: 500;
    font-size: 0.8rem;
}

.badge-success {
    background: var(--success-light);
    color: var(--success-color);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger-color);
}

.badge-warning {
    background: var(--warning-light);
    color: #856404;
}

.badge-info {
    background: var(--info-light);
    color: var(--info-color);
}

.badge-primary {
    background: rgba(26, 26, 78, 0.1);
    color: var(--primary-color);
}

/* =====================================================
   12. Alerts - التنبيهات
   ===================================================== */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: var(--success-light);
    color: #155724;
    border-right: 4px solid var(--success-color);
}

[dir="ltr"] .alert-success {
    border-right: none;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background: var(--danger-light);
    color: #721c24;
    border-right: 4px solid var(--danger-color);
}

[dir="ltr"] .alert-danger {
    border-right: none;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: var(--warning-light);
    color: #856404;
    border-right: 4px solid var(--warning-color);
}

[dir="ltr"] .alert-warning {
    border-right: none;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: var(--info-light);
    color: #0c5460;
    border-right: 4px solid var(--info-color);
}

[dir="ltr"] .alert-info {
    border-right: none;
    border-left: 4px solid var(--info-color);
}

/* =====================================================
   13. Language Switcher - مبدل اللغة
   ===================================================== */
.language-switcher {
    display: flex;
    gap: 0.5rem;
}

.language-switcher .lang-btn {
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.language-switcher .lang-btn:hover,
.language-switcher .lang-btn.active {
    background: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
}

/* =====================================================
   14. Animations - الحركات
   ===================================================== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.float-animation {
    animation: float 3s ease-in-out infinite;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* RTL Animation */
@keyframes slideInRTL {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

[dir="rtl"] .slide-in {
    animation: slideInRTL 0.3s ease;
}

/* =====================================================
   15. Responsive - التجاوب
   ===================================================== */
@media (max-width: 992px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
}

@media (max-width: 768px) {
    .page-title {
        padding: 1rem;
    }
    
    .page-title h1,
    .page-title h2 {
        font-size: 1.25rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .table-responsive {
        overflow-x: auto;
    }
}

@media (max-width: 576px) {
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* =====================================================
   16. Print Styles - أنماط الطباعة
   ===================================================== */
@media print {
    /* إعدادات الصفحة */
    @page {
        size: A4;
        margin: 0.5cm; /* هوامش ضيقة جداً */
    }

    /* إخفاء العناصر غير الضرورية */
    .sidebar,
    .top-header,
    .page-header nav,
    .breadcrumb,
    .btn,
    .no-print,
    .page-actions,
    .card-body form,
    button,
    a[href]:not(.no-print-link) {
        display: none !important;
    }
    
    /* إعادة تعيين التخطيط */
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        font-size: 9pt !important; /* حجم خط صغير */
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .container,
    .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* تحسين البطاقات */
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        border-radius: 0 !important;
        margin: 0 0 5px 0 !important;
        page-break-inside: avoid;
    }
    
    .card-header {
        padding: 3px 5px !important;
        background: #f5f5f5 !important;
        border-bottom: 1px solid #ddd !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .card-body {
        padding: 5px !important;
    }
    
    .page-header {
        padding: 0 0 5px 0 !important;
        margin: 0 0 5px 0 !important;
        border-bottom: 1px solid #ddd !important;
    }
    
    .page-title {
        font-size: 14pt !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* تحسين الجداول */
    .table-responsive {
        overflow: visible !important;
    }
    
    table {
        width: 100% !important;
        font-size: 8pt !important;
        border-collapse: collapse !important;
    }
    
    table th,
    table td {
        padding: 2px 4px !important;
        font-size: 8pt !important;
        border: 1px solid #ddd !important;
    }
    
    table thead {
        display: table-header-group !important;
    }
    
    table tfoot {
        display: table-footer-group !important;
    }
    
    table tbody tr {
        page-break-inside: avoid;
    }
    
    /* تحسين الصفوف */
    .row {
        margin: 0 !important;
        width: 100% !important;
    }
    
    .col,
    .col-md-2,
    .col-md-3,
    .col-md-4,
    .col-lg-4,
    .col-lg-8 {
        padding: 2px !important;
        float: left;
    }
    
    /* بطاقات الإحصائيات */
    .row.g-3 {
        margin: 0 0 5px 0 !important;
    }
    
    .row.g-3 .card {
        margin-bottom: 2px !important;
    }
    
    .row.g-3 .card-body {
        padding: 3px !important;
        text-align: center;
    }
    
    .row.g-3 h6 {
        font-size: 8pt !important;
        margin: 0 !important;
    }
    
    .row.g-3 h3,
    .row.g-3 h4 {
        font-size: 10pt !important;
        margin: 0 !important;
    }
    
    /* الألوان للطباعة */
    .bg-primary,
    .bg-success,
    .bg-warning,
    .bg-danger,
    .bg-info,
    .bg-secondary {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .text-white {
        color: black !important; /* تغيير النص الأبيض للأسود */
    }
    
    .badge {
        border: 1px solid #333 !important;
        padding: 1px 3px !important;
        font-size: 7pt !important;
    }
    
    /* تجنب كسر الصفحات */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
    }
    
    /* إخفاء الروابط */
    a[href]:after {
        content: none !important;
    }
    
    /* تحسين الـ Summary */
    .summary-row {
        padding: 1px 0 !important;
        font-size: 9pt !important;
    }
}


/* =====================================================
   17. Utilities - الأدوات المساعدة
   ===================================================== */
.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--secondary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-info { color: var(--info-color) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary { background: var(--primary-color) !important; }
.bg-secondary { background: var(--secondary-color) !important; }
.bg-success { background: var(--success-color) !important; }
.bg-danger { background: var(--danger-color) !important; }
.bg-warning { background: var(--warning-color) !important; }
.bg-info { background: var(--info-color) !important; }
.bg-light { background: var(--bg-light) !important; }

.border-primary { border-color: var(--primary-color) !important; }
.border-secondary { border-color: var(--secondary-color) !important; }

.rounded { border-radius: var(--border-radius) !important; }
.rounded-lg { border-radius: var(--border-radius-lg) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.cursor-pointer { cursor: pointer; }

/* Currency Display */
.currency {
    font-weight: 600;
    color: var(--success-color);
}

.currency::before {
    content: '$';
    margin-left: 0.25rem;
}

[dir="ltr"] .currency::before {
    margin-left: 0;
    margin-right: 0.25rem;
}

.currency.negative {
    color: var(--danger-color);
}

/* =====================================================
   18. Dark Mode - الوضع الداكن
   ===================================================== */

/* Dark Mode Toggle Button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-white);
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition-normal);
    font-size: 1.2rem;
}

.theme-toggle:hover {
    background: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
    transform: rotate(180deg);
}

.theme-toggle .bi-moon-fill {
    display: block;
}

.theme-toggle .bi-sun-fill {
    display: none;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --bg-light: #1a1d21;
    --bg-white: #212529;
    --bg-dark: #0d0f12;
    --text-dark: #e9ecef;
    --text-muted: #adb5bd;
    --border-color: #3a3f44;
    --border-light: #2d3238;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.5);
    --success-light: #1a3d2a;
    --danger-light: #3d1a1a;
    --warning-light: #3d3a1a;
    --info-light: #1a2d3d;
}

/* Dark Mode - Toggle Icon */
[data-theme="dark"] .theme-toggle {
    background: var(--secondary-color);
    color: var(--text-dark);
    border-color: var(--secondary-color);
}

[data-theme="dark"] .theme-toggle .bi-moon-fill {
    display: none;
}

[data-theme="dark"] .theme-toggle .bi-sun-fill {
    display: block;
}

/* Dark Mode - Body */
[data-theme="dark"] body {
    background-color: var(--bg-light);
    color: var(--text-dark);
}

/* Dark Mode - Cards */
[data-theme="dark"] .card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .card-header {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .card-footer {
    background: var(--bg-light);
    border-top-color: var(--border-color);
}

/* Dark Mode - Header */
[data-theme="dark"] .top-header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .top-header h4 {
    color: var(--text-dark);
}

/* Dark Mode - Tables */
[data-theme="dark"] .table {
    color: var(--text-dark);
}

[data-theme="dark"] .table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .table tbody td {
    border-bottom-color: var(--border-color);
}

/* Dark Mode - Forms */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--bg-light);
    border-color: var(--border-color);
    color: var(--text-dark);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: var(--bg-white);
    border-color: var(--primary-light);
    color: var(--text-dark);
    box-shadow: 0 0 0 3px rgba(42, 42, 110, 0.3);
}

[data-theme="dark"] .form-label {
    color: var(--text-dark);
}

[data-theme="dark"] .input-group-text {
    background: var(--bg-light);
    border-color: var(--border-color);
    color: var(--secondary-color);
}

/* Dark Mode - Dropdown */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-white);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-dark);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--bg-light);
}

[data-theme="dark"] .dropdown-divider {
    border-top-color: var(--border-color);
}

/* Dark Mode - User Dropdown */
[data-theme="dark"] .user-dropdown {
    background: var(--bg-light);
    color: var(--text-dark);
}

[data-theme="dark"] .user-dropdown:hover {
    background: var(--border-color);
}

/* Dark Mode - Language Switcher */
[data-theme="dark"] .language-switcher .lang-btn {
    background: var(--bg-light);
    border-color: var(--border-color);
    color: var(--text-dark);
}

[data-theme="dark"] .language-switcher .lang-btn:hover,
[data-theme="dark"] .language-switcher .lang-btn.active {
    background: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
}

/* Dark Mode - Alerts */
[data-theme="dark"] .alert-success {
    background: var(--success-light);
    color: #8fd19e;
}

[data-theme="dark"] .alert-danger {
    background: var(--danger-light);
    color: #f5a5a5;
}

[data-theme="dark"] .alert-warning {
    background: var(--warning-light);
    color: #f5d68a;
}

[data-theme="dark"] .alert-info {
    background: var(--info-light);
    color: #8ac4d1;
}

/* Dark Mode - Badges */
[data-theme="dark"] .badge.bg-secondary {
    background: var(--border-color) !important;
}

/* Dark Mode - Modal */
[data-theme="dark"] .modal-content {
    background-color: var(--bg-white);
    border-color: var(--border-color);
    color: var(--text-dark);
}

[data-theme="dark"] .modal-header {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .modal-footer {
    border-top-color: var(--border-color);
}

[data-theme="dark"] .btn-close {
    filter: invert(1);
}

/* Dark Mode - Stat Cards */
[data-theme="dark"] .stat-value {
    color: var(--secondary-color);
}

[data-theme="dark"] .stat-card .stat-icon {
    color: var(--secondary-color);
}

/* Dark Mode - Headings */
[data-theme="dark"] h1:not(.page-title h1):not(.sidebar-title),
[data-theme="dark"] h2:not(.page-title h2),
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--text-dark);
}

/* Dark Mode - Links */
[data-theme="dark"] a:not(.nav-link):not(.btn) {
    color: var(--secondary-color);
}

/* Dark Mode - Table Secondary */
[data-theme="dark"] .table-secondary,
[data-theme="dark"] .table-secondary td {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Dark Mode Transition */
body,
.card,
.top-header,
.form-control,
.form-select,
.dropdown-menu,
.modal-content {
    transition: background-color var(--transition-normal), 
                color var(--transition-normal), 
                border-color var(--transition-normal);
}

/* =====================================================
   25. Mobile Responsive - تصميم الموبايل
   ===================================================== */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    z-index: 1050;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: var(--text-light);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all var(--transition-normal);
    align-items: center;
    justify-content: center;
}

[dir="rtl"] .mobile-menu-toggle {
    right: 15px;
}

[dir="ltr"] .mobile-menu-toggle {
    left: 15px;
}

.mobile-menu-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 165, 0, 0.5);
}

.mobile-menu-toggle i {
    line-height: 1;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
    backdrop-filter: blur(3px);
}

.sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Styles (768px and below) */
@media (max-width: 768px) {
    /* Full width wrapper - no sidebar space */
    .main-wrapper {
        width: 100%;
    }
    
    /* Show mobile menu button */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Show overlay when needed */
    .sidebar-overlay {
        display: block;
    }
    
    /* Sidebar as popup overlay on mobile */
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        z-index: 1001;
        width: 280px;
        max-width: 75vw;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.5);
    }
    
    /* Hide sidebar off-screen by default */
    [dir="rtl"] .sidebar {
        right: 0;
        left: auto;
        transform: translateX(100%);
    }
    
    [dir="ltr"] .sidebar {
        left: 0;
        right: auto;
        transform: translateX(-100%);
    }
    
    /* Show sidebar when toggled */
    .sidebar.show {
        transform: translateX(0) !important;
    }
    
    /* Main content takes FULL WIDTH - NO MARGINS! */
    .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
        padding: 1rem;
        width: 100% !important;
        flex: 1;
    }
    
    /* Force remove margins for both RTL and LTR */
    [dir="rtl"] .main-content,
    [dir="ltr"] .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
        margin-inline-start: 0 !important;
        margin-inline-end: 0 !important;
    }
    
    /* Adjust top header for mobile */
    .top-header {
        padding: 0.75rem 1rem;
        margin-top: 60px; /* Space for mobile menu button */
        width: 100%;
    }
    
    /* Full width page content */
    .page-content {
        width: 100%;
        padding: 0;
    }
    
    .header-left h4 {
        font-size: 1rem;
    }
    
    .header-right {
        gap: 0.5rem;
    }
    
    .user-dropdown span {
        display: none; /* Hide username on mobile */
    }
    
    /* Smaller cards */
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Stack buttons vertically */
    .page-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .page-actions .btn {
        width: 100%;
    }
    
    /* Better table responsiveness */
    .table-responsive {
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    /* Smaller page title */
    .page-title {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .page-title h1,
    .page-title h2 {
        font-size: 1.25rem;
    }
    
    /* Adjust form spacing */
    .form-group {
        margin-bottom: 1rem;
    }
    
    /* Language switcher - compact */
    .language-switcher .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
}

/* Tablet Styles (769px to 992px) */
@media (min-width: 769px) and (max-width: 992px) {
    .sidebar {
        width: 240px;
    }
    
    :root {
        --sidebar-width: 240px;
    }
    
    .sidebar-title {
        font-size: 1.1rem;
    }
    
    .nav-link {
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
}

/* Small Mobile (480px and below) */
@media (max-width: 480px) {
    /* Slightly wider sidebar on very small screens */
    .sidebar {
        width: 280px;
        max-width: 80vw;
    }
    
    .top-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    /* Compact table */
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    /* Smaller buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Landscape Orientation Fix */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar-header {
        padding: 1rem;
    }
    
    .sidebar-logo {
        max-width: 80px;
    }
    
    .sidebar-title {
        font-size: 1rem;
    }
    
    .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .nav-section-title {
        font-size: 0.7rem;
        padding: 0.25rem 1rem;
    }
}
