/* UTILITIES */
.hidden { display: none !important; }

/* PRINT STYLES */
@media print {
    @page { 
        size: A4 portrait; 
        margin: 10mm; 
    }
    
    body { 
        background-color: white !important; 
        color: black !important;
        margin: 0 !important;
        -webkit-print-color-adjust: exact; /* Print Backgrounds */
        print-color-adjust: exact;
    }

    body * { visibility: hidden; height: 0; }

    /* VISIBILITY CONTROLS */
    #webResultContainer, 
    #webResultContainer * {
        visibility: visible !important;
        height: auto !important;
        display: block; 
    }

    /* POSITIONING */
    #webResultContainer {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    /* TOP BANNER */
    .print-top-url {
        display: block !important;
        visibility: visible !important;
        text-align: center;
        margin-bottom: 10px;
    }
    .print-top-url p {
        font-size: 14px !important;
        color: #2563EB !important;
        text-decoration: underline !important;
        font-weight: bold !important;
    }

    /* HEADER */
    .print-only-header { 
        display: block !important; 
        visibility: visible !important; 
        margin-bottom: 20px; 
        text-align: center; 
    }
    
    /* HIDE WEB ELEMENTS */
    .no-print, #searchBox, #loadingMsg, nav, footer, .bg-yellow-50 { display: none !important; }

    /* TABLE FIXES (The Critical Part) */
    table { 
        width: 100% !important; 
        border-collapse: collapse !important; 
        display: table !important; 
        table-layout: fixed !important; /* Forces columns to respect widths */
    }
    thead { display: table-header-group !important; }
    tbody { display: table-row-group !important; }
    tr { display: table-row !important; }
    
    /* Define Column Widths for Print */
    th:nth-child(1), td:nth-child(1) { width: 20% !important; }
    th:nth-child(2), td:nth-child(2) { width: 25% !important; }
    th:nth-child(3), td:nth-child(3) { width: 20% !important; }
    th:nth-child(4), td:nth-child(4) { width: 35% !important; }

    td, th { 
        display: table-cell !important; 
        border: 1px solid #ccc !important; 
        padding: 8px !important; 
        text-align: left;
    }
}