/* Ensure the receipt is displayed for printing */
#receipt {
    display: block !important;
}

/* Hide the input form and general UI elements when printing */
#bonForm, h1, .form-actions {
    display: none;
}

body {
    background: none !important;
    direction: rtl;
    text-align: right;
    font-family: 'Noto Kufi Arabic', sans-serif;
    color: #000;
    padding: 0;
    margin: 0;
}

/* 10cm x 15cm optimization */
.bon-receipt { /* Targets individual generated receipts */
    width: 96mm; /* Content width slightly less than 100mm to allow internal padding */
    height: 146mm; /* Adjusted height slightly less than 150mm */
    margin: 0 auto;
    padding: 5mm 5mm; /* Increased padding */
    box-sizing: border-box;
    font-size: 12pt; /* Increased base font size for clarity */
    line-height: 1.5;
    /* Ensure each bon starts on a new page (or is treated as one receipt unit) */
    page-break-after: always; 
}

/* Remove page break after the very last bon */
#receipt .bon-receipt:last-child {
    page-break-after: auto;
}

@page {
    /* Set page size to 10cm x 15cm (100mm x 150mm) */
    size: 100mm 150mm; 
    margin: 0;
}

.receipt-header {
    text-align: center;
    margin-bottom: 10px;
    border-bottom: 2px solid #000;
    padding-bottom: 5px;
}

.receipt-header h2 {
    font-size: 15pt;
    font-weight: 900;
    margin: 0 0 3px 0;
}
.receipt-header p {
    font-size: 9pt;
    margin: 0;
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px dashed #bbb;
}

.receipt-item:last-of-type {
    border-bottom: 1px dashed #bbb; /* Keep separator */
    margin-bottom: 5px;
}
.receipt-details > .receipt-item:last-child {
     border-bottom: none; /* remove dashed line above total */
}

.receipt-label {
    font-weight: 700;
    flex-basis: 40%;
}

.receipt-value {
    flex-basis: 60%;
    text-align: left; /* Values should align visually left/end for numbers/short text */
    font-weight: 700; /* Increased font weight for all values */
    word-break: break-word;
}

/* Emphasis on key fields */
.emphasized .receipt-value,
.emphasized .receipt-label {
    font-weight: 900 !important;
    font-size: 14pt !important; /* Increased emphasized font size */
}

.receipt-total {
    border-top: 2px solid #000;
    padding-top: 5px;
    margin-top: 5px;
}

.receipt-total .receipt-value {
    color: #000 !important; 
}