/*
 * ERP DonaPOS - Numeric & Nominal Styling
 * Right-alignment and professional spacing for numbers
 */

/* Force right alignment for numeric inputs */
input.input_number,
input.money,
.input-number input,
.pos_quantity,
.pos_unit_price,
.pos_line_total,
.payment-amount,
#final_total_input {
    text-align: right !important;
    padding-right: 12px !important;
}

/* Table cells containing currency or numbers */
table td.display_currency,
table td.text-right,
table th.text-right,
.text-right-number,
td[data-orig-value],
.info-box-number,
.total_quantity,
.unit_price,
.tax_amount,
.row_subtotal,
.report-amount,
table.table-striped td:last-child,
.display_currency {
    text-align: right !important;
}

/* Specific fix for reports using 2-column tables (Profit/Loss style) */
.table.table-striped td {
    padding-right: 15px !important;
}

/* Report Summary Lines (H3/H4 titles with values) */
h3.text-muted .display_currency,
h4.text-muted .display_currency,
.report-summary-line .display_currency {
    float: right !important;
    font-weight: 700 !important;
}

/* Ensure cleafix for floated currency in headings */
h3.text-muted,
h4.text-muted {
    overflow: hidden !important;
}

/* Header alignment consistency */
table thead th.text-right-number {
    text-align: right !important;
}

/* Target all cells that are likely to contain numbers in report tables */
[id$="_table"] td.display_currency,
[id$="_tbl"] td.display_currency {
    text-align: right !important;
}

/* Explicitly keep Text, SKU, and Invoice numbers on the LEFT */
[id$="_table"] td:first-child,
[id$="_tbl"] td:first-child,
.product-name,
.sku,
.invoice-no,
.ref-no,
.contact-name,
.customer-name,
.supplier-name,
.sorting_1:not(.display_currency) {
    text-align: left !important;
}

/* More specific numeric columns for common reports */
#stock_report_table td:nth-child(n+7),
#product_purchase_report_table td:nth-child(n+4),
#product_sell_report_table td:nth-child(n+4),
#purchase_payment_report_table td:nth-child(n+4),
#sell_payment_report_table td:nth-child(n+4),
#supplier_report_tbl td:nth-child(n+2),
#customer_report_tbl td:nth-child(n+2),
#register_report_table td:nth-child(n+5) {
    text-align: right !important;
}

/* Footer alignment for reports */
table tfoot th,
table tfoot td {
    text-align: right !important;
}

table tfoot th:first-child,
table tfoot td:first-child {
    text-align: left !important;
    /* Keep the 'Total' label on the left */
}

/* Global data-orig-value (used by the app for raw numbers) */
td[data-orig-value] {
    text-align: right !important;
}

/* Numeric Font spacing adjustment */
.input_number,
.money,
.display_currency {
    font-variant-numeric: tabular-nums;
    /* Ensures all digits have same width for better alignment */
    letter-spacing: 0.02em;
}

/* POS specific alignment */
#pos-total-amount,
.pos-total-row td:last-child {
    text-align: right !important;
    font-weight: 700;
}