/**
 * thermal-print.css — Estilos de impresión térmica 80mm / 58mm
 * Úsalo en la pantalla de pre-cuenta y tickets del POS.
 * Inyectado dinámicamente al hacer window.print()
 */

@media print {

    /* ─── RESET PARA PAPEL TÉRMICO ─── */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    html, body {
        margin: 0;
        padding: 0;
        background: #fff !important;
        color: #000 !important;
        font-family: 'Courier New', Courier, monospace;
        font-size: 10pt;
        width: 80mm;      /* Cambiar a 58mm si corresponde */
    }

    /* Ocultar TODO lo que no sea el ticket */
    header, nav, aside, footer,
    .no-print, .glass-card, button,
    #live-clock, #kds-orders-grid,
    .sidebar, .topbar { display: none !important; }

    /* ─── WRAPPER DEL TICKET ─── */
    .thermal-ticket {
        width: 100%;
        padding: 0;
        page-break-after: avoid;
    }

    /* ─── ENCABEZADO ─── */
    .thermal-header {
        text-align: center;
        border-bottom: 1px dashed #000;
        padding-bottom: 6pt;
        margin-bottom: 6pt;
    }

    .thermal-header .logo-text {
        font-size: 14pt;
        font-weight: 700;
        letter-spacing: 1px;
    }

    .thermal-header p {
        font-size: 8pt;
        margin: 2pt 0;
        line-height: 1.3;
    }

    /* ─── DATOS DE LA ORDEN ─── */
    .thermal-meta {
        border-bottom: 1px dashed #000;
        padding: 4pt 0;
        margin-bottom: 4pt;
    }

    .thermal-meta p {
        font-size: 9pt;
        margin: 1.5pt 0;
        display: flex;
        justify-content: space-between;
    }

    .thermal-meta .label {
        font-weight: bold;
        margin-right: 6pt;
    }

    /* ─── ÍTEMS ─── */
    .thermal-items {
        width: 100%;
        border-collapse: collapse;
    }

    .thermal-items thead th {
        font-size: 8pt;
        font-weight: bold;
        border-bottom: 1px solid #000;
        padding: 2pt 0;
        text-align: left;
    }

    .thermal-items thead th:last-child,
    .thermal-items td:last-child {
        text-align: right;
    }

    .thermal-items tbody td {
        font-size: 9pt;
        padding: 2pt 0;
        vertical-align: top;
    }

    .thermal-items tbody tr td:nth-child(1) { /* Qty */
        width: 18pt;
        font-weight: bold;
    }

    .thermal-items .item-notes {
        font-size: 7.5pt;
        font-style: italic;
        color: #555;
    }

    .thermal-items tfoot td {
        border-top: 1px dashed #000;
        font-size: 9pt;
        padding: 2pt 0;
    }

    .thermal-items tfoot .total-row td {
        font-weight: bold;
        font-size: 11pt;
        border-top: 1px solid #000;
    }

    /* ─── TOTALES ─── */
    .thermal-totals {
        width: 100%;
        border-top: 1px dashed #000;
        margin-top: 4pt;
        padding-top: 4pt;
    }

    .thermal-totals tr td {
        font-size: 9pt;
        padding: 1pt 0;
    }

    .thermal-totals tr td:last-child {
        text-align: right;
    }

    .thermal-totals .total-final td {
        font-size: 12pt;
        font-weight: 900;
        border-top: 1px solid #000;
        padding-top: 3pt;
    }

    /* ─── PIE / FOOTER ─── */
    .thermal-footer {
        text-align: center;
        margin-top: 8pt;
        padding-top: 6pt;
        border-top: 1px dashed #000;
        font-size: 8pt;
        line-height: 1.5;
    }

    .thermal-footer .thank-you {
        font-size: 10pt;
        font-weight: bold;
        margin-bottom: 4pt;
    }

    /* ─── QR CODE placeholder ─── */
    .thermal-qr {
        text-align: center;
        margin: 6pt auto;
    }

    .thermal-qr img {
        width: 60pt;
        height: 60pt;
    }

    /* ─── CORTAR PAPEL ─── */
    .thermal-cut {
        border-top: 1px dashed #000;
        margin-top: 10pt;
        padding-top: 4pt;
        text-align: center;
        font-size: 7pt;
        color: #888;
    }
}

/* ─── VISTA PREVIA EN PANTALLA (before print) ─── */
.thermal-preview-container {
    background: #fff;
    color: #000;
    font-family: 'Courier New', Courier, monospace;
    font-size: 10pt;
    width: 80mm;
    margin: 0 auto;
    padding: 12pt;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
