/* Patch for long water microbial test lists */
@media print {
    /* Remove fixed height and overflow hidden that causes cutoff */
    .page {
        height: auto !important;
        overflow: visible !important;
    }

    .print-section {
        height: auto !important;
        overflow: visible !important;
    }

    /* Allow tables to break across pages properly */
    .mud-table {
        page-break-inside: auto !important;
    }

    /* Prevent rows from breaking in the middle */
    .mud-table tr {
        page-break-inside: avoid !important;
        page-break-after: auto !important;
    }

    /* Ensure table headers repeat on each page */
    .mud-table thead {
        display: table-header-group !important;
    }

    .mud-table tbody {
        display: table-row-group !important;
    }

    /* Water microbial section specific fixes */
    .printable-report.landscape .mud-table-container {
        overflow: visible !important;
        max-height: none !important;
    }

    /* Adjust page breaks for better flow */
    .break-before {
        page-break-before: always !important;
        break-before: page !important;
    }

    .break-after {
        page-break-after: auto !important;
        break-after: auto !important;
    }

    /* For sections that might span multiple pages */
    .printable-report-wrapper > div {
        page-break-inside: auto !important;
    }
}

/* Specific fixes for water microbial test section */
@media print {
    .water-microbial-section {
        page-break-inside: auto !important;
    }

    .water-test-table-container {
        overflow: visible !important;
        max-height: none !important;
    }

    .water-test-table {
        page-break-inside: auto !important;
    }

    .water-test-table thead {
        display: table-header-group !important;
    }

    .water-test-table tr {
        page-break-inside: avoid !important;
    }

    /* Ensure MudAlert prints properly */
    .mud-alert {
        page-break-inside: avoid !important;
        border: 1px solid #2196f3 !important;
        padding: 8px !important;
        margin-bottom: 10px !important;
    }
}

/* Additional styling for water microbial page */
@media print {
    .water-microbial-page {
        page-break-inside: auto !important;
    }

    /* Print-friendly caption styling */
    .mud-typography-caption {
        font-size: 8pt !important;
        color: #666 !important;
        margin-bottom: 5mm !important;
    }
}

/* Keep water parameters section together */
@media print {
    .water-parameters-section {
        page-break-inside: avoid !important;
        margin-top: 15mm !important;
    }

    /* Ensure the entire water section flows properly */
    .water-microbial-section .mud-table-container {
        overflow: visible !important;
    }
}