@media print {
@page {
        margin-top: 10mm !important; /* No initial margin to prevent title and URL */
        margin-bottom: 10mm !important; /* Allow space at the bottom for last page content */
        margin-left: 10mm !important; /* Adjust left margin */
        margin-right: 10mm !important; /* Adjust right margin */
    }
    
    .table-container {
        margin-top: -10mm !important; /* Use negative margin to avoid triggering title/URL */
    }
    

    /* Prevent the page title and URL (which are usually added by the browser) */
    body {
        margin: 0 !important;
        padding: 0 !important;
        /* Hide any browser-inserted elements */
        display: block !important; /* Ensure no unexpected content */
    }

   table, th, td {
        border: 1px solid #000 !important; /* Border for table and cells */
        border-collapse: collapse !important; /* Ensures no spacing between table cells */
    }

    /* Apply styles to .tabledarkbg class for headers */
    .tabledarkbg {
        background-color: #333 !important; /* Dark background for the header */
        color: white !important; /* White text */
    }

    /* Apply additional styling to nested .tableheader inside the th */
    .tabledarkbg .tableheader {
        background-color: #333 !important; /* Ensures the div inside <th> has the same dark background */
        color: white !important; /* White text color for the nested div */
        padding: 5px; /* Optional: Add padding for better readability */
    }

    /* Ensure all th and td inside table have the right background and text colors */
    th, td {
        background-color: #fff !important; /* White background for cells */
        color: #000 !important; /* Black text color */
    }

    /* Optional: Strip the padding or margin for better print formatting */
    .table th, .table td {
        padding: 5px !important; /* Adjust padding for better printing */
    }

    /* Apply striping to table rows (odd rows have a light gray background) */
    .table-striped tbody tr:nth-child(odd) {
        background-color: #f2f2f2 !important; /* Light gray for odd rows */
    }

    /* Ensure page break after each table */
    table {
        page-break-after: always !important;
    }
  tr {
        page-break-inside: avoid !important; /* Prevent breaking rows across pages */
    }
   
    
    table {
        page-break-after: always !important;
    }

    body {
        margin: 0;
        padding: 0;
        /* Inherit background image from the theme, no need for explicit path */
        background: inherit !important; /* Inherits the background from the page (including background-image) */
    }

    #print-button {
        display: none !important; /* Hide the print button in print view */
    }

    header, nav, footer, .sidebar {
        display: none !important; /* Hide unwanted sections */
    }

    h2 {
        margin: 0 !important; /* Remove the 30% margin for h2 in print */
    }
    
    /* Table borders for print */
    table, th, td {
        border: 1px solid black; /* Add border for print version */
        border-collapse: collapse; /* Ensures clean borders */
    }
}
#print-button {
    background-color: #007bff; /* Blue button color */
    color: white; /* White text */
    border: none;
    padding: 10px 15px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 8px; /* Space between icon and text */
}

#print-button:hover {
    background-color: #0056b3; /* Darker blue on hover */
}

.print-icon {
    font-size: 18px; /* Icon size */
}
