/* CSS for Modern Print Dashboard - Two per A4 sheet */

/* 1. Hide print area by default on screen */
#printArea {
    display: none;
}

@media print {

    /* 2. Configure A4 page with zero margins */
    @page {
        margin: 0;
        size: A4 portrait;
    }

    /* 3. Style body to reset margins and fonts */
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-family: 'Inter', Arial, sans-serif;
    }

    /* 4. Hide EVERYTHING except #printArea */
    body>*:not(#printArea) {
        display: none !important;
    }

    /* 5. Force #printArea to be visible and correctly positioned */
    #printArea {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
        visibility: visible !important;
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        /* Total A4 height */
        background: white !important;
        box-sizing: border-box;
    }

    /* 6. Wrapper for each quadrant (4 per A4 sheet) */
    .print-page-wrapper {
        height: 148.5mm;
        /* Half of A4 height (297mm) */
        width: 105mm;
        /* Half of A4 width (210mm) */
        padding: 4mm 6mm;
        box-sizing: border-box;
        border: 0.2mm dashed #cbd5e1;
        /* Visual indicator for cutting */
        page-break-inside: avoid;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        background: white !important;
        overflow: hidden;
    }

    /* Total page break logic */
    #printArea>div:nth-child(4n) {
        page-break-after: always;
    }

    .print-layout.modern {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
}

/* 7. Modern Print Layout Content Styles */
.print-layout.modern {
    width: 100%;
    color: #1e293b;
    font-size: 10px;
    /* Reduced for 4 per page */
}

.print-header-modern {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    /* Reduced */
    padding-bottom: 3px;
    border-bottom: 1px solid #f1f5f9;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #4f46e5;
    font-weight: 800;
    font-size: 13px;
    /* Smaller */
}

.logo-area img {
    height: 22px !important;
    /* Smaller logo */
}

.order-meta {
    text-align: right;
    font-size: 8px;
    /* Tighter */
    color: #64748b;
}

.print-client-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 8px;
    /* Compact */
    margin-bottom: 4px;
}

.client-header {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 8px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 1px;
    text-transform: uppercase;
}

.client-details p {
    margin: 0;
    font-size: 9px;
    /* Smaller */
    line-height: 1.1;
}

.print-section-title-modern {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 8px;
    /* Critical space saver */
    font-weight: 800;
    color: #1e293b;
    margin: 2px 0 1px 0;
    text-transform: uppercase;
}

.print-items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* Back to 2 columns for better labels */
    gap: 4px;
    margin-bottom: 4px;
}

.print-item-card {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
}

.print-item-card.has-value {
    background: #f0f7ff;
    border-color: #3b82f6;
}

.print-item-card i {
    font-size: 14px;
    /* Smaller icons */
}

.print-item-card .label {
    font-size: 9px;
    font-weight: 700;
    flex: 1;
}

.print-qty-badge {
    background: #4f46e5;
    color: white;
    padding: 0px 4px;
    border-radius: 2px;
    font-size: 8px;
    font-weight: 800;
}

.print-pro-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1px 6px;
    /* Ultra compact */
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 3px;
    margin-bottom: 0px;
    /* Reduced gap */
}

.print-pros-list {
    display: flex;
    flex-direction: column;
    gap: 1.5px;
}

.print-pros-list.grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
}

.print-pro-card strong {
    font-size: 9px;
}

.print-pro-card span {
    font-size: 8px;
    color: #64748b;
}

.print-pro-card .total {
    font-weight: 800;
    font-size: 9px;
}

.print-financial-modern {
    margin-top: 2px;
    padding: 3px 8px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 4px;
}

.financial-row {
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    /* Compact */
    margin-bottom: 0px;
}

.financial-divider {
    height: 1px;
    background: #cbd5e1;
    margin: 3px 0;
}

.financial-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.financial-total label {
    font-size: 8px;
    font-weight: 800;
    color: #64748b;
    margin: 0;
}

.total-value {
    font-size: 14px;
    /* Scaled down */
    font-weight: 900;
    line-height: 1;
    color: #059669;
}

.print-payment-modern {
    margin-top: 4px;
    border: 1px dashed #cbd5e1;
    padding: 4px;
    border-radius: 4px;
}

.print-payment-modern p {
    font-size: 8px;
    font-weight: 700;
    margin: 0 0 2px 0;
}

.payment-grid-modern {
    display: flex;
    gap: 10px;
}

.p-item {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    font-weight: 600;
}

.p-item .box {
    width: 10px;
    height: 10px;
    border: 1px solid #1e293b;
    border-radius: 1px;
}

.print-footer-modern {
    text-align: center;
    font-size: 9px;
    color: #94a3b8;
    margin-top: 12px;
}