/* ==========================================================================
   BetaVape Modern Compact DataTables & Tables Design
   Eliminates huge empty column gaps, optimizes horizontal space,
   and enables viewing data cleanly without excessive horizontal scrolling.
   ========================================================================== */

/* 1. Global Table Wrapper & Spacing */
.dataTables_wrapper {
    padding: 0 !important;
    width: 100% !important;
}

.dataTables_wrapper .row {
    margin-left: -5px !important;
    margin-right: -5px !important;
    margin-bottom: 8px !important;
}

/* 2. Global DataTable & Table Cell Padding & Typography */
.dataTables_wrapper .table,
table.dataTable,
.ajax_view,
.table-bordered {
    font-size: 12px !important;
    letter-spacing: -0.01em !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

/* Exclude POS checkout table from these global rules */
.dataTables_wrapper .table:not(#pos_table) > thead > tr > th,
.dataTables_wrapper .table:not(#pos_table) > tbody > tr > td,
.dataTables_wrapper .table:not(#pos_table) > tfoot > tr > td,
.dataTables_wrapper .table:not(#pos_table) > tfoot > tr > th,
table.dataTable:not(#pos_table) thead th,
table.dataTable:not(#pos_table) tbody td,
table.dataTable:not(#pos_table) tfoot th,
table.dataTable:not(#pos_table) tfoot td {
    padding: 5px 6px !important;
    vertical-align: middle !important;
    line-height: 1.3 !important;
}

/* 3. Compact, Crisp Headers */
table.dataTable:not(#pos_table) thead th,
.dataTables_wrapper .table:not(#pos_table) thead th,
.dataTables_scrollHead thead th {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.2px !important;
    color: #1e293b !important;
    background-color: #f1f5f9 !important;
    border-bottom: 2px solid #cbd5e1 !important;
    padding: 6px 14px 6px 6px !important;
    line-height: 1.25 !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
}

[dir="rtl"] table.dataTable:not(#pos_table) thead th,
[dir="rtl"] .dataTables_wrapper .table:not(#pos_table) thead th,
[dir="rtl"] .dataTables_scrollHead thead th {
    padding: 6px 6px 6px 14px !important;
}

/* 4. Compact Sorting Arrows (shrink the large default 30px reserved padding) */
table.dataTable thead > tr > th.sorting,
table.dataTable thead > tr > th.sorting_asc,
table.dataTable thead > tr > th.sorting_desc {
    padding-right: 14px !important;
}

[dir="rtl"] table.dataTable thead > tr > th.sorting,
[dir="rtl"] table.dataTable thead > tr > th.sorting_asc,
[dir="rtl"] table.dataTable thead > tr > th.sorting_desc {
    padding-right: 6px !important;
    padding-left: 14px !important;
}

table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before,
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    font-size: 0.7em !important;
    right: 3px !important;
    bottom: 0.5em !important;
    opacity: 0.35 !important;
}

[dir="rtl"] table.dataTable thead .sorting:before,
[dir="rtl"] table.dataTable thead .sorting_asc:before,
[dir="rtl"] table.dataTable thead .sorting_desc:before,
[dir="rtl"] table.dataTable thead .sorting:after,
[dir="rtl"] table.dataTable thead .sorting_asc:after,
[dir="rtl"] table.dataTable thead .sorting_desc:after {
    right: auto !important;
    left: 3px !important;
}

/* 5. Compact Action Buttons in Table Rows */
table.dataTable td .btn-group,
table.dataTable td .btn,
.dataTables_wrapper td .btn {
    font-size: 11px !important;
    padding: 2px 6px !important;
    line-height: 1.35 !important;
    border-radius: 4px !important;
    font-weight: 600 !important;
}

table.dataTable td .btn .caret,
.dataTables_wrapper td .btn .caret {
    margin-left: 2px !important;
}

[dir="rtl"] table.dataTable td .btn .caret,
[dir="rtl"] .dataTables_wrapper td .btn .caret {
    margin-left: 0 !important;
    margin-right: 2px !important;
}

/* 6. Status Badges & Labels */
table.dataTable .label,
table.dataTable .badge,
.dataTables_wrapper .label,
.dataTables_wrapper .badge {
    padding: 2px 5px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    border-radius: 3px !important;
    display: inline-block !important;
    line-height: 1.2 !important;
    letter-spacing: 0.2px !important;
}

/* 7. Numbers & Currency Alignment */
table.dataTable td.display_currency,
table.dataTable td.final_total,
table.dataTable td.total_paid,
table.dataTable td.total_remaining,
table.dataTable td.return_due,
.dataTables_wrapper .display_currency {
    white-space: nowrap !important;
    font-weight: 600 !important;
    text-align: right !important;
    font-variant-numeric: tabular-nums !important;
}

[dir="rtl"] table.dataTable td.display_currency,
[dir="rtl"] table.dataTable td.final_total,
[dir="rtl"] table.dataTable td.total_paid,
[dir="rtl"] table.dataTable td.total_remaining,
[dir="rtl"] table.dataTable td.return_due,
[dir="rtl"] .dataTables_wrapper .display_currency {
    text-align: left !important;
}

/* 8. Date and Invoice columns */
table.dataTable td:has(> a.invoice-no),
table.dataTable td a.invoice-no {
    white-space: nowrap !important;
    font-weight: 600;
}

/* 9. Product Thumbnails & Images in Tables */
table.dataTable img.product-thumbnail-small,
table.dataTable img {
    max-width: 28px !important;
    max-height: 28px !important;
    border-radius: 4px !important;
    object-fit: cover !important;
}

/* 10. Subtle Row Hover & Zebra Striping */
table.dataTable.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #fafbfc !important;
}

table.dataTable tbody > tr:hover {
    background-color: #f1f5f9 !important;
}

/* 11. Slim, Clean Scrollbar for DataTables */
.dataTables_scrollBody::-webkit-scrollbar {
    height: 6px !important;
    width: 6px !important;
}

.dataTables_scrollBody::-webkit-scrollbar-track {
    background: #f8fafc;
}

.dataTables_scrollBody::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.dataTables_scrollBody::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 12. Table Footer Totals */
table.dataTable tfoot tr,
.dataTables_wrapper .table tfoot tr {
    font-size: 11.5px !important;
    background-color: #f8fafc !important;
    font-weight: 700 !important;
}

table.dataTable tfoot td,
table.dataTable tfoot th {
    padding: 5px 6px !important;
}

/* 13. DataTables filter, length and button controls */
.dataTables_wrapper .dataTables_length select {
    padding: 2px 6px !important;
    font-size: 11.5px !important;
    height: 28px !important;
    border-radius: 4px !important;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 2px 8px !important;
    font-size: 12px !important;
    height: 28px !important;
    border-radius: 4px !important;
}

.dataTables_wrapper .dt-buttons .btn {
    padding: 3px 8px !important;
    font-size: 11px !important;
    border-radius: 4px !important;
}

/* 14. Responsive Container Padding Tightening */
.table-responsive {
    margin-bottom: 10px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
}
