/* CSS for Printing (A4 Invoice & Small Thermal POS Receipt) */

/* Default Screen Hidden Containers */
#print-area-a4,
#print-area-receipt {
    display: none;
}

@media print {
    /* Hide screen UI */
    .app-sidebar,
    .top-header,
    .main-content,
    .modal-backdrop,
    .toast-container {
        display: none !important;
    }
    
    body {
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Print Setup for A4 Mode */
    body.print-mode-a4 #print-area-a4 {
        display: block !important;
        visibility: visible !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        padding: 15mm 15mm;
        box-sizing: border-box;
        font-family: 'Inter', Arial, sans-serif;
    }

    body.print-mode-a4 #print-area-a4 * {
        visibility: visible !important;
    }

    body.print-mode-a4 #print-area-receipt {
        display: none !important;
    }

    /* Print Setup for Small Thermal Receipt Mode (80mm) */
    body.print-mode-receipt #print-area-receipt {
        display: block !important;
        visibility: visible !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 78mm !important;
        padding: 2mm;
        box-sizing: border-box;
        font-family: monospace, Arial, sans-serif;
        font-size: 12px;
        line-height: 1.3;
    }

    body.print-mode-receipt #print-area-receipt * {
        visibility: visible !important;
    }

    body.print-mode-receipt #print-area-a4 {
        display: none !important;
    }

    @page {
        margin: 0;
    }
}

/* Styling for A4 Printable Document */
.a4-document {
    color: #1e293b;
    line-height: 1.5;
}

.a4-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #0284c7;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.a4-brand h1 {
    font-size: 26px;
    color: #0284c7;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.a4-brand p {
    font-size: 13px;
    color: #64748b;
}

.a4-invoice-meta {
    text-align: right;
}

.a4-invoice-meta h2 {
    font-size: 22px;
    color: #0f172a;
    margin-bottom: 5px;
}

.a4-invoice-meta p {
    font-size: 13px;
    color: #475569;
}

.a4-customer-section {
    display: flex;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.a4-box h3 {
    font-size: 13px;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 5px;
}

.a4-box p {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

/* A4 Prescription Table */
.a4-prescription-title {
    font-size: 15px;
    font-weight: 700;
    color: #0284c7;
    margin-bottom: 8px;
}

.a4-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.a4-table th, .a4-table td {
    border: 1px solid #cbd5e1;
    padding: 8px 12px;
    font-size: 13px;
    text-align: center;
}

.a4-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
}

.a4-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.a4-items-table th {
    background: #0284c7;
    color: #ffffff;
    padding: 10px 12px;
    font-size: 13px;
    text-align: left;
}

.a4-items-table td {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 12px;
    font-size: 13px;
}

.a4-totals-grid {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 25px;
}

.a4-totals-box {
    width: 320px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
}

.a4-total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 14px;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
}

.a4-total-row.grand-total {
    background: #f8fafc;
    font-weight: 700;
    font-size: 15px;
}

.a4-total-row.advance {
    color: #059669;
    font-weight: 600;
}

.a4-total-row.balance-due {
    background: #fef2f2;
    color: #dc2626;
    font-weight: 700;
    font-size: 16px;
}

.a4-footer {
    margin-top: 40px;
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #64748b;
}

.signature-line {
    border-top: 1px dashed #94a3b8;
    width: 160px;
    text-align: center;
    padding-top: 5px;
}

/* Styling for Small Thermal Receipt (80mm) */
.receipt-document {
    width: 100%;
    color: #000;
}

.receipt-header {
    text-align: center;
    border-bottom: 1px dashed #000;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.receipt-header h2 {
    font-size: 16px;
    font-weight: 800;
}

.receipt-meta {
    border-bottom: 1px dashed #000;
    padding-bottom: 6px;
    margin-bottom: 8px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
}

.receipt-prescription-table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0;
    font-size: 10px;
}

.receipt-prescription-table th, 
.receipt-prescription-table td {
    border: 1px solid #000;
    text-align: center;
    padding: 2px;
}

.receipt-totals {
    border-top: 1px dashed #000;
    border-bottom: 1px dashed #000;
    padding: 6px 0;
    margin-top: 6px;
}

.receipt-totals .bold {
    font-weight: bold;
    font-size: 13px;
}

.receipt-footer {
    text-align: center;
    margin-top: 10px;
    font-size: 11px;
}
