/*
 * Dedicated print stylesheet for the Printing Service "Print Layout" designer
 * (PrintLayoutPreview.razor) — deliberately self-contained and NOT coupled to reports-print.css /
 * ReportViewer.razor.css. That pipeline exists for the Reports module's paginated, measured,
 * multi-page-size viewer (Annual Sales' JS-measured page breaks, html2pdf export, a paper-size
 * picker) — none of which this feature needs. The goal here is narrower: print one plain,
 * correctly-sized A4 document, letting the browser paginate naturally onto extra sheets if the
 * content is long, instead of clipping it to a fixed page box.
 *
 * @page { size: A4; margin: 0 } is already declared globally by reports-print.css and applies
 * site-wide — not redeclared here to avoid a second, potentially-diverging copy of the same rule.
 */

.print-layout-page {
    box-sizing: border-box;
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 18mm;
    background: #fff;
    box-shadow: 0 4px 18px rgb(16 24 40 / 12%);
}

@media print {
    /* Print only what's inside .print-layout-print-area — everything else on the settings page
       (sidebar, wizard tabs, the config panel, etc.) is hidden. This has to live in a global
       stylesheet, not a component's scoped .razor.css: Blazor's CSS isolation only ever tags
       elements actually written in that one component with its scope attribute, so a scoped
       "body *" could never reach markup rendered by any other component on the page. */
    body * {
        visibility: hidden !important;
    }

    .print-layout-print-area,
    .print-layout-print-area * {
        visibility: visible !important;
    }

    .print-layout-print-area {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        background: #fff !important;
    }

    .print-layout-page {
        width: 100% !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 18mm !important;
        box-shadow: none !important;
    }

    /* No fixed page height and no overflow:hidden anywhere above — a summary longer than one A4
       page is meant to flow onto additional physical sheets normally, not get cut off. These just
       stop an individual section/field/table row from being split awkwardly across that break. */
    .production-form-preview-section,
    .print-layout-field,
    .template-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
