/* ============================================================================
   ENTERPRISE MULTI-HARDWARE PRINT DISPATCHER SYSTEM
   Supports: Thermal 2-Inch (58mm), 3-Inch (80mm), 4-Inch (100mm) & Office A4
   ============================================================================ */

@media print {
    /* 1. Global Reset: Hide all interactive screen elements */
    body * {
        display: none !important;
    }
    
    /* 2. Isolate and expose the underlying receipt container component */
    #receipt-window, #receipt-window * {
        display: block !important;
    }

    #receipt-window {
        position: absolute;
        left: 0;
        top: 0;
        background: #fff;
        color: #000;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    /* 3. Global Structural Base Utilities for Thermal Tape Media Rollers */
    .thermal-receipt {
        font-family: 'Courier New', Courier, monospace;
        line-height: 1.4;
    }
    .receipt-row { 
        display: flex !important; 
        justify-content: space-between; 
        margin-bottom: 4px; 
    }
    .receipt-divider { 
        border-top: 1px dashed #000; 
        margin: 8px 0; 
    }
    .text-center { 
        text-align: center; 
    }
    .text-right {
        text-align: right;
    }

    /* ============================================================================
       PROFILE A: THERMAL 2-INCH LAYOUT STRUCTURE (58mm Rolls)
       ============================================================================ */
    #receipt-window.print-2inch {
        width: 58mm;
    }
    #receipt-window.print-2inch .thermal-receipt {
        font-size: 11px;
        padding: 0 2mm;
    }
    #receipt-window.print-2inch .a4-invoice-container {
        display: none !important; /* Safety lockout against desktop template leakages */
    }

    /* ============================================================================
       PROFILE B: THERMAL 3-INCH LAYOUT STRUCTURE (80mm Standard Rolls)
       ============================================================================ */
    #receipt-window.print-3inch {
        width: 80mm;
    }
    #receipt-window.print-3inch .thermal-receipt {
        font-size: 13px;
        padding: 0 4mm;
    }
    #receipt-window.print-3inch .a4-invoice-container {
        display: none !important;
    }

    /* ============================================================================
       PROFILE C: THERMAL 4-INCH LAYOUT STRUCTURE (100mm Logistics/Wide Rolls)
       ============================================================================ */
    #receipt-window.print-4inch {
        width: 100mm;
    }
    #receipt-window.print-4inch .thermal-receipt {
        font-size: 15px;
        padding: 0 5mm;
    }
    #receipt-window.print-4inch .a4-invoice-container {
        display: none !important;
    }

    /* ============================================================================
       PROFILE D: FLATBED OFFICE SHEET LAYOUT (Standard Corporate A4 Paper)
       ============================================================================ */
    #receipt-window.print-a4 {
        width: 210mm;
        padding: 15mm;
        font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
        color: #1e293b;
    }
    
    /* Enforce block visibility switches for template inversion swaps */
    #receipt-window.print-a4 .a4-invoice-container {
        display: block !important;
    }
    #receipt-window.print-a4 .thermal-receipt {
        display: none !important; /* Drop multi-column thermal roll tapes completely */
    }

    /* A4 Structural Blueprint Grid Components */
    .a4-grid-header { 
        display: flex !important; 
        justify-content: space-between; 
        margin-bottom: 35px; 
        border-bottom: 3px solid #1e3a8a;
        padding-bottom: 20px;
    }
    .a4-table { 
        width: 100%; 
        border-collapse: collapse; 
        margin: 25px 0; 
    }
    .a4-table th { 
        background: #f1f5f9 !important; 
        color: #1e3a8a;
        padding: 12px 10px; 
        border: 1px solid #cbd5e1; 
        text-align: left; 
        font-weight: 600;
        font-size: 14px;
    }
    .a4-table td { 
        padding: 12px 10px; 
        border: 1px solid #e2e8f0; 
        font-size: 14px;
    }
    .a4-ledger-summary {
        margin-left: auto; 
        width: 350px; 
        padding-top: 15px;
        font-size: 14px;
    }
    .a4-ledger-row {
        display: flex !important;
        justify-content: space-between;
        margin-bottom: 8px;
    }
    .a4-grand-total {
        display: flex !important;
        justify-content: space-between;
        font-size: 18px;
        font-weight: bold;
        color: #1e3a8a;
        border-top: 2px solid #1e3a8a;
        padding-top: 10px;
        margin-top: 10px;
    }
}