/* 
 * POS COMPACT TABLE - نسخة مدمجة ومضغوطة للجدول
 * أولوية قصوى لضمان التطبيق
 */

/* ==========================================
 * QUANTITY CONTAINER - مربع الكمية المدمج والصغير
 * ========================================== */

table#pos_table .pos-qty-container,
#pos_table tbody .pos-qty-container,
.pos-qty-container {
    display: inline-flex !important;
    align-items: center !important;
    background: white !important;
    border: 2px solid #dfe4ea !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    max-width: 110px !important;
    width: auto !important;
    margin: 0 !important;
    vertical-align: middle !important;
}

table#pos_table .pos-qty-btn,
#pos_table tbody .pos-qty-btn,
.pos-qty-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border: none !important;
    color: #495057 !important;
    padding: 3px 5px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-size: 11px !important;
    min-width: 24px !important;
    width: 24px !important;
    height: 26px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

table#pos_table .pos-qty-minus,
#pos_table tbody .pos-qty-minus,
.pos-qty-minus {
    border-right: 2px solid #dfe4ea !important;
}

table#pos_table .pos-qty-minus i,
#pos_table tbody .pos-qty-minus i {
    color: #dc3545 !important;
}

table#pos_table .pos-qty-plus,
#pos_table tbody .pos-qty-plus,
.pos-qty-plus {
    border-left: 2px solid #dfe4ea !important;
}

table#pos_table .pos-qty-plus i,
#pos_table tbody .pos-qty-plus i {
    color: #28a745 !important;
}

table#pos_table .pos-qty-input,
#pos_table tbody .pos-qty-input,
.pos-qty-input {
    flex: 1 !important;
    border: none !important;
    text-align: center !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 3px 4px !important;
    background: transparent !important;
    min-width: 35px !important;
    max-width: 55px !important;
    height: 26px !important;
    line-height: 1 !important;
}

table#pos_table .pos-qty-btn i,
#pos_table tbody .pos-qty-btn i {
    font-family: 'Font Awesome 6 Free', 'FontAwesome' !important;
    font-weight: 900 !important;
    font-size: 10px !important;
    line-height: 1 !important;
}

/* ==========================================
 * SUB UNIT - الوحدة بجانب الكمية (INLINE)
 * ========================================== */

/* جعل الوحدة على نفس السطر */
table#pos_table td:nth-child(2),
#pos_table tbody td:nth-child(2) {
    white-space: nowrap !important;
}

/* إخفاء <br> تماماً */
table#pos_table td:nth-child(2) br,
#pos_table tbody td:nth-child(2) br {
    display: none !important;
    content: '' !important;
    height: 0 !important;
    line-height: 0 !important;
}

/* قائمة الوحدة inline */
table#pos_table select.sub_unit,
#pos_table tbody select.sub_unit {
    font-size: 11px !important;
    padding: 3px 5px !important;
    margin: 0 0 0 6px !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    display: inline-block !important;
    vertical-align: middle !important;
    max-width: 85px !important;
    height: 26px !important;
    line-height: 1 !important;
}

/* ==========================================
 * REDUCE ROW HEIGHT - تقليل ارتفاع الصف
 * ========================================== */

/* تقليل ارتفاع الصفوف */
table#pos_table tbody tr,
#pos_table tbody tr.product_row {
    height: auto !important;
    min-height: 38px !important;
    max-height: 50px !important;
}

/* تقليل padding */
table#pos_table th,
table#pos_table td,
#pos_table tbody th,
#pos_table tbody td {
    padding: 4px 5px !important;
    vertical-align: middle !important;
    line-height: 1.2 !important;
}

/* تقليل حجم النص */
table#pos_table td:first-child,
#pos_table tbody td:first-child {
    font-size: 12px !important;
    line-height: 1.3 !important;
    padding: 4px 6px !important;
}

/* تقليل المسافة بين اسم المنتج و SKU */
table#pos_table td:first-child br,
#pos_table tbody td:first-child br {
    line-height: 0.5 !important;
}

/* ==========================================
 * INPUTS - تصغير الحقول
 * ========================================== */

table#pos_table input.pos_unit_price_inc_tax,
table#pos_table input.pos_line_total,
#pos_table tbody input.pos_unit_price_inc_tax,
#pos_table tbody input.pos_line_total {
    font-size: 12px !important;
    padding: 3px 5px !important;
    height: 26px !important;
    line-height: 1.2 !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
}

/* ==========================================
 * COLUMN WIDTHS - عرض الأعمدة
 * ========================================== */

/* عمود الكمية - يسع الكمية + الوحدة - محاذاة لليسار */
table#pos_table th:nth-child(2),
table#pos_table td:nth-child(2) {
    width: 210px !important;
    max-width: 210px !important;
    padding: 4px 6px !important;
    text-align: right !important;
    direction: rtl !important;
}

/* عمود المنتج - أكبر حجم */
table#pos_table th:first-child,
table#pos_table td:first-child {
    min-width: 300px !important;
    width: auto !important;
}

/* عمود سعر الوحدة */
table#pos_table th:nth-child(3),
table#pos_table td:nth-child(3) {
    width: 95px !important;
    max-width: 95px !important;
}

/* عمود المجموع */
table#pos_table th:nth-child(4),
table#pos_table td:nth-child(4) {
    width: 95px !important;
    max-width: 95px !important;
}

/* ==========================================
 * REMOVE SHADOWS - إزالة الظلال
 * ========================================== */

table#pos_table tbody tr.product_row,
#pos_table tbody tr.product_row {
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
    background-color: #fff !important;
    border-bottom: 1px solid #e9ecef !important;
}

/* ==========================================
 * HIDE OLD BUTTONS - إخفاء الأزرار القديمة
 * ========================================== */

table#pos_table .input-group.input-number,
#pos_table tbody .input-group.input-number {
    display: none !important;
}

table#pos_table .quantity-up,
table#pos_table .quantity-down,
#pos_table tbody .quantity-up,
#pos_table tbody .quantity-down {
    display: none !important;
}

table#pos_table .input-group-btn,
#pos_table tbody .input-group-btn {
    display: none !important;
}
