/* css/styles.css */

/* Floating Alert Container */
#alertContainer {
    z-index: 1055;
    margin-top: 20px;
}

/* -------------------------------------
   Code Box Display (Screen View)
-------------------------------------- */
.code-box {
    border: 1px dashed #ccc;
    padding: 10px;
    margin: 5px;
    font-family: monospace;
    font-size: 16px;
    text-align: center;
    display: inline-block;
    width: calc(25% - 10px); /* 4 columns on screen */
    background: #f8f9fa;
}

/* -------------------------------------
   Print-Specific Styles
-------------------------------------- */
@media print {
    /* Hide the background UI completely so it takes up zero space */
    .navbar, .container.no-print, .toast-container, .modal-backdrop, .modal-header, .modal-footer {
        display: none !important;
    }

    /* Reset body and html to allow natural multi-page scrolling */
    html, body {
        visibility: visible !important;
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Release modal from fixed/absolute positioning so it can paginate */
    .modal, .modal-dialog, .modal-content, .modal-body {
        position: static !important; 
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: none !important;
    }

    /* Force the container into a Flexbox Grid */
    #printArea {
        display: flex !important;
        flex-wrap: wrap !important;
        width: 100% !important;
        gap: 10px; /* Space between boxes */
    }

    /* Code box styling for paper - Strict 3 Columns */
    .code-box {
        display: block !important;
        border: 1px solid #000 !important;
        padding: 10px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        font-family: monospace !important;
        font-size: 18px !important;
        font-weight: bold !important;
        text-align: center !important;
        
        /* 33.33% minus the gap space to fit exactly 3 per row */
        width: calc(33.33% - 10px) !important; 
        page-break-inside: avoid !important;
    }

    /* --- NEW: FINAL RESULTS PRINTING --- */
    
    /* When 'printing-results' is active, hide everything by default */
    body.printing-results * {
        visibility: hidden;
    }
    
    /* Only make the final results section visible */
    body.printing-results #finalResultsSection, 
    body.printing-results #finalResultsSection * {
        visibility: visible;
    }
    
    /* Position the results at the top of the printed page */
    body.printing-results #finalResultsSection {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    /* Hide the print button itself on the physical paper */
    #printResultsBtn {
        display: none !important;
    }

    /* Remove background colors and shadows to save ink */
    .card {
        border: none !important;
        box-shadow: none !important;
    }
}