@media print {
    /* Force background images and colors to print */
    * {
        -webkit-print-color-adjust: exact !important; /* Chrome & Safari */
        print-color-adjust: exact !important; /* Modern browsers */
    }

    /* Ensure all div elements keep their backgrounds */
    div {
        background-color: inherit !important;
        background-image: inherit !important;
    }

    /* Hide unnecessary elements */
    header, footer {
        display: none !important;
    }

    /* Ensure elements follow a natural flow and prevent overlap */
    .elementor-element {
        display: block !important;
        width: 100% !important;
        position: static !important;
        float: none !important;
        clear: both !important;
        overflow: hidden !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid !important;
    }

    /* Ensure inner containers also follow block formatting */
    .elementor-widget-container {
        display: block !important;
        width: 100% !important;
        position: relative !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid !important;
    }

    /* Ensure readable text */
    body, p, span {
        font-size: 12pt !important;
        line-height: 1.5 !important;
        margin-bottom: 15px !important;
    }

    /* Ensure links are visible and display URLs in print */
    a {
        text-decoration: none !important;
        color: black !important;
        word-break: break-word !important;
    }

    a[href]:after {
        content: " (" attr(href) ") ";
        font-size: 90% !important;
    }

    /* Ensure images fit properly and don’t break */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid !important;
    }
 
    .elementor-element:last-child { 
    }
    
    /* Hide elements that shouldn't appear in print */
    .site-header, .site-footer, .sidebar, .navigation, .comments, .ads {
        display: none !important;
    }

    /* Print-specific header */
    .print-header {
        display: block !important;
        text-align: center;
        font-size: 16px;
        font-weight: bold;
        margin-bottom: 20px;
    }

    /* Print-specific footer */
    .print-footer {
        display: block !important;
        text-align: center;
        font-size: 12px;
        margin-top: 50px;
        border-top: 1px solid #000;
        padding-top: 10px;
    }

    /* Page break handling */
    .page-break {
        page-break-before: always;
    }
}
}
