/* =========================================
   Fluorite Optic - Central CSS (Refactored)
   تمت الهيكلة، إزالة التكرار، وفصل المكونات لتسهيل الصيانة
   ========================================= */

/* =========================================
   01. المتغيرات العامة (CSS Variables)
   ========================================= */
:root {
    --fluorite-main: #00A896;
    --fluorite-subtle: #e6f6f4;
    --fluorite-hover: #1abc9c;
    --fluorite-dark: #16a085;
    --sidebar-bg: #2c3e50;
    --sidebar-sub: #1a252f;
    --sidebar-border: #34495e;
    --bg-light: #f4f6f9;
    --bg-body: #f4f6f9;
    --text-muted: #6c757d;
    --border-color: #e2e8f0;
    --danger-red: #e74c3c;
    --danger-dark: #c0392b;
    --orange-exp: #d35400;
    --orange-hover: #e67e22;
    --green-items: #27ae60;
    --green-hover: #219653;
    --primary-deep: #2c3e50;
    --accent-teal: #1abc9c;
    --accent-green: #27ae60;
    --accent-orange: #f39c12;
    --light-bg: #f8fafc;
}

/* =========================================
   02. الإعدادات الأساسية (Globals & Resets)
   ========================================= */
body { 
    background-color: var(--bg-body); 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    overflow-x: hidden; 
    max-width: 100%; 
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #b0b0b0; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--fluorite-hover); }
::-webkit-scrollbar-thumb:active { background: var(--fluorite-dark); }

/* =========================================
   03. النصوص والتخطيط المساعد (Typography & Utilities)
   ========================================= */
.rtl-container, .report-container, .cash-flow-container, .daterangepicker { 
    direction: rtl; 
    text-align: right; 
}
.daterangepicker { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
.daterangepicker .ranges li { text-align: right; font-weight: bold; }

.small-text, .fs-075, .style-sub-label { font-size: 0.75rem !important; }
.fs-08, .label-small, .btn-table-opt { font-size: 0.8rem; }
.small-font, .items-table, .damage-modal-heading, .damage-items-table-small-font, .purchase-summary-card, #purchaseItemsDetailTable, .purchase-summary-totals { font-size: 0.825rem; }
.modal-content, .modal-content-small-font, .modal-content.custom-font-size, .add-payment-modal, .style-small-font, .style-sub-title { font-size: 0.875rem; }
.table-font-size-14, .table-font-size-small, .table-font-size-14-thead, .table-font-size-14-tbody, thead.table-head-font, tbody.table-body-font, thead.bg-light, tbody { font-size: 14px; }

h3, .h3-title { color: var(--primary-deep); }
.section-title-custom, .pb-2 { color: #1e3c72; font-weight: bold; }
.archive-desc-text { color: var(--text-muted); }
.archive-desc-text strong, .text-fluorite-strong { color: #2a5298; }
.custom-dates-hidden, .parent-category-div, .hidden-row { display: none; }
.custom-dates-visible, #custom_dates_div.show { display: block; }
.sales-share-container { max-width: 420px; margin: 0 auto; }
.filter-collapse-header, .filter-header, #dateRangeInput, #dateRangeFilter, .date-range-input, .card-header { cursor: pointer; }
 
/* =========================================
   04. الألوان والتيمات (Themes & Colors)
   ========================================= */
.border-fluorite { border-right-color: var(--fluorite-main) !important; }
.text-fluorite { color: var(--fluorite-main) !important; }
.bg-fluorite-subtle { background-color: var(--fluorite-subtle) !important; }
.icon-teal, .title-section-icon, .university-icon { color: var(--accent-teal); }
.border-top-success, .card-active-reps { border-top: 3px solid #198754 !important; }
.border-top-secondary, .card-disabled-reps, .card-disabled-reps-border { border-top: 3px solid #6c757d !important; }
.due-amount-row, .due-amount-bg, .due-row { background-color: #fdf2f2; }
.grand-total-row, .total-divider { border-top: 2px solid #e0e0e0; }
.ref-code-input, .search-results { background-color: #f8f9fa; }

/* =========================================
   05. الهيكل والتنقل (Layout, Sidebar & Navigation)
   ========================================= */
.sidebar { background-color: var(--sidebar-bg); height: 100vh; overflow-y: auto; padding-top: 20px; transition: 0.3s; width: 250px; position: fixed; z-index: 1050; padding-bottom: 50px; }
.sidebar .brand { color: white; font-size: 20px; font-weight: bold; text-align: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--sidebar-border); }
.sidebar-heading { color: #95a5a6; font-size: 11px; font-weight: bold; margin: 15px 25px 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.sidebar a { color: #ecf0f1; text-decoration: none; padding: 10px 25px; display: block; border-bottom: 1px solid rgba(52, 73, 94, 0.5); font-size: 14px; transition: 0.2s; }
.sidebar a i { width: 20px; text-align: center; margin-left: 5px; color: #bdc3c7; }
.sidebar a:hover { background-color: var(--fluorite-hover); color: white; border-right: 4px solid var(--fluorite-dark); }
.sidebar a:hover i { color: white; }
.sidebar .submenu { background-color: var(--sidebar-sub); display: none; }
.sidebar .submenu a { padding: 8px 45px 8px 15px; font-size: 13px; border-bottom: none; color: #bdc3c7; border-right: none; }
.sidebar .submenu a:hover { color: white; background-color: var(--sidebar-bg); }

.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1045; }
.sidebar-overlay.active { display: block; }

#mainContent { margin-right: 250px; transition: 0.3s; padding: 20px; min-height: 100vh; min-width: 0; }
.header { background-color: var(--fluorite-hover); color: white; height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 25px; border-radius: 6px; margin-bottom: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.brand-container { display: flex; align-items: center; justify-content: center; gap: 10px; }
.brand-logo { max-height: 35px; border-radius: 4px; }
.brand-text { font-size: 18px; white-space: normal; overflow-wrap: break-word; }

.profile-menu { display: none; position: absolute; top: 45px; left: 0; background: white; border: 1px solid #e0e0e0; border-radius: 6px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); z-index: 1000; min-width: 180px; overflow: hidden; }
.profile-menu a { color: var(--primary-deep); padding: 12px 15px; text-decoration: none; display: block; font-size: 13px; transition: 0.2s; border-bottom: none; }
.profile-menu a:hover { background-color: var(--bg-light); color: var(--fluorite-hover); }
.profile-menu .logout { color: var(--danger-dark); border-top: 1px solid var(--bg-light); }

.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background-color: #ffffff; box-shadow: 0 -2px 10px rgba(0,0,0,0.1); z-index: 1040; justify-content: space-around; padding: 8px 0; border-top: 1px solid #e0e0e0; }
.bottom-nav .nav-item { text-align: center; color: var(--text-muted); text-decoration: none; font-size: 11px; font-weight: bold; flex-grow: 1; }
.bottom-nav .nav-item i { display: block; font-size: 20px; margin-bottom: 3px; color: var(--primary-deep); }
.bottom-nav .nav-item.active, .bottom-nav .nav-item.active i { color: var(--fluorite-hover); }
.bottom-nav .nav-item-pos i { color: var(--fluorite-dark); font-size: 24px; }
.nav-link-transparent { background-color: transparent; }

/* =========================================
   06. مكونات الواجهة (Cards, Widgets, Boxes)
   ========================================= */
.card, .card-purchases-custom { border: none; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); margin-bottom: 20px; }
.card-custom { background: white; border: 1px solid #e0e0e0; border-radius: 6px; padding: 25px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); margin-bottom: 20px; }
.finance-card { background: #ffffff; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); padding: 2rem; margin-top: 1rem; }
.profile-card { background: white; padding: 25px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border-top: 4px solid #2980b9; margin-bottom: 20px; }
.form-card { background: white; border: 1px solid #e0e0e0; border-radius: 6px; padding: 30px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); max-width: 900px; margin: auto; }

.stat-card { background: white; border-radius: 6px; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); display: flex; align-items: center; border-right: 4px solid var(--accent-orange); margin-bottom: 20px; }
.stat-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-left: 15px; }
.stat-icon-danger { color: var(--danger-red); background-color: #f8d7da; }
.stat-icon-warning { color: var(--accent-orange); background-color: #fef3c7; }
.stat-details h5 { margin: 0; font-size: 14px; color: var(--text-muted); font-weight: bold; }
.stat-details h3 { margin: 5px 0 0 0; font-size: 22px; font-weight: bold; color: var(--primary-deep); }

.widget-box { flex: 1; min-width: 140px; background: white; border: 1px solid #e0e0e0; padding: 15px 10px; text-align: center; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); transition: 0.2s; }
.widget-box:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.05); }
.widget-title { font-size: 13px; color: #666; font-weight: bold; margin-bottom: 8px; }
.widget-value { font-size: 17px; color: var(--accent-green); font-weight: bold; }
.widget-box.cash-box { background-color: #fafffa; border-color: var(--accent-green); }
.widget-box.visa-box { background-color: #f7f9fc; border-color: #3498db; }
.widget-value.cash-value { color: #8e44ad; }
.widget-value.card-value { color: var(--primary-deep); }

.liquidity-summary-box, .liquidity-summary-styled { background: #f1f5f9; border-right: 5px solid var(--accent-teal); }
.total-box { background-color: #fff3cd; border: 1px solid #ffeeba; border-radius: 8px; padding: 25px; text-align: center; }
.total-amount { font-size: 32px; font-weight: bold; color: #856404; display: block; margin-top: 10px; }

.total-box {
    background-color: #2c3e50;
    border-radius: 14px;
    padding: 22px 16px;
    text-align: center;
}

.total-box .text-muted {
    color: #b6bfc7 !important;
    font-size: 0.95rem;
}

.total-box .damage-total-amount {
    display: block;
    font-size: 1.9rem;
    font-weight: 800;
    color: #c9971e;
    margin-top: 4px;
}
/* إصلاح محاذاة العناوين وأسهم الفرز في DataTables للغة العربية */
table.dataTable thead th,
table.dataTable thead td {
    text-align: right !important; /* محاذاة النص لليمين */
}

table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    padding-right: 12px !important; /* إزالة الفراغ الزائد من اليمين */
    padding-left: 30px !important;  /* تفريغ مساحة للأسهم على اليسار */
    position: relative;
}

/* نقل أسهم الفرز إلى يسار الخلية بدلاً من يمينها */
table.dataTable thead th.sorting::before,
table.dataTable thead th.sorting_asc::before,
table.dataTable thead th.sorting_desc::before,
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
    right: auto !important; /* إلغاء التثبيت الافتراضي من اليمين */
    left: 10px !important;  /* تثبيت الأسهم على اليسار */
}
/* =========================================
   07. الأزرار وصناديق البحث (Buttons & Search)
   ========================================= */
.pos-btn { background-color: white; color: var(--fluorite-dark); border: none; border-radius: 20px; padding: 6px 15px; font-size: 14px; font-weight: bold; transition: 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.pos-btn:hover { background-color: #f8f9fa; transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
/* إصلاح مشكلة اختفاء الأزرار عند تمرير الماوس (Hover) */
.btn-action-teal:hover, 
.btn-transfer:hover, 
.btn-transfer-submit:hover, 
.btn-teal-bg:hover {background-color: var(--fluorite-dark) !important; color: white !important; }

.btn-deposit:hover, 
.btn-action-green:hover, 
.btn-enable:hover, 
.btn-deposit-submit:hover,
.btn-green-bg:hover {background-color: var(--green-hover) !important; color: white !important;}
/* أزرار العمليات العامة */
.btn-teal-bg, .btn-action-teal, .btn-transfer, .btn-transfer-submit { background-color: var(--accent-teal); color: white; border: none; }
.btn-green-bg, .btn-action-green, .btn-deposit, .btn-enable, .btn-deposit-submit { background-color: var(--accent-green); color: white; border: none; }
.btn-orange-bg { background: var(--accent-orange); color: white; border: none; }
.btn-red-bg, .btn-disable { background: #fb0404; color: white; border: none; }
.btn-blue-bg { background: #3498db; color: white; border: none; }
.btn-cancel { background-color: #95a5a6; color: white; padding: 10px 30px; border: none; border-radius: 4px; text-decoration: none; display: inline-block; }
.btn-purple-custom { background-color: #8e44ad; color: white; }
/* أزرار الفلترة الحديثة (Toggle Buttons) */
.filter-toggle {background: var(--light-bg);padding: 5px;border-radius: 10px;display: inline-flex;margin-bottom: 15px;}

.filter-btn {padding: 8px 20px;border: none;border-radius: 8px;font-weight: 600;font-size: 0.9rem;cursor: pointer;transition: 0.2s;color: #64748b;background: transparent;}

.filter-btn.active {background: #ffffff;color: var(--primary-deep);box-shadow: 0 2px 4px rgba(0,0,0,0.05);}
/* أزرار الحفظ والنماذج */
.btn-save, .btn-save-items, .btn-save-exp, .btn-save-danger, .form-card-purchases .btn-save { 
    color: white; font-weight: bold; border: none; border-radius: 6px; transition: 0.3s; width: 100%; font-size: 18px; padding: 12px;
}
/* إضافة تأثير التمرير (Hover) للزر البنفسجي */
.btn-purple-custom:hover {
    background-color: #732d91 !important; /* لون بنفسجي أغمق قليلاً وأنيق */
    color: white !important;
}
.btn-save, .btn-save-items, .form-card-purchases .btn-save { background-color: var(--green-items); }
.btn-save:hover, .btn-save-items:hover, .form-card-purchases .btn-save:hover { background-color: var(--green-hover); box-shadow: 0 4px 8px rgba(0,0,0,0.2); transform: translateY(-2px); }
.btn-save-exp, .btn-save-danger { background-color: var(--orange-exp); }
.btn-save-exp:hover, .btn-save-danger:hover { background-color: var(--orange-hover); box-shadow: 0 4px 8px rgba(211,84,0,0.3); transform: translateY(-2px); }
.btn-save-exp, .btn-save-items { width: auto; font-size: 16px; padding: 10px 30px; border-radius: 4px; } /* Override for specific pages */

/* أزرار الجداول */
.btn-table-opt { font-weight: 600; color: white !important; transition: 0.2s; display: inline-flex; align-items: center; gap: 5px; border-radius: 6px; padding: 6px 12px; border: none; }
.btn-table-opt.btn-edit { background-color: #f39c12; }
.btn-table-opt.btn-edit:hover { background-color: #d68910; }
.btn-table-opt.btn-ledger { background-color: var(--accent-teal); }
.btn-table-opt.btn-ledger:hover { background-color: #16a085; }

/* صناديق البحث والفلترة */
.search-box { background: #f8f9fa; border: 1px solid #e0e0e0; padding: 15px; border-radius: 6px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 20px; direction: rtl; flex-wrap: nowrap; }
.search-box .input-group, .search-box > div, .search-box > .position-relative { flex: 1; min-width: 0; }
.search-box input, .search-box select { text-align: right !important; font-size: 14px; font-weight: bold; border: 2px solid #bdc3c7; }
.search-box input:focus { border-color: #2980b9; box-shadow: none; }
.search-box .btn-add-quick, .search-box button { white-space: nowrap; flex-shrink: 0; }
.btn-add-quick { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; padding: 0; }

.filter-section { background: white; border-top: 4px solid #3498db; border-radius: 4px; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); margin-bottom: 20px; }
.filter-title { font-size: 16px; font-weight: bold; color: var(--primary-deep); margin-bottom: 15px; }
.filter-section label { font-size: 13px; font-weight: bold; color: #555; margin-bottom: 5px; }
.form-control-custom { border-radius: 10px; padding: 12px; border: 1px solid #e2e8f0; }

/* =========================================
   08. الجداول العامة و DataTables
   ========================================= */
.table-container, .table-container-suppliers { background: white; border: 1px solid #ddd; border-top: 3px solid #00a65a; border-radius: 4px; padding: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-top: 20px; margin-bottom: 20px; }
.table-container-suppliers { border-top: 4px solid var(--fluorite-hover); padding: 25px; border-radius: 6px; }
.table-container-custom { min-height: 400px; padding-bottom: 50px; }

.flourite-table td, .flourite-table th { padding: 4px 8px !important; vertical-align: middle !important; font-size: 0.9rem !important; }
.flourite-table th { background-color: #f8f9fa !important; color: var(--text-muted) !important; }
.flourite-table th, .flourite-table td, .table th, .table td { white-space: nowrap; }

.table-professional { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.table-professional thead th { background: transparent; border: none; color: #94a3b8; font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 1px; padding: 12px; }
.table-professional tbody tr { background: #ffffff; transition: transform 0.2s; }
.table-professional tbody td { padding: 16px; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); color: var(--primary-deep); }
.table-professional tbody td:first-child { border-left: 1px solid var(--border-color); border-radius: 12px 0 0 12px; }
.table-professional tbody td:last-child { border-right: 1px solid var(--border-color); border-radius: 0 12px 12px 0; }

.table-sales th, .table-purchases th { background-color: #f8f9fa; color: #2f3640; font-size: 13px; text-align: center; border-bottom: 2px solid #ddd; }
.table-sales td, .table-purchases td { text-align: center; vertical-align: middle; font-size: 13px; padding: 12px 8px; }
.table-purchases input { text-align: center; border: 1px solid #ced4da; border-radius: 4px; padding: 5px; width: 100%; }

.table-damage th { background-color: var(--sidebar-bg) !important; color: white !important; text-align: center; vertical-align: middle; }
.table-damage td { vertical-align: middle; text-align: center; padding: 10px; }
.table-damage input { border: 1px solid #ced4da; border-radius: 4px; padding: 6px; width: 100%; text-align: center; transition: 0.3s; }
.table-damage input:focus { border-color: var(--danger-red); box-shadow: 0 0 5px rgba(231,76,60,0.3); outline: none; }
.table-damage input.text-start { text-align: right; }

.tfoot-row, .total-row { background-color: #eaeded; font-weight: bold; font-size: 14px; }
.total-row { background-color: #e2e3e5 !important; font-size: 15px; }
.clickable-cell, .clickable-row { cursor: pointer; transition: 0.15s; }
.row-hover:hover, .clickable-row:hover, .table tbody tr:hover td { background-color: #f8f9fa !important; }
.row-hover:hover .clickable-cell, .table-damage tbody tr:hover td { background-color: transparent !important; }
.purchases .clickable-row:hover { background-color: #f4f6f8 !important; }

/* إعادة تفعيل الماوس ليعمل تأثير التمرير (Hover) على كامل السطر */
#salesTable tbody tr, 
#purchasesTable tbody tr { 
    pointer-events: auto !important; 
}

/* تفعيل تأثير اللون عند تمرير الماوس */
#salesTable tbody tr:hover td, 
#purchasesTable tbody tr:hover td { 
    background-color: #f1f2f6 !important; 
}

/* إخفاء مؤشر النقر (شكل اليد) عن الخلايا العادية لكي لا تبدو قابلة للنقر */
#salesTable tbody td, 
#purchasesTable tbody td { 
    cursor: default !important; 
}

/* إظهار مؤشر النقر (شكل اليد) حصراً عند الوقوف فوق الروابط والأزرار */
#salesTable tbody td a, 
#salesTable tbody td button, 
#salesTable tbody td .dropdown-toggle, 
#salesTable tbody td .dropdown-menu,
#purchasesTable tbody td a, 
#purchasesTable tbody td button, 
#purchasesTable tbody td .dropdown-toggle, 
#purchasesTable tbody td .dropdown-menu { 
    cursor: pointer !important; 
}

/* إصلاحات DataTables */
.dataTables_scrollFoot { display: none !important; }
.dataTables_scrollBody { border-bottom: 0 !important; }
/* إعادة تفعيل التمرير الأفقي للجداول مع الحفاظ على مساحة سفلية للقوائم المنسدلة */
.table-responsive, .dataTables_scrollBody, .dataTables_wrapper {
   overflow-x: auto !important;
}

/* تطبيق الارتفاع على الجداول العادية فقط واستثناء النوافذ المنبثقة (Modals) */
.table-responsive:not(.modal .table-responsive), 
.dataTables_scrollBody:not(.modal .dataTables_scrollBody) {
    min-height: 300px;
    padding-bottom: 60px;
}

/* إزالة أي ارتفاع أو فراغ زائد للجداول داخل النوافذ المنبثقة (متوافق مع كل المتصفحات) */
.modal .table-responsive {
    min-height: 0 !important;
    padding-bottom: 0 !important;
}
/* عرض الأعمدة */
.col-width-50 { width: 50px; } .col-code { width: 80px; } .col-width-100 { width: 100px; } .col-actions, .damage-table-options-col { width: 150px; }
.col-width-15-pct, .col-qty, .col-tax, .col-total, .col-cost, .th-qty, .th-unit-price, .th-total, .damage-items-col-qty, .edit-modal-items-col-qty, .edit-modal-items-col-cost { width: 15%; }
.col-width-20-pct, .role-table-header-section { width: 20%; }
.col-width-25-pct, .damage-table-reason-col, .damage-items-col-price, .damage-items-col-total, .edit-modal-items-col-total, .th-reason, .th-material-name { width: 25%; }
.col-width-35-pct, .edit-modal-items-col-material { width: 35%; }
.col-width-40-pct, .col-item-name { width: 40%; }
.col-delete, .th-options, .edit-modal-items-col-delete { width: 10%; }

/* =========================================
   09. النوافذ المنبثقة والقوائم (Modals & Dropdowns)
   ========================================= */
.modal-content-custom { border-radius: 20px; border: none; overflow: hidden; }
.modal-header-styled { padding: 1.5rem; color: white; border: none; }
.modal-body-styled { padding: 2rem; }
.modal-header-teal, .modal-header-teal-styled, .modal-header-styled-teal { background-color: var(--accent-teal); color: white; }
.modal-header-green, .modal-header-green-styled { background-color: var(--accent-green); color: white; }
.modal-header-purple { background-color: #8e44ad; color: white; }
.modal-footer-transfer { border: none; }

.dropdown-menu { position: absolute !important; z-index: 9999 !important; box-shadow: 0 4px 6px rgba(0,0,0,0.1) !important; }
.btn-options { background: #fff; border: 1px solid #e9ecef; color: #495057; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 6px; }
.btn-options:hover { background: #f8f9fa; border-color: #dee2e6; color: #212529; }
.dropdown-pro { border-radius: 10px !important; padding: 6px !important; min-width: 190px !important; border: 1px solid #eef0f2 !important; box-shadow: 0 8px 24px rgba(0,0,0,0.08) !important; text-align: right; }
.dropdown-pro .dropdown-item { font-size: 12.5px; font-weight: 500; padding: 8px 12px; border-radius: 6px; display: flex; align-items: center; gap: 8px; color: #495057; transition: all 0.15s; }
.dropdown-pro .dropdown-item i { width: 16px; text-align: center; font-size: 12px; }
.dropdown-pro .dropdown-item:hover { background: #f6f8f9; color: #212529; }
.dropdown-pro .item-edit { color: #0d6efd; } .dropdown-pro .item-edit:hover { background: #eef5ff; color: #0b5ed7; }
.dropdown-pro .item-history { color: #212529; } .dropdown-pro .item-history:hover { background: #f1f3f5; }
.dropdown-pro .item-delete { color: #c0392b; } .dropdown-pro .item-delete:hover { background: #fdf0ef; color: #a93226; }
.dropdown-pro .dropdown-divider { margin: 6px 0; border-color: #f1f3f5; }

/* =========================================
   10. تخصيصات الوحدات - عناوين الصفحات (Unified Page Headers)
   ========================================= */
.header-purchases, .header-suppliers, .header-items, .header-exp, .header-expense-cat, .header-damage-screen, .header-customers {
    color: white; height: 60px; display: flex; align-items: center; padding: 0 20px; margin-bottom: 20px; border-radius: 6px; 
}
.header-purchases, .header-suppliers, .header-items { background-color: var(--fluorite-hover); }
.header-exp, .header-damage-screen { background-color: var(--orange-exp); box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.header-expense-cat { background-color: var(--danger-red); }
.header-customers { background-color: #2980b9; justify-content: space-between; }

/* =========================================
   11. تخصيصات الوحدات - لوحة القيادة، الفواتير، الملفات (Modules Specifics)
   ========================================= */
/* Dashboard */
.dashboard-container { padding: 10px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
.widgets-container { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 25px; }
.table-title { font-size: 15px; font-weight: bold; margin-bottom: 15px; display: flex; align-items: center; gap: 8px; }
.table-title.sales { color: #e67e22; } .table-title.purchases { color: #34495e; } .table-title.alerts { color: var(--danger-red); }
.dashboard-table-wrap { max-height: 235px; overflow-y: auto; border: 1px solid #eee; border-radius: 4px; }
.dashboard-table-wrap .table th { background-color: #f8f9fa; position: sticky; top: 0; z-index: 10; border-bottom: 2px solid #dee2e6; text-align: center; font-size: 13px; color: #333; }
.dashboard-table-wrap .table td { vertical-align: middle; text-align: center; font-size: 13px; }
#periodFilter { width: 160px; cursor: pointer; }
.chart-container, .damage-chart-container { position: relative; height: 250px; }
.report-container .chart-container { height: 350px; }

/* Invoice Details & Visuals */
.invoice-wrapper { background: var(--bg-body); min-height: 100vh; padding: 20px 12px; font-family: 'Cairo', sans-serif; }
.invoice-preview { background: #fff; padding: 15mm; border: 1px solid #e9ecef; max-width: 210mm; margin: 0 auto; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.preview-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 15px; margin-top: 15px; align-items: start; }
.info-box, .totals-box { border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; font-size: 12px; }
.info-box { background: #f8fafc; } .totals-box { background: #fff; }
.grand-total-bar-purchase { display: flex; justify-content: space-between; align-items: center; background-color: var(--fluorite-hover); color: #fff; border-radius: 6px; padding: 10px 18px; margin: 10px; font-size: 15px; }
.due-bar-purchase { display: flex; justify-content: space-between; align-items: center; background-color: #fdf2f2; border: 1px solid #f5c6cb; border-radius: 6px; padding: 10px 18px; margin-top: 8px; font-size: 16px; }

/* History Stats Box */
.history-stats-box { border-left: 4px solid transparent; background: #fff; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.history-stats-box.purchases-stat { border-left-color: #0d6efd; }
.history-stats-box.sales-stat { border-left-color: #198754; }
.history-stats-box.damaged-stat { border-left-color: #d39c0f; }
.history-stats-box.current-stat { border-left-color: var(--primary-deep); }
.history-stats-box .stat-title { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.history-stats-box .stat-value { font-size: 16px; font-weight: 700; }

/* Profile, Eye Exam, Customers */
.nav-tabs, .cash-flow-tabs, .nav-tabs-divider { border-bottom: 2px solid #e0e0e0; }
.nav-tabs .nav-link { color: #7f8c8d; font-weight: bold; border: none; padding: 12px 20px; transition: 0.3s; }
.nav-tabs .nav-link:hover { color: #2980b9; background-color: #f8f9fa; border-radius: 6px 6px 0 0; }
.nav-tabs .nav-link.active { color: #2980b9; border-bottom: 3px solid #2980b9; background: transparent; }
.eye-wrapper { border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; overflow: hidden; margin-bottom: 0; }
.eye-exam-table { width: 100%; border-collapse: collapse; table-layout: fixed; direction: ltr !important; font-family: 'Inter', sans-serif; }
.eye-exam-table th { background: #f8fafc; font-size: 11px; font-weight: 700; padding: 8px 6px; text-align: center; border-bottom: 1px solid #e5e7eb; color: #475569; vertical-align: middle; }
.eye-exam-table td { font-size: 12px; padding: 8px 6px; text-align: center; border-bottom: 1px solid #e5e7eb; color: var(--primary-deep); vertical-align: middle; font-weight: bold; }
.supplier-link, .customer-link, .invoice-click, .ref-link { font-weight: bold; text-decoration: none; cursor: pointer; transition: 0.2s; }
.supplier-link { color: var(--accent-green); } .supplier-link:hover { text-decoration: underline; color: #1e8449; }
.customer-link, .invoice-click { color: #2980b9; } .customer-link:hover, .invoice-click:hover { text-decoration: underline; color: #1f618d; }
.ref-link { color: #3498db; } .ref-link:hover { text-decoration: underline; color: var(--accent-orange); }

/* Ledger Page */
.ledger-page-wrapper { padding: 20px; background-color: transparent; min-height: 100vh; }
.panel-card { background: white; border: 1px solid #ddd; border-radius: 4px; padding: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); height: 100%; }
.panel-card.border-top-warning, .panel-card.panel-card-warning { border-top: 3px solid #f39c12; }
.panel-card.border-top-primary, .panel-card.panel-card-primary { border-top: 3px solid #3c8dbc; }
.panel-title { font-weight: bold; font-size: 16px; margin-bottom: 15px; color: #333; display: flex; align-items: center; justify-content: space-between; }
.info-row { display: flex; justify-content: space-between; border-bottom: 1px solid #f4f4f4; padding: 12px 0; }
.info-row:last-child { border-bottom: none; }
.info-label { font-weight: bold; color: #555; }
.system-locked { font-size: 11px; color: #7f8c8d; background-color: #f1f2f6; padding: 4px 8px; border-radius: 4px; border: 1px dashed #bdc3c7; display: inline-block; }

/* =========================================
   12. صفحة تسجيل الدخول (Login Glassmorphism)
   ========================================= */
body.login-body { 
    background-color: #f4f9f9;
    background-image: radial-gradient(at 10% 20%, rgba(26, 188, 156, 0.15) 0px, transparent 50%), radial-gradient(at 90% 10%, rgba(52, 152, 219, 0.15) 0px, transparent 50%), radial-gradient(at 50% 50%, rgba(255, 255, 255, 0.8) 0px, transparent 50%), radial-gradient(at 20% 90%, rgba(41, 128, 185, 0.15) 0px, transparent 50%), radial-gradient(at 80% 90%, rgba(26, 188, 156, 0.15) 0px, transparent 50%);
    background-attachment: fixed; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
}
.login-card { max-width: 420px; width: 100%; padding: 45px 40px; border-radius: 24px; background: rgba(255, 255, 255, 0.55); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border: 1px solid rgba(255, 255, 255, 0.8); box-shadow: 0 15px 35px rgba(0,0,0,0.05), 0 5px 15px rgba(26,188,156,0.08); position: relative; overflow: hidden; }
.login-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent); }
.brand-icon { font-size: 55px; color: #1abc9c; margin-bottom: 15px; text-shadow: 0 4px 10px rgba(26,188,156,0.3); }
.shop-name { color: var(--primary-deep) !important; }
.logo-img { max-height: 90px; border-radius: 12px; box-shadow: 0 8px 20px rgba(0,0,0,0.06); background: white; padding: 5px; transition: transform 0.3s ease; }
.logo-img:hover { transform: scale(1.03); }
.login-card .input-group-text, .login-card .form-control { padding: 14px 15px; background-color: rgba(255, 255, 255, 0.6); border: 1px solid rgba(255, 255, 255, 0.9); color: var(--primary-deep); font-size: 0.95rem; }
.login-card .form-control:focus, .login-card .form-control:focus + .input-group-text, .login-card .input-group:focus-within .input-group-text { border-color: #1abc9c; background-color: rgba(255, 255, 255, 0.95); box-shadow: none; }
.login-card .input-group:focus-within { box-shadow: 0 0 0 0.25rem rgba(26, 188, 156, 0.15); border-radius: 8px; }
.btn-login { background: linear-gradient(135deg, #1abc9c, #16a085); color: white; padding: 14px; font-weight: bold; font-size: 1.05rem; border-radius: 10px; border: none; transition: all 0.3s ease; box-shadow: 0 6px 15px rgba(26, 188, 156, 0.25); letter-spacing: 0.5px; }
.btn-login:hover { background: linear-gradient(135deg, #16a085, #148f77); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(26, 188, 156, 0.35); }

/* =========================================
   13. شاشة نقطة البيع المعزولة (Isolated POS System)
   ========================================= */
body.pos-body { background-color: #ecf0f1; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; height: 100vh; overflow: hidden; }

.select2-results__options { max-height: 160px !important; overflow-y: auto; }
.input-group .select2-container { flex: 1 1 auto; width: 1% !important; }
.select2-container .select2-selection--single { height: 31px !important; display: flex; align-items: center; border: 1px solid #ced4da; border-radius: 0; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 100%; top: 0; }

.pos-header { background-color: #2c3e50; color: white; padding: 10px 20px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.1); flex-wrap: nowrap; gap: 10px; }
.pos-header a { color: white; text-decoration: none; font-weight: bold; background: #e74c3c; padding: 5px 15px; border-radius: 4px; white-space: nowrap; }
.header-title { font-size: 18px; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-user-info { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

.pos-container { display: flex; height: calc(100vh - 55px); padding: 10px; gap: 10px; position: relative; }
.pos-products-pane { flex: 6; background: white; border-radius: 6px; display: flex; flex-direction: column; box-shadow: 0 0 10px rgba(0,0,0,0.05); z-index: 1050; }
.products-toolbar { padding: 10px; border-bottom: 1px solid #ddd; background: #f8f9fa; border-radius: 6px 6px 0 0; }
.products-grid { padding: 10px; overflow-y: auto; flex-grow: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; align-content: start; background-color: #f4f6f9;}

.product-card { background: white; border: 1px solid #dcdde1; border-radius: 6px; padding: 8px; text-align: center; cursor: pointer; transition: 0.1s; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
.product-card:active { transform: scale(0.95); border-color: #3498db; }
.product-card .fa-box { font-size: 1.5rem !important; margin-bottom: 5px !important; }
.product-card .title { font-size: 11px; font-weight: bold; color: #2c3e50; height: 32px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2 ; -webkit-box-orient: vertical; margin-bottom: 2px;}
.product-card .price { font-size: 12px; color: #27ae60; font-weight: bold; margin-top: 2px; }

.pos-cart-pane { flex: 4; background: white; border-radius: 6px; display: flex; flex-direction: column; box-shadow: 0 0 10px rgba(0,0,0,0.05); }
.cart-toolbar { padding: 10px; border-bottom: 1px solid #ddd; background: #f8f9fa; border-radius: 6px 6px 0 0; }
.cart-table-wrapper { flex-grow: 1; overflow-y: auto; padding: 0; }
.cart-table { width: 100%; font-size: 14px; margin-bottom: 0;}
.cart-table th { background: #f1f2f6; position: sticky; top: 0; text-align: center; padding: 10px; color: #2f3640; border-bottom: 2px solid #ddd;}
.cart-table td { vertical-align: middle; text-align: center; border-bottom: 1px solid #eee; padding: 8px; }

.cart-input { width: 65px; text-align: center; border: 1px solid #ccc; border-radius: 4px; padding: 3px; font-weight: bold; transition: 0.2s;}
.cart-input:focus { border-color: #3498db; outline: none; box-shadow: 0 0 3px rgba(52, 152, 219, 0.5); }
.remove-btn { color: #e74c3c; cursor: pointer; font-size: 18px; }

.cart-footer { border-top: 2px solid #ddd; background: #fdfdfd; padding: 10px; border-radius: 0 0 6px 6px; }
.summary-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; font-weight: bold; color: #555; }

.total-box { background: #2c3e50; color: white; font-size: 22px; width: 100%; text-align: center; padding: 10px; border-radius: 4px; margin-bottom: 10px;}
.payment-buttons { display: flex; gap: 10px; margin-top: 10px; }
.btn-cancel { background-color: #c0392b; color: white; font-weight: bold; border: none; border-radius: 4px; padding: 10px; flex: 1; transition: 0.2s;}
.btn-pay-master { background-color: #27ae60; color: white; font-weight: bold; font-size: 18px; border: none; border-radius: 4px; padding: 10px; flex: 3; transition: 0.2s;}

.btn-toggle-products { display: none; }
.mobile-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1040; }

.exam-table { table-layout: auto; width: 100%; }
.exam-table th { background-color: #f8f9fa; font-size: 13px; color: #555; padding: 8px 4px; white-space: nowrap; }
.exam-table td { padding: 4px; border: 1px solid #ddd; }
.exam-input { width: 100%; min-width: 50px; max-width: 80px; border: 1px solid #ced4da; border-radius: 4px; text-align: center; font-size: 14px; font-weight: bold; direction: ltr; padding: 4px; margin: 0 auto; display: block; }
.exam-input:focus { border-color: #3498db; outline: none; box-shadow: 0 0 3px rgba(52, 152, 219, 0.4); }

.header-user-name { font-weight: bold; font-size: 14px; }

/* =========================================
   14. الطباعة (@media print)
   ========================================= */
@media print {
    /* بـ pos.html بس: خفي كل شي إلا #thermalReceipt */
    body.pos-print-page * { visibility: hidden; }
    .print-section, .print-section * { visibility: visible; }
    .print-section { position: absolute; left: 0; top: 0; width: 100%; }
    .no-print { display: none !important; }
    .pos-header, .pos-container, .modal, .modal-backdrop, .btn-toggle-products { display: none !important; }
    #thermalReceipt, #thermalReceipt * { visibility: visible; }
    #thermalReceipt { position: absolute; left: 0; top: 0; width: 80mm; padding: 10px; font-family: sans-serif; font-size: 13px; color: black; }
    .receipt-header { text-align: center; border-bottom: 1px dashed black; padding-bottom: 10px; margin-bottom: 10px; }
    .receipt-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
    .receipt-table th, .receipt-table td { padding: 4px 0; border-bottom: 1px dashed #ccc; text-align: center; }
    .receipt-total { border-top: 1px solid black; padding-top: 5px; font-weight: bold; font-size: 15px; }
    
    /* 🔥 الحل: بصفحات التقارير (اللي ما عليها pos-print-page)، اظهر كل شي عادي */
    body:not(.pos-print-page) * { visibility: visible !important; }
    body:not(.pos-print-page) .no-print { display: none !important; }
}
/* =========================================
   15. شاشات الجوال والتجاوب (@media max-width: 768px)
   ========================================= */
@media (max-width: 768px) {
    /* النظام العام */
    body { padding-bottom: 65px; } 
    .sidebar { transform: translateX(100%); }
    .sidebar.active { transform: translateX(0); }
    #mainContent { margin-right: 0; padding: 10px; min-width: 0 !important; overflow-x: hidden; }
    .header { padding: 0 15px; margin-bottom: 15px; }
    .bottom-nav { display: flex; }
    .desktop-pos-btn, .desktop-user-name { display: none; } 
    .nav-tabs .nav-link { font-size: 0.85rem; padding: 10px 12px; }

    /* الجداول العامة */
    .table-responsive { overflow-x: auto !important; overflow-y: visible !important; touch-action: auto; }
    .flourite-table th[style*="width"], .flourite-table td[style*="width"], .table th[style*="width"], .table td[style*="width"] { width: auto !important; }
    #mainAccountsTable th:nth-child(2), #mainAccountsTable td:nth-child(2), #mainAccountsTable th:nth-child(4), #mainAccountsTable td:nth-child(4) { display: none; }
    
    /* أزرار الجدول والموبايل */
    .btn-table-opt, .btn-add-mobile { font-size: 0 !important; width: 36px; height: 36px; padding: 0 !important; display: inline-flex !important; justify-content: center; align-items: center; border-radius: 8px; }
    .btn-table-opt i, .btn-add-mobile i { font-size: 14px !important; margin: 0 !important; }
    .btn-add-mobile span { display: none !important; }
    .mobile-hide-btn { display: none !important; }

    /* مكونات الإحصائيات (Widgets) */
    .widgets-container { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important; gap: 15px; padding-bottom: 15px; width: 100%; }
    .widget-box { flex: 0 0 auto !important; min-width: 160px; }
    .card-header-custom { flex-direction: column; align-items: flex-start; gap: 15px; }
    .action-group { flex-wrap: wrap; width: 100%; gap: 8px; }

    /* ترتيب DataTables للموبايل */
   /* ترتيب DataTables للموبايل - التوزيع النهائي */
    .dataTables_wrapper .d-flex.flex-wrap { 
        align-items: center !important; 
        justify-content: space-between !important;
    }
    
    /* 1. إظهار المدخلات (أقصى اليمين - نصف الشاشة) */
    .dataTables_wrapper .dataTables_length { 
        order: 1 !important; 
        flex: 0 0 50% !important; 
        max-width: 50% !important; 
        margin-bottom: 12px !important; 
        display: flex !important;
        justify-content: flex-start !important; /* يدفع المحتوى لليمين */
    }
    
    /* 2. حاوية الأزرار (أقصى اليسار - النصف الآخر) */
    .dataTables_wrapper .dt-buttons { 
        order: 2 !important; 
        display: flex !important; 
        flex: 0 0 50% !important; 
        max-width: 50% !important; 
        margin-bottom: 12px !important; 
        justify-content: flex-end !important; /* يدفع الزر لليسار */
        gap: 8px !important;
    }
    
    /* ضبط حجم زر "الأعمدة" مع الإبقاء على النص */
    .dataTables_wrapper .dt-buttons .btn { 
        padding: 4px 10px !important; 
        font-size: 12px !important; /* تصغير الخط ليتناسب مع الموبايل */
        min-height: 32px !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }
    
    .dataTables_wrapper .dt-buttons .btn span { 
        pointer-events: none !important; 
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }
    
    /* إخفاء التصدير والطباعة من الموبايل نهائياً */
    .dataTables_wrapper .dt-buttons .buttons-excel,
    .dataTables_wrapper .dt-buttons .buttons-print {
        display: none !important;
    }
    
    /* 3. حقل البحث يأخذ سطراً كاملاً بالأسفل */
    .dataTables_wrapper .dataTables_filter { 
        order: 3 !important; 
        flex: 0 0 100% !important; 
        max-width: 100% !important; 
        margin-top: 0 !important; 
    }
    
    .dataTables_wrapper .dataTables_filter label { 
        width: 100% !important; 
        display: flex !important; 
        align-items: center !important; 
        gap: 10px !important; 
    }
    
    .dataTables_wrapper .dataTables_filter input { 
        width: 100% !important; 
        flex-grow: 1 !important; 
        margin: 0 !important; 
        max-width: none !important; 
    }
    /* نقطة البيع (POS) موبايل */
    .pos-header { padding: 8px 10px; }
    .header-title { font-size: 14px; max-width: 45%; }
    .pos-header a { padding: 4px 10px; font-size: 12px; }
    .header-user-info span { font-size: 12px !important; }
    #liveTime { display: none; }
    .pos-container { display: block; padding: 5px; }
    .pos-cart-pane { height: 100%; width: 100%; }
    .pos-products-pane { position: fixed; top: 55px; right: -100%; width: 85%; height: calc(100vh - 55px); transition: right 0.3s ease-in-out; border-radius: 0; box-shadow: -5px 0 15px rgba(0,0,0,0.2); }
    .pos-products-pane.show-mobile { right: 0; }
    .mobile-overlay.show-overlay { display: block; }
    .btn-toggle-products { display: flex; flex-direction: column; position: fixed; top: 50%; right: 0; transform: translateY(-50%); background-color: #3498db; color: white; border: none; padding: 15px 5px; border-radius: 8px 0 0 8px; z-index: 1030; cursor: pointer; box-shadow: -2px 0 5px rgba(0,0,0,0.2); align-items: center; justify-content: center; }
    .btn-toggle-products span { writing-mode: vertical-rl; text-orientation: mixed; font-size: 13px; font-weight: bold; margin-top: 5px; }
    .custom-purchase-table {table-layout: auto;}
    /* إخفاء أزرار التصدير والطباعة الخاصة بـ DataTables على شاشات الهواتف فقط */
    #itemSearchInput {
        /* هذه التعليمة السحرية تجبر متصفح الجوال على رسم قائمة بيضاء صلبة */
        color-scheme: light !important; 
        background-color: #ffffff !important;
        color: #000000 !important;
    }

    /* محاولة إجبار بعض المتصفحات العنيدة على تلوين الخيارات */
    datalist#itemsDataList,
    datalist#itemsDataList option {
        background-color: #ffffff !important;
        color: #000000 !important;
    }
}
/* =========================================
   46. تنسيق جدول إضافة المشتريات المخصص
   ========================================= */
.custom-purchase-table {
    table-layout: fixed;
    width: 100%;
    min-width: 600px; /* لحماية الجدول من الانهيار في الشاشات الصغيرة */
}

/* توزيع النسب المئوية للأعمدة بشكل دقيق */
.custom-purchase-table th.col-name { width: 40%; }
.custom-purchase-table th.col-qty { width: 12%; }
.custom-purchase-table th.col-cost { width: 15%; }
.custom-purchase-table th.col-tax { width: 12%; }
.custom-purchase-table th.col-total { width: 15%; }
.custom-purchase-table th.col-delete { width: 6%; }

/* منع حقول الإدخال من التمدد خارج الخلايا */
.custom-purchase-table td input {
    width: 100% !important;
    min-width: 40px; 
}

/* تنسيقات العرض المصغر لصور صفحة الإعدادات */

.shop-logo-image {
    max-width: 150px;        /* أقصى عرض للشعار */
    max-height: 150px;       /* أقصى ارتفاع للشعار */
    width: auto;
    height: auto;
    object-fit: contain;     /* يحافظ على أبعاد الصورة دون تمطيط */
    border-radius: 8px;      /* حواف دائرية ناعمة */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* ظل خفيف لإبراز الشعار */
}

.background-image-preview {
    max-width: 100%;         /* يأخذ أقصى عرض متاح في المربع */
    max-height: 250px;       /* لا يتجاوز هذا الارتفاع لتوفير المساحة */
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.history-stats-box { padding: 15px; border-radius: 8px; border: 2px solid; text-align: center; background: #fff; height: 100%; }
.history-stats-box .stat-title { display: block; font-size: 0.95rem; color: #6c757d; font-weight: bold; margin-bottom: 8px; }
.history-stats-box .stat-value { display: block; font-size: 1.3rem; font-weight: 900; }
.history-modal-content { border-radius: 12px; }
.history-modal-body { background: #f6f8f9 !important; }
.history-stat-purchases { border-left-color: #0d6efd; }
.history-stat-sales { border-left-color: #198754; }
.history-stat-damaged { border-left-color: #d39c0f; }
.history-stat-current { border-left-color: #212529; background: #fff; }
.history-stat-sales .stat-value { color: #198754; }
.history-stat-damaged .stat-value { color: #8a6d00; }


    .header-items { background-color: #8e44ad; color: white; height: 60px; display: flex; align-items: center; padding: 0 20px; margin-bottom: 20px; border-radius: 6px; }
    .table-container { background: white; border: 1px solid #e0e0e0; border-top: 4px solid #8e44ad; padding: 25px; border-radius: 6px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); margin-bottom: 20px; }
    .table th { background-color: #f8f9fa; text-align: center; font-size: 14px; color: #34495e; border-bottom: 2px solid #dee2e6; vertical-align: middle; }
    .table td { text-align: center; vertical-align: middle; font-size: 14px; transition: 0.2s; }
    .table tbody tr:hover td { background-color: #f1f2f6; }
    
    /* الفلاتر */
    .filters-box { background: #f8f9fa; border: 1px solid #e0e0e0; padding: 20px; border-radius: 8px; margin-bottom: 20px; }
    .filters-box label { font-size: 13px; font-weight: bold; color: #7f8c8d; margin-bottom: 5px; }
    
    /* تنسيق كروت إحصائيات السجل */
    .history-stats-box { border-left: 4px solid #8e44ad; padding: 15px; background: #fafafa; border-radius: 6px; margin-bottom: 15px; text-align: center; box-shadow: inset 0 0 5px rgba(0,0,0,0.02); }
    .stat-title { font-size: 13px; font-weight: bold; color: #7f8c8d; display: block; margin-bottom: 5px; }
    .stat-value { font-size: 18px; font-weight: bold; color: #2c3e50; }

    .history-stats-box{
    background:#fff;
    border:1px solid #e9ecef;
    border-left:4px solid #dee2e6;
    border-radius:8px;
    padding:12px 14px;
    height:100%;
    }
    .history-stats-box .stat-title{font-size:11px;color:#6c757d;display:block;margin-bottom:4px;}
    .history-stats-box .stat-value{font-size:14px;font-weight:700;}
    .table-history-wrapper{
    max-height:460px;
    overflow-y:auto;
    border:1px solid #e9ecef;
    border-radius:8px;
    }
    .table-history-wrapper thead th{
    position:sticky;
    top:0;
    background:#f8f9fa;
    z-index:2;
    font-size:11px;
    font-weight:700;
    color:#495057;
    border-bottom:2px solid #dee2e6 !important;
    }
    .table-history-wrapper tbody td{
    font-size:12px;
    vertical-align:middle;
    padding:8px 6px;
    }
    .type-sales{color:#c0392b !important; font-weight:600;}
    .type-purchases{color:#1e8449 !important; font-weight:600;}
    .type-damaged{color:#a56902 !important; font-weight:600;}
