/* Print styles for invoice printing */
/* Include this CSS in print tabs to ensure proper formatting when printing to PDF */

@media print {
    /* Hide navigation and UI elements */
    nav,
    .navbar,
    .btn,
    button,
    .modal,
    .modal-backdrop,
    .alert,
    input,
    select,
    textarea,
    [role="navigation"],
    [role="toolbar"],
    .no-print,
    .no-print * {
        display: none !important;
    }

    /* Page layout */
    html,
    body {
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        background: white;
    }

    body {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        font-size: 11pt;
        line-height: 1.4;
        color: #000;
    }

    /* Page setup */
    @page {
        size: A4;
        margin: 0.5in;
    }

    * {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
    }

    /* Headers and text */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
        margin: 0.3em 0;
        font-weight: bold;
    }

    p {
        margin: 0.3em 0;
    }

    /* Tables */
    table {
        width: 100%;
        border-collapse: collapse;
        page-break-inside: avoid;
        margin: 0.5em 0;
    }

    th,
    td {
        border: 1px solid #000;
        padding: 0.5em;
        text-align: left;
    }

    th {
        font-weight: bold;
        background: #f0f0f0;
    }

    /* Prevent orphaned table rows */
    tbody {
        page-break-inside: avoid;
    }

    /* Cards and dividers */
    .card {
        page-break-inside: avoid;
        border: 1px solid #000;
        margin: 0.5em 0;
    }

    .card-header {
        background: #f0f0f0 !important;
        font-weight: bold;
    }

    .card-body {
        padding: 0.5em;
    }

    /* Links */
    a {
        color: #000;
        text-decoration: underline;
    }

    /* Images */
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }

    /* Utility classes */
    .text-end {
        text-align: right;
    }

    .text-center {
        text-align: center;
    }

    .text-start {
        text-align: left;
    }

    /* Row and column layouts */
    .row {
        display: block;
        page-break-inside: avoid;
        margin: 0;
        padding: 0;
    }

    .col-md-6,
    .col-md-8,
    .col-md-4 {
        display: block;
        width: 100%;
        page-break-inside: avoid;
        margin: 0;
        padding: 0.25em;
    }

    /* Financial amounts - ensure they're visible */
    .currency,
    [data-currency] {
        font-weight: bold;
    }

    /* Margin and padding resets for print */
    .container {
        margin: 0;
        padding: 0;
        max-width: 100%;
        width: 100%;
    }

    .mb-4,
    .mb-3,
    .mb-2,
    .mb-1,
    .me-2,
    .me-1,
    .ms-2 {
        margin: 0;
    }
}

/* Print preview styles (for screens before printing) */
.print-preview {
    background: white;
    color: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 11pt;
    line-height: 1.4;
    padding: 0.5in;
    page-break-after: auto;
}

.print-preview h1,
.print-preview h2,
.print-preview h3,
.print-preview h4,
.print-preview h5,
.print-preview h6 {
    margin: 0.3em 0;
    font-weight: bold;
    page-break-after: avoid;
}

.print-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5em 0;
}

.print-preview th,
.print-preview td {
    border: 1px solid #000;
    padding: 0.5em;
}

.print-preview .no-border {
    border: none;
}
