﻿/* wwwroot/css/print.css */
@media print {
    @page { size: A4; margin: 0.6cm; background: #fff !important; }

    /* Hide interactive controls and filter block in print */
    #controls, #controls * { display: none !important; }
    .no-print { display: none !important; }

    /* Highest-specificity overrides for elements that previously set the project background */
    html body .col-md-11,
    html body .col-md-11 > .table-responsive,
    html body .col-md-11 .table-responsive,
    html body .main-content,
    html body .druckbereich,
    html body .druckbereich .col-md-11,
    html body .container,
    html body .container-fluid,
    html body .row,
    html body .table,
    html body .table th,
    html body .table td,
    html body .table-responsive,
    html body .card,
    html body .list-group-item,
    html body .sidebar,
    html body .col-md-1 {
        background: #fff !important;
        background-color: #fff !important;
        background-image: none !important;
        box-shadow: none !important;
        color: #000 !important;
    }

    /* Remove any background images/gradients globally first */
    *, *::before, *::after {
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        box-shadow: none !important;
    }

    /* Make sure the print area is visible and sized to page minus margins */
    body * { visibility: hidden !important; }
    .druckbereich, .druckbereich * { visibility: visible !important; }

    .druckbereich {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: calc(100% - 1.2cm) !important; /* account for 0.6cm page margins */
        overflow: visible !important;
        background: #fff !important;
        background-color: #fff !important;
    }

    /* Ensure table cells are white */
    table, .table, table th, table td, .table th, .table td { background: #fff !important; background-color: #fff !important; color: #000 !important; }

    /* Remove backgrounds from pseudo elements which can cause colored stripes */
    .druckbereich *::before, .druckbereich *::after { background: transparent !important; background-color: transparent !important; box-shadow: none !important; }

    /* Make sure any scrolling containers expand for print instead of showing scrollbars */
    .druckbereich, .druckbereich * { overflow: visible !important; max-height: none !important; height: auto !important; }

    /* Hide interactive controls that are irrelevant on paper */
    input, button, select, textarea, .form-check-input, .form-check-label { display: none !important; }

    /* Hide any visible scrollbars in print preview */
    *::-webkit-scrollbar { display: none !important; }

    /* Final safety: force all backgrounds to white for print (highest specificity)
       This overrides any project-wide bg rules including !important ones. */
    html, body, html * , html *::before, html *::after {
        background: #fff !important;
        background-color: #fff !important;
        background-image: none !important;
        box-shadow: none !important;
        color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
        forced-color-adjust: none !important;
        -ms-high-contrast-adjust: none !important;
    }

    /* Ensure table cells and large containers also white */
    html body table, html body table th, html body table td, html body .table, html body .table th, html body .table td,
    html body .container, html body .container-fluid, html body .row, html body .col-md-11, html body .druckbereich {
        background: #fff !important;
        background-color: #fff !important;
        background-image: none !important;
    }

    /* Remove background gradients/images from everything */
    *, *::before, *::after { background-image: none !important; }

    /* --- Increase font size for order overview print layout --- */
    /* Override smaller inline/view styles: target only the print area and the order table */
    .druckbereich .order-table,
    .druckbereich .order-table th,
    .druckbereich .order-table td,
    .druckbereich .beschreibung-col,
    .druckbereich .address,
    .druckbereich h4 {
        font-size: 12pt !important;
        line-height: 1.15 !important;
    }

}
