/* ==========================================================================
   1. استدعاء خط Cairo الاحترافي
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

/* ==========================================================================
   2. تعميم الخط على النصوص مع استثناء عناصر الأيقونات
   ========================================================================== */
body, h1, h2, h3, h4, h5, h6, p, a,
span:not(.fa):not(.fas):not(.far):not(.fal):not(.fab):not(.fad):not([class*="fa-"]):not(.glyphicon):not([class*="glyphicon-"]),
button, input, select, textarea, .btn, .table, .sidebar, .content-header {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif !important;
}

/* ==========================================================================
   3. تثبيت واستعادة خطوط الأيقونات الأصلية
   ========================================================================== */
.fa, .fas, .far, .fal, .fab, .fad,
[class^="fa-"], [class*=" fa-"],
.glyphicon, [class^="glyphicon-"] {
    font-family: 'Font Awesome 5 Free', 'FontAwesome' !important;
}

.fab {
    font-family: 'Font Awesome 5 Brands' !important;
}

/* ==========================================================================
   4. خط وعناصر القائمة الجانبية (Sidebar)
   ========================================================================== */
aside.side-bar,
.side-bar,
.sidebar-menu,
.sidebar-menu a,
.sidebar-menu span,
aside.side-bar a,
aside.side-bar span:not(.fa):not(.fas):not(.far) {
    font-size: 17px !important;
    font-weight: 900 !important;
    letter-spacing: 0 !important;
}

/* تكبير وتوسيع ارتفاع أزرار ومربعات عناصر السايدبار */
aside.side-bar nav a,
aside.side-bar .sidebar-menu a,
aside.side-bar a[class*="tw-"],
aside.side-bar ul li a,
aside.side-bar [class*="tw-rounded"] a,
aside.side-bar .tw-dw-menu a {
    min-height: 48px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    display: flex !important;
    align-items: center !important;
    margin-top: 4px !important;
    margin-bottom: 4px !important;
    box-sizing: border-box !important;
}

/* محاذاة الأيقونات والأسهم في السايدبار رأسياً */
aside.side-bar a i,
aside.side-bar a svg {
    font-size: 20px !important;
    min-width: 24px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ==========================================================================
   5. كسر النصوص الطويلة في السايدبار + إلغاء أنيميشن الطي المتشنج
   ========================================================================== */
aside.side-bar a,
aside.side-bar a span,
aside.side-bar [class*="tw-dw-menu"] a,
aside.side-bar [class*="tw-dw-menu"] a span {
    white-space: normal !important;
    word-break: break-word !important;
    overflow: visible !important;
    text-overflow: unset !important;
    line-height: 1.35 !important;
}

aside.side-bar details,
aside.side-bar ul,
aside.side-bar li,
aside.side-bar [class*="tw-dw-menu"] {
    transition: none !important;
    animation: none !important;
}

/* ==========================================================================
   6. تناسق وأحجام الأزرار (Buttons) في كل الشاشات
   ========================================================================== */
.btn,
button[type="button"],
button[type="submit"],
.theme-btn-bg {
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.5 !important;
    border-radius: 6px !important;
}

.btn-default, .btn-primary, .btn-success, .btn-info, .btn-warning, .btn-danger {
    padding: 6px 14px !important;
    font-size: 13px !important;
}

.btn-xs, .btn-sm {
    padding: 4px 10px !important;
    font-size: 16px !important;
}

.btn-lg {
    padding: 8px 18px !important;
    font-size: 14px !important;
}

/* ==========================================================================
   7. ضبط عناوين الصفحات وجداول الاستعراض العامة
   ========================================================================== */
.content-header h1,
.content-header .tw-text-xl,
.content-header .tw-text-2xl {
    font-size: 20px !important;
    font-weight: 700 !important;
}

table.dataTable th,
table.dataTable td {
    font-size: 16px !important;
    vertical-align: middle !important;
}

/* تنسيق أزرار الإجراءات داخل جداول الاستعراض */
table.dataTable td .btn,
table.dataTable td a.btn,
table.dataTable td button.btn {
    font-size: 16px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

/* إصلاح أيقونة زر الحذف (استبدال الرمز المكسور E020 بسلة المهملات) */
table.dataTable td .btn-danger i,
table.dataTable td [class*="delete"] i {
    font-family: 'Font Awesome 5 Free' !important;
    font-weight: 900 !important;
    font-style: normal !important;
}

table.dataTable td .btn-danger i::before,
table.dataTable td [class*="delete"] i::before {
    content: "\f2ed" !important; /* fa-trash-alt */
    font-size: 14px !important;
}

/* إصلاح أيقونة زر التعديل (استبدال أيقونة البيت بقلم التعديل) */
table.dataTable td .btn-info i,
table.dataTable td .btn-primary i,
table.dataTable td [class*="edit"] i {
    font-family: 'Font Awesome 5 Free' !important;
    font-weight: 900 !important;
    font-style: normal !important;
}

table.dataTable td .btn-info i::before,
table.dataTable td .btn-primary i::before,
table.dataTable td [class*="edit"] i::before {
    content: "\f044" !important; /* fa-edit */
    font-size: 14px !important;
}

/* ==========================================================================
   8. جدول بنود الفواتير (المشتريات / المبيعات / نقاط البيع)
   ========================================================================== */
/* عناوين أعمدة جدول الفاتورة */
#purchase_entry_table th,
#pos_table th {
    font-size: 16px !important;
    font-weight: 800 !important;
    vertical-align: middle !important;
    padding: 10px 6px !important;
}

/* نصوص وخانات الإدخال داخل صفوف المنتجات */
#purchase_entry_table td,
#purchase_entry_table td input,
#purchase_entry_table td select,
#purchase_entry_table td span {
    font-size: 16px !important;
    font-weight: 600 !important;
}

/* اسم المنتج والباركود وحالة المخزون داخل السطر */
#purchase_entry_table td:nth-child(2),
#purchase_entry_table .product_name {
    font-size: 17px !important;
    font-weight: 700 !important;
}

/* نصوص الإجماليات أسفل الجدول مباشرة (مجموع العناصر / المبلغ الإجمالي الصافي) */
table#purchase_entry_table ~ div,
.purchase_table_total,
td.text-right,
span#total_subtotal,
span#total_quantity {
    font-size: 20px !important;
    font-weight: 800 !important;
    line-height: 1.8 !important;
}

/* ==========================================================================
   9. قطاع الخصم والضريبة وملاحظات الفاتورة أسفل الجدول
   ========================================================================== */
/* نصوص العناوين والتسميات (Labels) */
.box-body label[for*="discount"],
.box-body label[for*="tax"],
.box-body label[for*="additional_notes"],
.box-body .form-group > label {
    font-size: 17px !important;
    font-weight: 800 !important;
    color: #1f2937 !important;
}

/* نصوص المبالغ المحسوبة: الخصم: (-) 0.00 جنية / ضريبة الشراء: (+) 0.00 جنية */
.box-body .row b,
.box-body table tfoot,
#discount_calculated_amount,
#tax_calculated_amount {
    font-size: 18px !important;
    font-weight: 800 !important;
}

/* خانات الإدخال والقوائم المنسدلة للخصم والضريبة والملاحظات */
#discount_amount,
select[name="discount_type"],
select[name="tax_id"],
textarea#additional_notes {
    font-size: 16px !important;
    font-weight: 600 !important;
}
