/* ==========================================================================
   Experiment report — final print layout (loaded last, print only).
   Fixes: tables/boxes overflowing the page edge, green halo on connection
   points, mixed fonts, oversized diagrams. Content is unchanged.
   ========================================================================== */
@media print{
  @page{size:A4 portrait;margin:10mm 10mm 11mm}

  /* ---- page box: nothing may be wider than the printable area ---- */
  .print-report,.print-report *,.print-report *::before,.print-report *::after{box-sizing:border-box}
  #printReport.print-report{width:100%!important;max-width:100%!important;padding:0 2.5pt!important;margin:0!important;overflow:visible!important;
    font-family:'SL Report','SL Report Symbols',Tahoma,Arial,sans-serif!important;font-size:9pt;line-height:1.55;color:#0F172A!important;
    -webkit-print-color-adjust:exact;print-color-adjust:exact}
  .print-report :is(header,footer,table,th,td,h2,h3,p,li,ol,ul,span,strong,b,a,small,section,div,label,em){font-family:inherit!important}

  /* ---- header ---- */
  .print-report header{display:flex;justify-content:space-between;align-items:flex-end;gap:8pt;margin:0 0 5pt;padding:0 0 4pt;border:0;border-bottom:1.2pt solid #0B2545;font-size:9.5pt}
  .print-report header strong{font-size:13pt;font-weight:700;color:#0B2545}
  .print-report header span{color:#475569}

  /* ---- trainee table: fixed columns, wrapping cells, all borders inside the page ---- */
  .print-report table{width:100%!important;max-width:100%!important;table-layout:fixed;border-collapse:collapse;margin:0 0 6pt}
  .print-report table[data-report-section="trainee"] tr:first-child>th{width:18%}
  .print-report table[data-report-section="trainee"] tr:first-child>td{width:32%}
  .print-report th,.print-report td{border:.6pt solid #64748B!important;padding:2.6pt 5pt;font-size:8.6pt;line-height:1.45;vertical-align:middle;text-align:right;
    overflow-wrap:anywhere;word-break:break-word;white-space:normal!important;overflow:visible!important}
  .print-report th{background:#EEF2F6!important;color:#0B2545!important;font-weight:700}
  .print-report td{unicode-bidi:plaintext}
  .print-report .report-hints-summary{font-size:8.5pt;margin:0 0 4pt}

  /* ---- section headings & text ---- */
  .print-report h2{font-size:10.5pt!important;font-weight:700;color:#0B2545!important;margin:5pt 0 2.5pt!important;break-after:avoid;page-break-after:avoid}
  .print-report p{font-size:8.8pt;line-height:1.6;margin:1.5pt 0}
  .print-report ol{margin:1.5pt 0;padding-inline-start:15pt;font-size:8.4pt;line-height:1.5}
  .print-report li{break-inside:avoid}

  /* ---- boxed sections: inside the page, compact ---- */
  .print-report .report-learning,.print-report .report-flow,.print-report .report-diagnostics{width:100%;max-width:100%;margin:4pt 0 0;padding:3pt 7pt 4pt;
    border:.6pt solid #CBD5E1!important;border-radius:3pt;background:#fff!important;break-inside:avoid;page-break-inside:avoid}
  .print-report .report-learning{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:10pt}
  .print-report .report-learning h2,.print-report .report-flow h2,.print-report .report-diagnostics h2{margin-top:2pt!important}
  .print-report .report-columns{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.55fr);gap:10pt;margin-top:4pt}
  .print-report .report-columns ol{columns:2;column-gap:12pt}
  .print-report .report-columns > section{min-width:0}

  /* ---- footer ---- */
  .print-report footer{display:flex;flex-wrap:wrap;justify-content:space-between;gap:2pt 10pt;margin-top:6pt;padding-top:3pt;border:0;border-top:.6pt solid #94A3B8;font-size:7.4pt;color:#334155}
  .print-report footer a{color:#334155!important;text-decoration:none;direction:ltr;unicode-bidi:isolate}

  /* ---- diagrams: smaller, centred, framed; title kept with its drawing ---- */
  .print-report #reportDiagram{display:block!important;direction:ltr!important;text-align:center!important}
  .print-report #reportDiagram>h2{direction:rtl;text-align:right;margin:5pt 0 2pt!important}
  .print-report .print-crop{margin:0 auto 3pt!important;border:.6pt solid #CBD5E1!important;border-radius:3pt;background:#fff!important;break-inside:avoid;page-break-inside:avoid;overflow:hidden}
  /* Labels drawn inside the board are enlarged so they stay legible after the drawing is scaled down. */
  .print-report .print-crop .device-title{font-size:21px!important;line-height:1.25!important;font-weight:700!important;color:#0F172A!important}
  .print-report .print-crop .device-title small{font-size:12px!important;color:#64748B!important}
  .print-report .print-crop .device-value{font-size:15px!important;direction:ltr!important;unicode-bidi:isolate!important;font-family:'SL Report','SL Report Symbols',Arial,sans-serif!important}
  .print-report .print-crop svg text,.print-report .print-crop .device-head,.print-report .print-crop .device-title{font-family:'SL Report','SL Report Symbols',Arial,sans-serif!important}
  .print-report .print-crop .wire-number circle{r:17px}
  .print-report .print-crop .wire-number text{font-size:19px!important;font-weight:700!important;font-family:'SL Report','SL Report Symbols',Arial,sans-serif!important}
  .print-report .print-crop .flow-label{font-size:15px!important}
  .print-report .print-crop .wb-qc-hint{display:none!important}

  /* ---- connection points: no green halo; keep polarity colours (red +, black −) ---- */
  .print-report .terminal,.print-report .terminal.connected{box-shadow:none!important;outline:none!important;filter:none!important}
  .print-report .terminal::after,.print-report .terminal.connected::after{box-shadow:0 0 0 1.5px rgba(15,23,42,.7)!important;filter:none!important;animation:none!important}
  .print-report .terminal::before{box-shadow:none!important}

  /* ---- workbook tables appended to the report (other experiments) ---- */
  .print-report .report-workbook .wb-tbl-wrap{width:100%!important;max-width:100%!important;overflow:visible!important;padding:0!important;margin:0!important}
  .print-report .report-workbook .wb-tbl{width:100%!important;table-layout:fixed}
  .print-report .report-workbook .wb-tbl th,.print-report .report-workbook .wb-tbl td{font-size:8pt;padding:2pt 3pt;overflow-wrap:anywhere}
  .print-report .report-workbook .wb-report-chart{max-width:100%;max-height:70mm;width:auto!important;margin-inline:auto}
  .print-report .report-workbook h2{font-size:10.5pt!important}
  .print-report .report-workbook p,.print-report .report-workbook li{font-size:8.6pt}
}

/* QR code that opens the report's circuit in the lab */
@media print{
  .print-report header{position:relative}
  .print-report header .report-qr{display:flex;align-items:center;gap:5pt;margin-inline-start:auto;font-size:7pt;line-height:1.35;color:#475569;max-width:52mm}
  .print-report header .report-qr[hidden]{display:none!important}
  .print-report header .report-qr #reportQr{width:17mm;height:17mm;flex:none}
  .print-report header .report-qr #reportQr svg{width:100%;height:100%;display:block}
  .print-report header .report-qr p{margin:0;font-size:7pt}
  .print-report header .report-qr b{display:block;font-size:8pt;color:#0F172A;letter-spacing:.3pt;text-align:right}
}

/* سطر موجّه للمدربين في تذييل التقرير المطبوع */
@media print{
  .print-report footer .report-trainer-cta{flex:1 0 100%;margin-top:2pt;padding-top:2.5pt;border-top:.4pt dotted #94A3B8;font-size:7pt;color:#475569}
  .print-report footer .report-trainer-cta a{font-weight:700}
}

/* إشارة الكتاب داخل التقرير المطبوع */
@media print{
  .print-report .book-ref{margin:3pt 0 0!important;padding:2.5pt 5pt!important;border:.5pt dashed #94A3B8!important;border-radius:3pt;background:#fff!important;font-size:7.6pt!important;line-height:1.5!important;color:#475569!important}
  .print-report .book-ref a{color:#0B2545!important;font-weight:700}
  .print-report .report-learning-expanded{display:block!important;break-inside:auto!important;page-break-inside:auto!important}
  .print-report .report-learning-expanded>[data-report-section="calculations"]{margin-top:5pt}
  .print-report .theory-content{display:grid;gap:3pt}
  .print-report .theory-section{break-inside:avoid;page-break-inside:avoid}
  .print-report .theory-section h3{margin:3pt 0 1pt;font-size:9pt;color:#0B2545}
  .print-report .theory-section p{margin:0}
}
