/* Fix for table header alignment */
.custom-table-header,
.table-row {
    display: grid !important;
    grid-template-columns: 50px 90px minmax(200px, 2fr) 80px 90px 90px 90px 90px 110px 130px !important;
    gap: 0 !important;
}

.custom-table-header .table-col,
.table-row .table-col {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Allow product name to wrap */
.col-product {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Prevent header from scrolling horizontally */
.custom-table-header {
    overflow: visible !important;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Make scrollbar space consistent */
.custom-table-body {
    overflow-y: scroll;
    overflow-x: hidden;
}

/* Force scrollbar to always show for consistent width */
.custom-table-body::-webkit-scrollbar {
    width: 8px;
    -webkit-appearance: none;
}

.custom-table-body::-webkit-scrollbar-track {
    background: #F1F5F9;
}

.custom-table-body::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.custom-table-body::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Remove any scroll wrapper interference */
.custom-table-scroll {
    overflow: visible !important;
}

/* Ensure table container doesn't scroll */
.custom-table-container {
    overflow: visible !important;
}

/* Mobile fixes */
@media (max-width: 768px) {
    .custom-table-container {
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
    }
    
    .custom-table-scroll {
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        width: 100% !important;
    }
    
    .custom-table-header,
    .table-row {
        grid-template-columns: 40px 75px 160px 65px 70px 70px 70px 70px 90px 110px !important;
        width: 820px !important;
    }
    
    .custom-table-header {
        position: static !important;
        overflow-x: visible !important;
        font-weight: 700 !important;
        font-size: 15px !important;
        letter-spacing: 0.5px !important;
    }
    
    .custom-table-body {
        overflow-y: auto !important;
        overflow-x: visible !important;
        width: 100% !important;
    }
    
    .custom-table-header .table-col,
    .table-row .table-col {
        padding: 12px 6px !important;
    }
    
    .table-row {
        font-size: 14px !important;
    }
    
    .col-product {
        width: 160px !important;
        min-width: 160px !important;
        max-width: 160px !important;
        white-space: normal !important;
        word-wrap: break-word !important;
    }
    
    .col-check {
        width: 40px !important;
        padding: 12px 4px !important;
    }
}
