/* 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;
}

/* A6 size or Thermal 80mm optimization */
.bon-receipt { /* Targets individual generated receipts */
    width: 78mm; /* Standard width for 80mm thermal paper */
    margin: 0 auto;
    padding: 5mm 3mm; /* Reduced padding for narrow print */
    box-sizing: border-box;
    font-size: 10pt; /* Clear readable font size */
    line-height: 1.4;
    /* Visual separation between multiple bons when printing them sequentially */
    border-bottom: 3px dashed #333; 
    padding-bottom: 10px;
    margin-bottom: 10px;
}

/* Remove the separation line for the very last bon */
#receipt .bon-receipt:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

@page {
    /* Optimization for thermal printers / A6 vertical */
    size: 78mm auto; /* 78mm width, automatic height */
    margin: 0;
}

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

.receipt-header h2 {
    font-size: 14pt;
    font-weight: 900;
    margin: 0 0 3px 0;
}
.receipt-header p {
    font-size: 8pt;
    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: 400;
    word-break: break-word;
}

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

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

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

.receipt-footer {
    text-align: center;
    margin-top: 15px;
    font-size: 8pt;
    border-top: 1px solid #000;
    padding-top: 5px;
}

.signature-box {
    margin-top: 15px;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    font-size: 9pt;
}

.signature-box div {
    width: 45%;
    text-align: center;
    border-top: 1px solid #000;
    padding-top: 5px;
    font-weight: 700;
}