/* =========================================================
   1. GLOBAL PRINT SETTINGS
   ========================================================= */
@media print {
    @page {
        size: letter landscape;
        margin: 0.25in;
    }
}

/* =========================================================
   2. SCREEN VIEW
   ========================================================= */
.card-box {
    width: 5in;
    height: 3.5in;
    border: 1px dashed #ccc;
    float: left;
    margin: 10px;
    padding: 0.15in;
    box-sizing: border-box;
    background: white;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* =========================================================
   3. PRINTER VIEW - REPORTS ("Nuclear" Method)
   ========================================================= */
@media print {
    
    /* -----------------------------------------------------
       IF PRINTING REPORTS: DELETE SIDEBARS & UI
    ----------------------------------------------------- */
    body.printing-reports .btn,
    body.printing-reports .nav-tabs,
    body.printing-reports .navbar,
    body.printing-reports #view-lobby,
    body.printing-reports #sidebar-col,
    body.printing-reports #sidebar-col-mgmt,
    body.printing-reports #sidebar-col-vet,
    body.printing-reports .d-print-none {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* FORCE CONTENT TO FULL WIDTH */
    body.printing-reports .container,
    body.printing-reports .container-fluid,
    body.printing-reports .row,
    body.printing-reports .col,
    body.printing-reports .col-10,
    body.printing-reports .col-12,
    body.printing-reports #view-mgmt,
    body.printing-reports #view-vet {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        position: static !important;
    }

    /* REVEAL ONLY THE REPORT DATA */
    body.printing-reports * { visibility: hidden; } /* Hide everything first */
    
    /* Whitelist the report containers */
    body.printing-reports #mgmt-report-area, 
    body.printing-reports #mgmt-report-area *,
    body.printing-reports #vet-master-log-area,
    body.printing-reports #vet-master-log-area *,
    body.printing-reports #patient-history-output,
    body.printing-reports #patient-history-output * {
        visibility: visible !important;
    }

    /* MOVE REPORT TO TOP LEFT */
    body.printing-reports #mgmt-report-area,
    body.printing-reports #vet-master-log-area,
    body.printing-reports #patient-history-output {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
    }

    /* TABLE STYLING FOR COMPLIANCE */
    body.printing-reports table {
        width: 100% !important;
        border: 2px solid black !important;
        border-collapse: collapse !important;
        font-size: 10pt !important;
        color: black !important;
    }
    body.printing-reports th, body.printing-reports td {
        border: 1px solid black !important;
        padding: 5px !important;
    }

    /* -----------------------------------------------------
       IF PRINTING CAGE CARDS
    ----------------------------------------------------- */
    body.printing-cards * { visibility: hidden; }
    body.printing-cards #printable-cards-container, 
    body.printing-cards #printable-cards-container * { visibility: visible; }
    
    body.printing-cards #printable-cards-container {
        position: absolute; left: 0; top: 0; width: 100%; padding: 0.5in;
    }
    body.printing-cards .card-box {
        border: 1px solid black; margin: 0; float: left; page-break-inside: avoid;
    }
    body.printing-cards .card-box:nth-child(4n) { page-break-after: always; }
}