/* ==========================================================================
   Print Stylesheet สำหรับรายงานบัญชีขนาด A4 ตามมาตรฐานรายงานทางการเงินไทย
   ========================================================================== */

@page {
    size: A4 portrait;
    margin: 15mm 15mm 15mm 15mm;
}

@media print {
    /* ซ่อนส่วนประกอบ UI ที่ไม่จำเป็นสำหรับการพิมพ์ */
    body {
        background-color: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt !important;
        line-height: 1.4 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    aside, 
    nav, 
    header, 
    .no-print, 
    #sidebar, 
    #top-nav, 
    .btn, 
    button, 
    .action-buttons,
    #modal-container,
    .filter-section,
    .notification-toast {
        display: none !important;
    }

    /* จัดโครงสร้างของ Container หลักให้เต็มกระดาษ */
    #main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        box-shadow: none !important;
    }

    .printable-report {
        display: block !important;
        page-break-after: always;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ตารางรายงานสำหรับการพิมพ์ */
    table.print-table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-top: 15px !important;
        margin-bottom: 20px !important;
        page-break-inside: auto;
    }

    table.print-table th, 
    table.print-table td {
        border: 1px solid #666666 !important;
        padding: 6px 8px !important;
        font-size: 10pt !important;
    }

    table.print-table th {
        background-color: #f1f5f9 !important;
        font-weight: bold !important;
        text-align: center !important;
    }

    table.print-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    /* สรุปยอดรวมและตัวเลขเน้น */
    .print-total-row {
        background-color: #f8fafc !important;
        font-weight: bold !important;
        border-top: 2px solid #000 !important;
        border-bottom: 3px double #000 !important;
    }

    /* บล็อกลายเซ็นผู้อนุมัติและผู้จัดทำ */
    .print-signature-section {
        display: flex !important;
        justify-content: space-between !important;
        margin-top: 50px !important;
        page-break-inside: avoid;
    }

    .signature-box {
        width: 30% !important;
        text-align: center !important;
        font-size: 10pt !important;
    }

    .signature-line {
        margin-top: 45px !important;
        border-bottom: 1px dotted #333333 !important;
        margin-bottom: 8px !important;
    }

    /* หัวรายงานทางการ */
    .official-header {
        text-align: center !important;
        margin-bottom: 20px !important;
        border-bottom: 2px solid #0f172a !important;
        padding-bottom: 10px !important;
    }

    .official-header h1 {
        font-size: 16pt !important;
        font-weight: bold !important;
        margin-bottom: 4px !important;
    }

    .official-header h2 {
        font-size: 13pt !important;
        font-weight: 600 !important;
        margin-bottom: 4px !important;
    }

    .official-header p {
        font-size: 9.5pt !important;
        color: #333333 !important;
        margin: 2px 0 !important;
    }
}
