/* CellPoint Pro Web — the printed slips: receipts, quotes, repair slips and labels, bill payment and layaway
   receipts, shift and batch summaries. Used three ways:
   - on screen, where a slip is previewed;
   - by the browser's print dialog (the @media print rules at the end);
   - by js/printer.js, which draws each slip with these rules (all but the print dialog's) and sends the picture
     straight to the printer through CellPoint Print (the .slip-page rules). */

.print-area { display: none; }

/* ---------- Receipts ---------- */

.receipt {
    width: var(--receipt-width, 72mm);
    margin: 0 auto;
    color: #000;
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    font-size: 11.5px;
    line-height: 1.35;
}

.receipt table { width: 100%; border-collapse: collapse; }
.receipt td { padding: 1px 0; vertical-align: top; }
.receipt-head { text-align: center; margin-bottom: 6px; }
.receipt-logo { max-width: 42mm; max-height: 22mm; object-fit: contain; margin-bottom: 4px; }
.receipt-store { font-size: 15px; font-weight: 700; }
.receipt-muted { color: #333; font-size: 10.5px; }
.receipt-pre { white-space: pre-line; }
.receipt-title { text-align: center; font-weight: 700; letter-spacing: .12em; margin: 6px 0; border-top: 1px dashed #000; border-bottom: 1px dashed #000; padding: 3px 0; }
.receipt-meta td:first-child { width: 34%; color: #333; }
.receipt-rule { border-top: 1px dashed #000; margin: 6px 0; }
.receipt-item { font-weight: 600; padding-top: 4px !important; }
.receipt-grand td { font-size: 14px; font-weight: 800; padding-top: 4px; }
.receipt-policy { font-size: 10px; color: #333; }
.receipt-foot { text-align: center; margin-top: 10px; font-weight: 600; }
.receipt-section { font-weight: 700; margin: 2px 0; text-transform: uppercase; font-size: 10.5px; letter-spacing: .06em; }
.receipt-counts td { padding: 1px 2px; }
.receipt-counts td:first-child { padding-left: 0; }
.receipt-signature { margin-top: 30px; border-bottom: 1px solid #000; padding-bottom: 2px; font-weight: 700; }

/* Several slips print together, each on its own page (the printer cuts between them). */
.print-doc + .print-doc { break-before: page; page-break-before: always; }
.receipt .text-end { text-align: right; }
.receipt-lines td:last-child, .receipt-totals td:last-child { white-space: nowrap; padding-left: 6px; }
.receipt-stamp { text-align: center; font-weight: 800; font-size: 14px; letter-spacing: .2em; border: 2px solid #000; margin: 4px 10mm 6px; padding: 2px 0; }

/* Repair slips */
.repair-receipt-device { margin-bottom: 6px; }
.repair-receipt-bullet { padding-left: 8px; }
.repair-receipt-tech td:first-child { width: 34%; color: #333; }
.repair-receipt-track { display: flex; gap: 8px; align-items: center; }
.receipt-qr-code { width: 26mm; height: 26mm; flex-shrink: 0; }
.receipt-pattern { display: block; width: 24mm; height: 24mm; margin: 4px auto; color: #000; }

/* Bill payment receipts */
.bp-receipt-bill { text-align: center; }
.bp-receipt-carrier { font-size: 14px; font-weight: 700; }
.bp-receipt-phone { font-size: 16px; font-weight: 800; letter-spacing: .04em; }
.bp-receipt-barcode { width: 60mm; margin: 8px auto 4px; }
.receipt-barcode { display: block; width: 100%; height: 12mm; }

/* ---------- Repair device labels ---------- */

.repair-label {
    width: var(--receipt-width, 72mm);
    margin: 0 auto;
    color: #000;
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    font-size: 11px;
    line-height: 1.3;
    border: 1px solid #000;
    border-radius: 4px;
    padding: 6px 8px;
}

.repair-label-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 10px; }
.repair-label-ticket { font-size: 20px; font-weight: 800; }
.repair-label-customer { font-weight: 700; font-size: 12px; margin-top: 2px; }
.repair-label-device { font-weight: 700; font-size: 13px; border-top: 1px dashed #000; margin-top: 3px; padding-top: 3px; }
.repair-label-line { font-size: 10.5px; }
.repair-label-bottom { display: flex; justify-content: space-between; gap: 6px; border-top: 1px dashed #000; margin-top: 4px; padding-top: 3px; font-size: 10.5px; }
.label-pattern { width: 14mm; height: 14mm; vertical-align: middle; margin-left: 4px; color: #000; }

/* ---------- Slips drawn for a printer (CellPoint Print) ---------- */

.slip-page { margin: 0; padding: 0; background: #fff; color: #000; }
.slip-page .print-doc { margin: 0; }

/* The few Bootstrap helpers the slips use (Bootstrap itself isn't used for the printer). */
.slip-page .fw-bold { font-weight: 700; }
.slip-page .fw-semibold { font-weight: 600; }
.slip-page .ps-2 { padding-left: .5rem; }
.slip-page .text-end { text-align: right; }
.slip-page .text-center { text-align: center; }
.slip-page .font-monospace { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.slip-page .pattern-diagram { width: 72px; height: 72px; display: inline-block; vertical-align: middle; color: #000; }
.slip-page .receipt-pattern { display: block; width: 24mm; height: 24mm; margin: 4px auto; }
.slip-page .label-pattern { width: 14mm; height: 14mm; }

.slip-receipt .receipt { padding: 1mm 0; }

/* Labels: drawn at the label's length, then fitted to the label. */
.slip-label .print-doc { width: var(--label-width, 89mm); }
.slip-label .repair-label { width: auto; margin: 0; border: 0; border-radius: 0; padding: 1mm 1.5mm; font-size: 9px; line-height: 1.2; }
.slip-label .repair-label-top { font-size: 8.5px; }
.slip-label .repair-label-ticket { font-size: 15px; }
.slip-label .repair-label-customer { font-size: 10px; margin-top: 0; }
.slip-label .repair-label-device { font-size: 10.5px; margin-top: 1px; padding-top: 1px; }
.slip-label .repair-label-line { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slip-label .repair-label-bottom { margin-top: 1px; padding-top: 1px; font-size: 9px; }
.slip-label .label-pattern { width: 8mm; height: 8mm; margin-left: 2px; }
.slip-label-small .repair-label-line.receipt-pre,
.slip-label-small .label-pattern { display: none; }

/* ---------- The browser's print dialog ---------- */
/* slip:print-dialog-only (js/printer.js leaves out everything below this line) */

@media print {
    /* The paper size comes from the printer's own settings (a receipt printer's roll). */
    @page {
        margin: 3mm;
    }

    html, body { background: #fff !important; height: auto; }
    body > *:not(.print-area) { display: none !important; }
    .print-area { display: block !important; }

    /* js/printer.js prints a copy of the slips that didn't go straight to a printer; the live print area stays hidden. */
    html.cp-print-snapshot-on #print-area { display: none !important; }
}
