/* =============================================================================
   print-popup.css — ورقة الطباعة المشتركة لكل ما يُطبع من نافذة المتصفّح.
   -----------------------------------------------------------------------------
   لماذا ملفٌّ واحد: دالّة `Popup()` مكرّرة في **70 موضعًا** في المشروع، ولا
   واحدة منها تضبط مقاس الورقة — فكل جدول حضور وجدول حصص وتقرير سلوك وكشف
   حافلات يخرج على ما في الطابعة، وعلى Letter الأمريكيّ في معاينة المتصفّح.
   ومصر تطبع على A4.                                                (2026-09-13)
   ========================================================================== */

@page { size: A4; margin: 12mm 10mm; }

@media print {
    /* الألوان تُطبع كما تُعرض: بدونها تخرج رؤوس الجداول بيضاء بلا حدّ فتضيع
       بنية الجدول على الورق. */
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

    html, body { background: #fff !important; }
    body { font-family: Cairo, Tahoma, Arial, sans-serif; font-size: 11pt; color: #1d2430; }

    /* عناصر الشاشة لا مكان لها على الورق. */
    .no-print, .noprint, .btn, button, nav, .navbar, .sidebar, .main-sidebar,
    .main-header, .main-footer, .dataTables_filter, .dataTables_length,
    .dataTables_paginate, .dataTables_info, .paging_simple_numbers,
    .dt-buttons, .box-tools, .pagination { display: none !important; }

    /* الجداول: لا تُقصّ صفوفها بين صفحتين، ويتكرّر رأسها في كل صفحة. */
    table { width: 100% !important; border-collapse: collapse !important;
            page-break-inside: auto; }
    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }
    tr    { page-break-inside: avoid; page-break-after: auto; }
    th, td { border: 1px solid #b9c0cb !important; padding: 4px 6px !important;
             font-size: 9.5pt !important; }
    th { background: #f1f3f6 !important; font-weight: 700; }

    /* الأرقام والمبالغ لا تُكسر عبر سطرين ولا تنقلب اتجاهًا وسط نصّ عربيّ. */
    td.num, th.num, .amount, .money, .text-right { white-space: nowrap; }

    a[href]:after { content: "" !important; }   /* لا يُطبع الرابط بين قوسين */
    img { max-width: 100% !important; }
}

/* nmPrintOnly (print-window.js, 2026-10-22): جزءٌ واحد من الصفحة يُطبع بتنسيقها نفسه — يُخفى كل ما خارج فرعه
   (الترويسة، الشريط السفلي، القوائم)، وتُصفَّر حواشي آبائه التي تحجز مكان الترويسة الثابتة. */
@media print {
    html.nm-printing body > :not(.nm-pp),
    html.nm-printing .nm-pp:not(.nm-pp-root) > :not(.nm-pp) { display: none !important; }
    html.nm-printing .nm-pp:not(.nm-pp-root) {
        margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important;
        min-height: 0 !important; max-width: none !important; width: auto !important;
        position: static !important; transform: none !important; background: #fff !important;
    }
    html.nm-printing .nm-pp-root { margin: 0 !important; box-shadow: none !important; filter: none !important; }
    /* ما يُطلب من الشاشة لا يُطبع: أزرار الشهادتين والمشاركة، ونموذج التظلّم. */
    html.nm-printing .no_print, html.nm-printing .nmx-ap-form, html.nm-printing .nmx-docs { display: none !important; }
    /* سطور للورق وحده (اسم الطالب): مخفيّة على الشاشة بـ .hide */
    html.nm-printing .nm-print-show.hide { display: block !important; }
    html.nm-printing .nmx-print-name { font-size: 14pt; font-weight: 700; margin: 0 0 8px; color: #1d2430; }
    html.nm-printing tr.nm-print-show.hide { display: table-row !important; }
    /* الطباعة من نافذةٍ منبثقة (جدول الامتحان): الصفحة تحت النافذة مقفولة التمرير (modal-open)، وأيّ صندوق تمريرٍ
       داخل الجزء يقصّ ما تحته — كلاهما يُفتح على الورق فلا تقف الطباعة عند أوّل صفحة. */
    html.nm-printing, html.nm-printing body { overflow: visible !important; height: auto !important; }
    html.nm-printing .nm-pp { overflow: visible !important; max-height: none !important; height: auto !important; }
    html.nm-printing .nm-pp-root .scroll-area, html.nm-printing .nm-pp-root .scroll-full, html.nm-printing .nm-pp-root .scroll-full-70,
    html.nm-printing .nm-pp-root .table-responsive, html.nm-printing .nm-pp-root .modal-body { overflow: visible !important; max-height: none !important; height: auto !important; }
    html.nm-printing .modal-footer, html.nm-printing .modal-header .close { display: none !important; }
    /* نافذةٌ على الفرع المطبوع تُعرض وإن أخفت الصفحة .modal في الطباعة (جدول الامتحانات كان يُخفيها لطريقته القديمة). */
    html.nm-printing .modal.nm-pp { display: block !important; opacity: 1 !important; }
    /* البطاقة لا تُقصّ بين صفحتين ما أمكن */
    html.nm-printing .nmx-exam { break-inside: avoid; }
    /* bootstrap 3 يمحو في الطباعة كل خلفية ولون ({*{background:0 0!important;color:#000!important}}) فتخرج حلقة النسبة
       وأشرطة الموادّ فارغة. تُعاد هنا داخل البطاقة وحدها بألوان الشاشة (portal-shell.css). */
    html.nm-printing .nmx-ring { background: conic-gradient(var(--nmx-c, #1f8a4c) calc(var(--nmx-pc, 0) * 1%), #eef2f6 0) !important; }
    html.nm-printing .nmx-exam[data-state="fail"] .nmx-ring { background: conic-gradient(#c0392b calc(var(--nmx-pc, 0) * 1%), #f7e9e7 0) !important; }
    html.nm-printing .nmx-ring-in { background: #fff !important; }
    html.nm-printing .nmx-sub-bar { background: #eef2f6 !important; }
    html.nm-printing .nmx-sub-bar > i { background: #1f8a4c !important; }
    html.nm-printing .nmx-sub.is-fail .nmx-sub-bar { background: #f7e9e7 !important; }
    html.nm-printing .nmx-sub.is-fail .nmx-sub-bar > i { background: #c0392b !important; }
    html.nm-printing .nmx-sub-m b { color: #1f8a4c !important; }
    html.nm-printing .nmx-sub.is-fail .nmx-sub-m b { color: #c0392b !important; }
    html.nm-printing .nmx-chip { color: #fff !important; background: #1f8a4c !important; }
    html.nm-printing .nmx-exam[data-state="fail"] .nmx-chip { background: #c0392b !important; }
}
