/* client/static/css/export.css */

/* =========================================
   REPORT MODAL (Mirrors Invoice Modal)
   ========================================= */
.report-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 10px; /* Padding for mobile edges */
    box-sizing: border-box;
    overflow: hidden; /* Prevent body scroll */
}

.report-modal.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

/* Report Content Wrapper (Scrollable) */
.report-content {
    position: relative;
    z-index: 3002;
    width: 100%;
    max-width: 210mm; /* A4 Width Limit */
    max-height: 95vh; /* Keep within viewport height */
    overflow-y: auto; /* Enable Vertical Scrolling */
    overflow-x: hidden;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: 4px;

    /* Scrollbar Styling */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.report-content::-webkit-scrollbar { width: 8px; }
.report-content::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

/* Dark Backdrop */
.report-backdrop {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
}

/* =========================================
   REPORT PAPER (Visual & Print Target)
   ========================================= */
.report-paper {
    background: #ffffff !important;
    width: 100%;
    min-height: 297mm;
    margin: 0; /* Auto margin handled by parent */
    padding: 15mm 20mm;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    direction: rtl;
    font-family: 'Vazirmatn', 'Tahoma', 'Segoe UI', sans-serif;
    color: #000000 !important;
    box-sizing: border-box;
    position: relative;
    border-radius: 2px;
}

/* --- Header Section --- */
.report-header {
    border-bottom: 2px solid #1e3a8a;
    padding-bottom: 20px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand h1 {
    font-size: 16pt;
    color: #1e3a8a !important;
    margin: 0;
    font-weight: 800;
}

.header-brand p {
    font-size: 10pt;
    color: #64748b !important;
    margin: 5px 0 0 0;
}

.header-meta {
    text-align: left;
    font-size: 9pt;
}

.header-meta .meta-row {
    margin-bottom: 4px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.header-meta .label {
    font-weight: 600;
    color: #444444 !important;
}

.header-meta .value {
    color: #000000 !important;
    direction: rtl;
    unicode-bidi: embed;
}

/* --- Device Info Grid --- */
.device-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px 30px;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 30px;
    font-size: 10pt;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    color: #64748b !important;
    font-size: 8.5pt;
    margin-bottom: 4px;
}

.info-value {
    font-weight: bold;
    color: #0f172a !important;
    font-size: 10.5pt;
}

/* --- Data Table --- */
.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    margin-bottom: 20px;
}

.report-table th {
    background-color: #1e3a8a !important;
    color: #ffffff !important;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    border: 1px solid #1e3a8a;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.report-table td {
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    color: #000000 !important;
    text-align: center;
}

.report-table tr:nth-child(even) {
    background-color: #f1f5f9 !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
}

.ltr-col,
.ltr-text {
    direction: ltr;
    unicode-bidi: embed;
    font-family: 'Courier New', monospace;
}

/* --- Footer --- */
.report-footer {
    margin-top: 40px;
    padding-top: 15px;
    border-top: 1px dashed #cbd5e1;
    font-size: 8pt;
    color: #94a3b8 !important;
    display: flex;
    justify-content: space-between;
}

/* =========================================
   ACTION BUTTONS (Mirrors Invoice Actions)
   ========================================= */
.report-actions {
    display: flex;
    justify-content: flex-end; /* Align right (or left in RTL) */
    gap: 10px;
    padding: 0 5px 10px 5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* =========================================
   PRINT MEDIA QUERY
   ========================================= */
@media print {
    body > *:not(.report-modal) {
        display: none !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .report-modal {
        position: absolute;
        top: 0; left: 0; width: 100%;
        background: white;
        display: block !important;
        padding: 0; margin: 0;
        overflow: visible;
        z-index: 9999;
    }

    .report-content {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        max-width: none !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        height: auto !important;
    }

    .report-paper {
        margin: 0; padding: 0;
        box-shadow: none;
        width: 100%;
        border: none;
        background: white !important;
    }

    .report-actions, .report-backdrop {
        display: none !important;
    }

    @page {
        size: A4;
        margin: 15mm;
    }
}