/* ===========================================
   print.css — Print/PDF Styles (A4 Landscape)
   وزارة التعليم — تقرير الدرجات
   =========================================== */

@media print {

  /* ===== إعداد الصفحة ===== */
  @page{
    size: A4 landscape;
    margin: 8mm 8mm 12mm 8mm; /* bottom أكبر لمنع قص آخر صف */
  }
  
  /* ✅ اخفاء تبويب التحليل بالكامل عند طباعة (حفظ PDF) */
  #tabDashboard,
  #tabDashboardBtn{
    display:none !important;
  }
    /* ✅ اطبع فقط كرت الجدول (اختياري) 
  #summary,
  #statsBoard,
  #errors{
    display:none !important;
  }
*/

  html, body{
    background:#fff !important;
  }

  /* منع أي ظلال/خلفيات مزعجة */
  *{
    box-shadow:none !important;
    text-shadow:none !important;
  }

  /* ===== إخفاء عناصر التفاعل ===== */
  input,
  select,
  button,
  .bar,
  .hint,
  .pill,
  #status{
    display:none !important;
  }

  /* ===== الكروت بدون إطار/ظل ===== */
  .card{
    border:0 !important;
    padding:0 !important;
    margin:0 !important;
    background:#fff !important;
  }

  /* ===== إلغاء الـ Scroll ===== */
  .scroll{
    max-height:none !important;
    overflow:visible !important;
    border:0 !important;
    border-radius:0 !important;
    margin:0 !important;
    padding:0 !important;
  }

  /* ===== العنوان ===== */
  .topTitle{
    border:0 !important;
    margin:0 0 6mm 0 !important;
    padding:0 !important;
    background:transparent !important;
  }

  .topTitle__right{
    font-size:11px !important;
  }

  /* ===== الجدول ===== */
    /* ✅ اقفل ستايل الشاشة اللي يسبب مشاكل في PDF */
  table{
    width:100% !important;
    table-layout:fixed;
    border-collapse:collapse !important;
    border-spacing:0 !important;
    margin:0 0 8mm 0 !important;
  }

  thead{ display: table-header-group; }
  tfoot{ display: table-footer-group; }

  th{
    position: static !important;   /* يلغي sticky من style.css */
    top:auto !important;
    z-index:auto !important;

    background:#f3f4f6 !important;
    font-weight:700 !important;
    font-size:9.5px !important;

    white-space:normal !important;
    word-break:break-word !important;
  }

  td{
    font-size:10px !important;
    white-space:nowrap !important;
  }

  th, td{
    border:1px solid #e5e7eb !important;
    padding:5px 4px !important;
    line-height:1.15 !important;
    text-align:center !important;
    vertical-align:middle !important;
    color:#000 !important;
  }

  /* ✅ لا تلوين صفوف ولا hover */
  tbody tr:nth-child(even),
  tbody tr:hover{
    background: transparent !important;
  }

  /* منع انقسام الصف بين الصفحات */
  tr{
    break-inside:avoid !important;
    page-break-inside:avoid !important;
  }


  /* ===== أعمدة أساسية حسب ترتيب جدولك ===== */
  th:nth-child(1), td:nth-child(1){
    width:95px !important;    /* رقم الهوية */
  }

  th:nth-child(2), td:nth-child(2){
    width:160px !important;   /* اسم الطالب */
    white-space:normal !important;
    word-break:break-word !important;
  }

  /* حد عام للمواد */
  th, td{
    max-width:80px !important;
  }

  /* ===== الأعمدة النصية التي تحتاج التفاف ===== */
  th:nth-last-child(3),
  td:nth-last-child(3),
  th:nth-last-child(2),
  td:nth-last-child(2),
  th:nth-child(3),
  td:nth-child(3){
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.2 !important;
    font-size: 9px !important;
    vertical-align: middle !important;
  }

  /* ===== عمود النتيجة (آخر عمود) ===== */
  th:last-child,
  td:last-child{
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.25 !important;
    font-size: 8.5px !important;
    font-weight: 600 !important;
    max-width: 120px !important;
    vertical-align: middle !important;
  }

  /* ===== تلوين النجمة يبقى بالطباعة ===== */
  .mark-asterisk{
    color:#991b1b !important;
    background:#fff1f2 !important;
    font-weight:800 !important;
  }

  /* ===== الفوتر ثابت (ومخفي حسب رغبتك) ===== */
  .footer{
    position:fixed !important;
    bottom:3mm !important;
    left:0 !important;
    right:0 !important;

    display:none !important; /* اخفاء الطباعة */

    border:0 !important;
    background:transparent !important;
    text-align:center !important;
    font-size:10px !important;
    color:#111 !important;
    padding:0 !important;
    margin:0 !important;
  }

  /* خيار احتياطي لتصغير الطباعة */
  body{ zoom:0.95; }

}
