/* Print Overrides - Fixes 1cm cutoff issue caused by Bootstrap's @page defaults */
@media print {
    /* Override Bootstrap's a3 page size and set proper A4 with minimal margins */
    @page {
        size: A4 !important;
        margin: 1.0cm 0.5cm 0.5cm 1.0cm !important;
    }

    /* Reset all elements to ensure no inherited margins/paddings */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    /* Remove all margins and paddings from body/html */
    html, body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        min-width: 0 !important;
        width: 100% !important;
        height: auto !important;
    }

    /* Remove margins/paddings from all wrapper elements */
    #kt_wrapper,
    #kt_content,
    .wrapper,
    .content,
    .container-fluid,
    .row {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Set column widths for print */
    .col-lg-10,
    .col-12 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Add additional padding to the content area (on top of @page margins) */
    .onepager-content {
        padding: 1cm 0.5cm !important;
        background: white !important;
        margin: 0 !important;
    }

    /* Ensure first section has no extra top margin */
    .onepager-content section:first-of-type {
        margin-top: 0 !important;
    }

    /* Remove ALL card backgrounds/borders in header section */
    section[id="header"] *[class*="card"],
    .onepager-content > section:nth-child(2) *[class*="card"] {
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        border: none !important;
        box-shadow: none !important;
    }

    section[id="header"] .card-body,
    section[id="header"] [class*="card-body"],
    .onepager-content > section:nth-child(2) .card-body,
    .onepager-content > section:nth-child(2) [class*="card-body"] {
        background: transparent !important;
        background-color: transparent !important;
        padding: 0.5rem 0 !important;
    }

    /* Hide feedback button in print */
    .feedback-btn {
        display: none !important;
    }

    /* Hide left side menu in print */
    .aside,
    #kt_aside {
        display: none !important;
    }

    /* Hide modals, overlays, popups, and close buttons */
    .modal,
    .modal-backdrop,
    .modal-dialog,
    .offcanvas,
    .offcanvas-backdrop,
    .popover,
    .tooltip,
    .dropdown-menu,
    .close,
    .btn-close,
    [data-dismiss],
    [data-bs-dismiss],
    .overlay,
    .swal2-container,
    .swal2-popup {
        display: none !important;
    }

    /* Remove position fixed/sticky which causes elements to repeat on every printed page */
    /* This is a browser feature - fixed/sticky elements repeat on each page */
    * {
        position: static !important;
    }

    .onepager-content,
    .onepager-content * {
        position: relative !important;
    }

    /* Hide user avatars in print view */
    .symbol.symbol-circle {
        display: none !important;
    }

    /* Hide avatar images */
    .symbol img[src*="Avatar"],
    .symbol-label[style*="AvatarUrl"] {
        display: none !important;
    }

    /* Bootstrap column overrides for consistent print layout */
    /* These provide fallback values; component-specific rules take precedence */
    .col-md-3 {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }

    .col-md-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    .col-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }

    /* Allow flexible columns to auto-size */
    .col-lg:not([class*="col-lg-"]),
    .col-md:not([class*="col-md-"]),
    .col-sm:not([class*="col-sm-"]) {
        flex: 0 0 auto !important;
        max-width: none !important;
    }
}
