/* 
 * POS Totals Fix - إصلاح أزرار المجاميع والخصم والضريبة
 * حل مشكلة الأزرار المختفية في الأسفل
 */

/* ==========================================
 * TABLE WRAPPER - جعل الجدول قابل للعرض
 * ========================================== */

/* Container للجدول */
.pos_product_div {
    overflow-x: auto !important;
    overflow-y: visible !important;
}

/* جدول المنتجات */
#pos_table {
    width: 100% !important;
    table-layout: auto !important;
}

/* ==========================================
 * TOTALS TABLE - جدول المجاميع والأزرار
 * ========================================== */

/* الصف الثاني الذي يحتوي الأزرار */
.table-condensed tr:nth-child(2) td {
    padding: 8px 6px !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    font-size: 13px !important;
}

/* أيقونات التعديل */
.table-condensed .fa-edit,
.table-condensed .fas.fa-edit {
    color: #3498db !important;
    cursor: pointer !important;
    margin: 0 4px !important;
    font-size: 14px !important;
}

.table-condensed .fa-edit:hover,
.table-condensed .fas.fa-edit:hover {
    color: #2980b9 !important;
    transform: scale(1.1) !important;
}

/* النصوص */
.table-condensed b {
    font-weight: 600 !important;
    color: #2c3e50 !important;
}

.table-condensed span {
    font-weight: 500 !important;
    color: #34495e !important;
}

/* ==========================================
 * RESPONSIVE LAYOUT - تصميم متجاوب
 * ========================================== */

/* للشاشات الصغيرة */
@media (max-width: 1200px) {
    .table-condensed tr:nth-child(2) {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
    }
    
    .table-condensed tr:nth-child(2) td {
        flex: 1 1 45% !important;
        display: inline-block !important;
        min-width: 200px !important;
    }
}

@media (max-width: 768px) {
    .table-condensed tr:nth-child(2) td {
        flex: 1 1 100% !important;
        display: block !important;
        border-bottom: 1px solid #e9ecef !important;
        padding: 10px !important;
    }
}

/* ==========================================
 * VISIBILITY FIXES - إصلاح الإخفاء
 * ========================================== */

/* إظهار جميع الأزرار */
.table-condensed tr:nth-child(2) td.hide {
    display: none !important;
}

.table-condensed tr:nth-child(2) td:not(.hide) {
    display: table-cell !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* ==========================================
 * SCROLL HINTS - تلميحات التمرير
 * ========================================== */

/* إضافة ظل للدلالة على إمكانية التمرير */
.table-condensed {
    position: relative !important;
}

.table-condensed::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, rgba(255,255,255,0.8), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.table-condensed:hover::after {
    opacity: 1;
}

/* ==========================================
 * MINIMUM WIDTHS - الحد الأدنى للعرض
 * ========================================== */

/* الخصم */
.table-condensed tr:nth-child(2) td:nth-child(1) {
    min-width: 150px !important;
}

/* ضريبة الطلب */
.table-condensed tr:nth-child(2) td:nth-child(2) {
    min-width: 120px !important;
}

/* الشحن */
.table-condensed tr:nth-child(2) td:nth-child(3) {
    min-width: 120px !important;
}

/* رسوم التغليف */
.table-condensed tr:nth-child(2) td:nth-child(4) {
    min-width: 120px !important;
}

/* ==========================================
 * WRAPPER FIX - إصلاح الـ Container
 * ========================================== */

/* التأكد من أن الـ row لا يقص المحتوى */
.row {
    overflow: visible !important;
}

.col-md-12 {
    overflow: visible !important;
}

/* ==========================================
 * ALTERNATIVE LAYOUT - تخطيط بديل
 * ========================================== */

/* جعل الجدول grid للشاشات الصغيرة */
@media (max-width: 992px) {
    .table-condensed {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
    }
    
    .table-condensed tr {
        display: table-row !important;
    }
    
    .table-condensed td {
        display: table-cell !important;
    }
}

/* ==========================================
 * SPECIFIC FIXES - إصلاحات محددة
 * ========================================== */

/* التأكد من ظهور جميع الأيقونات */
#pos-edit-discount,
#pos-edit-tax,
.service_modal_btn {
    display: inline-block !important;
    cursor: pointer !important;
    color: #3498db !important;
}

/* التأكد من ظهور جميع النصوص */
#total_discount,
#order_tax,
#shipping_charges_amount,
#packing_charge_text,
#round_off_text {
    display: inline !important;
    font-weight: 600 !important;
    color: #e74c3c !important;
}

/* ==========================================
 * SPACING - المسافات
 * ========================================== */

.table-condensed tr:nth-child(2) b {
    margin-right: 5px !important;
}

.table-condensed tr:nth-child(2) i {
    margin: 0 3px !important;
}

.table-condensed tr:nth-child(2) span {
    margin: 0 3px !important;
}
