/* SMR Hub — Impresión de exámenes (js/pdf-export.js)
   ------------------------------------------------------------
   El examen se pinta en #exam-print-view, FUERA de .app y oculto en
   pantalla: no participa en el layout de la app ni la ensucia.
   En papel manda este archivo: A4 vertical, blanco y negro y una
   tipografía serif que ahorra tinta y se lee mejor impresa.
   No hereda los tokens de tema: aquí todo es tinta, no interfaz. */

#exam-print-view { display: none; }

@media print {
  @page {
    size: A4 portrait;
    margin: 16mm 14mm;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
  }

  body {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 11pt;
    line-height: 1.45;
  }

  /* Nada de la SPA en papel. */
  nav,
  header,
  footer,
  .no-print,
  .app,
  aside,
  .topbar,
  .mobile-nav,
  .skip-link,
  .modal-overlay,
  .palette-overlay {
    display: none !important;
  }

  #exam-print-view { display: block !important; }

  /* ----- Cabecera ----- */
  .exam-head {
    display: flex;
    justify-content: space-between;
    gap: 12mm;
    border-bottom: 2px solid #000;
    padding-bottom: 4mm;
    margin-bottom: 4mm;
  }

  .exam-brand {
    font-size: 8pt;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0 0 2mm;
  }

  .exam-title {
    font-size: 17pt;
    line-height: 1.2;
    margin: 0 0 1.5mm;
  }

  .exam-meta {
    font-size: 9.5pt;
    margin: 0;
  }

  /* Cuadro de nota: borde grueso, casilla para escribir a mano. */
  .exam-score {
    flex: none;
    width: 26mm;
    height: 26mm;
    border: 1.5px solid #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2mm;
  }

  .exam-score span {
    font-size: 8pt;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .exam-score b {
    display: block;
    width: 18mm;
    height: 8mm;
    border-bottom: 1px solid #000;
  }

  /* ----- Datos del alumno ----- */
  .exam-candidate {
    display: flex;
    gap: 8mm;
    margin: 0 0 7mm;
    font-size: 9.5pt;
  }

  .exam-candidate div { flex: 1; }

  .exam-candidate dt {
    font-size: 8pt;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .exam-candidate dd {
    margin: 0;
    min-height: 5mm;
    border-bottom: 1px solid #666;
  }

  /* ----- Preguntas ----- */
  .exam-questions {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  /* Un enunciado nunca se parte entre dos hojas. */
  .question-block {
    margin: 0 0 5mm;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .exam-q {
    margin: 0 0 2mm;
  }

  .exam-num {
    font-weight: 700;
  }

  .exam-options {
    list-style: none;
    padding: 0;
    margin: 0 0 0 6mm;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5mm 6mm;
  }

  .exam-options li {
    display: flex;
    align-items: flex-start;
    gap: 2mm;
  }

  /* Casilla de respuesta dibujada en CSS puro. */
  .exam-box {
    flex: none;
    width: 4mm;
    height: 4mm;
    margin-top: 0.8mm;
    border: 1px solid #000;
  }

  .exam-letter {
    flex: none;
    width: 4mm;
    font-weight: 700;
  }

  /* ----- Hoja de soluciones ----- */
  .exam-solutions {
    page-break-before: always;
    break-before: page;
  }

  .exam-solutions h2 {
    font-size: 14pt;
    border-bottom: 1.5px solid #000;
    padding-bottom: 2mm;
    margin: 0 0 4mm;
  }

  .exam-solutions table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 9.5pt;
  }

  .exam-solutions th,
  .exam-solutions td {
    border: 1px solid #444;
    padding: 2mm;
    text-align: left;
    vertical-align: top;
  }

  .exam-solutions th { background: #eee; }

  .exam-solutions th:first-child,
  .exam-solutions td:first-child {
    width: 10mm;
    text-align: center;
  }

  .exam-solutions th:nth-child(2),
  .exam-solutions td:nth-child(2) {
    width: 20mm;
    text-align: center;
    font-weight: 700;
  }

  .exam-solutions tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }
}
