﻿/* ================== PRINT MODE ================== */
@media print {
    @page {
        size: 80mm auto; /* Chiều rộng 80mm, cao tự động */
        margin: 0;
    }

    html, body, .receipt-container, table {
        height: auto !important;
        max-height: none !important;
    }

    body {
        margin: 0;
        padding: 0;
        font-size: 35px !important;
    }

    header, footer, .no-print {
        display: none !important;
    }

    /* Ẩn mọi thứ ngoài bill */
    body * {
        visibility: hidden;
    }

    .receipt-container, .receipt-container * {
        visibility: visible;
    }

    /* Giữ màu và font */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Tối ưu layout khi in */
    .receipt-container {
        border: none;
        width: 640px !important;
        margin: 0 4mm;
        padding: 0 4mm;
        box-shadow: none;
        page-break-inside: avoid;
        font-size: 6.6mm !important;
    }

        .receipt-container.scale-2 {
            transform: scale(0.6);
            transform-origin: top left;
        }

    .receipt-info {
        width: 100%;
    }

    .receipt-top {
        margin-top: 10px;
    }

    .company-titles {
        margin-left: 0 !important;
        width: 100%;
    }

        .company-titles h3,
        .company-titles h4 {
            font-size: 10mm !important;
        }

    .logo-company img {
        position: relative;
        width: 30mm !important;
        height: 30mm !important;
    }

    .order-info,
    .total-section {
        float: none;
        width: 100%;
    }
    /* Giảm padding bảng khi in */
    table th, table td {
        padding: 2px 4px;
    }


    table thead {
        display: table-row-group !important; /* Ngăn lặp lại trên trang mới */
    }

    .page-break {
        display: block;
        page-break-after: always !important;
        clear: both;
    }
}
