/* ============================================================================
   print.css — สไตล์กลางสำหรับ "ส่งออกเป็น PDF" (พิมพ์ผ่านเบราว์เซอร์ → บันทึกเป็น PDF)
   ใช้ร่วมกันได้ทุกหน้า: ซ่อนเมนู/ปุ่ม/องค์ประกอบที่ไม่ต้องการในกระดาษ
   แล้วจัดหน้าให้เป็น A4 พร้อมพิมพ์
   วิธีใช้: <link rel="stylesheet" href="css/print.css" />  แล้วใส่คลาส .no-print
           ให้กับปุ่ม/กล่องที่ไม่ต้องพิมพ์
   ============================================================================ */

@page {
    size: A4 portrait;
    margin: 14mm 12mm;
}

@media print {
    /* ---------- ทับค่าตั้งต้นของ Bootstrap ----------
       css/styles.css ตั้ง @page { size: a3 } และ min-width: 992px !important ให้ body/.container
       ทำให้พิมพ์ลง A4 แล้วเนื้อหาถูกตัดขอบขวา → ต้องล้างค่า min-width ทิ้ง */
    body,
    .container,
    .container-fluid,
    .container-sm,
    .container-md,
    .container-lg,
    .container-xl {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ---------- ซ่อนส่วนควบคุม/เมนู ---------- */
    .n2-side,
    .n2-mobilebar,
    .n2-overlay,
    .n2-fly,
    .n2-fly-bg,
    .nst-fixfoot,
    #floating-qr-btn,
    .no-print,
    .no-print * {
        display: none !important;
    }

    /* ---------- ยกเลิกการเว้นที่ให้เมนูซ้าย / footer ตรึงล่าง ---------- */
    html, body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    body.n2-has-sidebar,
    body {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .nst-main, .nst-shell, .page-section, .fh-section {
        padding: 0 !important;
        margin: 0 !important;
        min-height: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ---------- ให้สีพื้นหลัง/ขอบ ติดไปในไฟล์ PDF ---------- */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ---------- ลดเงา/มุมโค้งที่กินหมึก ---------- */
    .card, .shadow, .shadow-sm, .vgn, .fh-card {
        box-shadow: none !important;
    }
    .card { border: 1px solid #d8e6f2 !important; }
    .card-header { border-radius: 0 !important; }

    /* ---------- ไม่ให้เนื้อหาขาดกลางหน้า ---------- */
    img, figure, table, tr, .card, .vg-shot, .fh-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    h1, h2, h3, h4 {
        break-after: avoid;
        page-break-after: avoid;
    }

    /* ---------- ที่อยู่ในลิงก์/ปุ่มไม่มีประโยชน์บนกระดาษ ---------- */
    .fh-btn, .vgn-btn, .nst-btn, .btn-reg, a.btn:not(.btn-keep) {
        display: none !important;
    }
    a[href]:after { content: '' !important; }
}
