/* Print styles */
@media print {
    /* Hide non-printable elements */
    nav, footer, button, .no-print, a[href]:not(.print-logo) {
        display: none !important;
    }

    /* Reset body and container styles */
    body {
        margin: 0;
        padding: 0;
        line-height: 1.1;
        font-size: 10pt;
        background: none;
        color: #000;
    }

    .show-in-print {
        display: block;
    }

    .hide-in-print {
        display: none;
    }

    .show-row-in-print {
        display: table-row;
    }

    .show-cell-in-print {
        display: table-cell;
    }

    .sidebar, .header {
        display: none;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .container, main, article {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: none !important;
    }

    h6.show-in-print {
        display: inline;
        font-size: 10pt;
        margin: 0;
    }

    h6.show-in-print + .invoice-header {
        display: inline;
    }

    h6.show-in-print + .invoice-header h5 {
        display: inline;
        font-size: 10pt;
        /* margin: 0 0 0 0.5cm; */
    }

    .invoice-header {
        display: flex;
        justify-content: space-between;
        margin-bottom: 0;
    }

    .invoice-header h1 {
        font-size: 18pt;
        margin-bottom: 0.2cm;
    }

    .invoice-header .company-info {
        font-size: 10pt;
        line-height: 1.2;
    }

    /* Customer and order information */
    .invoice-info {
        margin: 0.3cm 0;
        page-break-inside: avoid;
    }

    .grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.3cm !important;
        page-break-inside: avoid;
    }

    .grid.order-resume {
        grid-template-columns: 1fr auto !important;
    }

    /* Table styles */
    table {
        width: 100%;
        border-collapse: collapse;
        margin: 0.3cm 0;
        page-break-inside: avoid;
    }

    table th, table td {
        padding: 0.1cm 0.15cm;
        text-align: left;
        border-bottom: 0.5pt solid #000;
        font-size: 9pt;
    }

    table thead {
        display: table-header-group;
    }

    table th {
        background-color: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Totals section */
    .totals-section {
        margin-top: 0.3cm;
        page-break-inside: avoid;
    }

    .totals-table {
        width: auto;
        margin-left: auto;
    }

    .totals-table th, .totals-table td {
        padding: 0.2cm 0.5cm;
    }

    /* Status badge */
    .status-badge {
        padding: 0.1cm 0.3cm;
        border: 1pt solid #000;
        border-radius: 0.2cm;
    }

    /* Keep max-discount rows black when printing */
    .max-discount td, .max-discount input {
        color: #000;
    }

    /* Force page breaks */
    .page-break {
        page-break-before: always;
    }

    /* Additional print optimizations */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Print header and footer */
    @page {
        margin: 0.5cm;
    }

    /* Links */
    a {
        text-decoration: none;
        color: #000;
    }
}
