/* Print-specific styles for test generation */

/* Hide print container on screen */
.print-only {
  display: none;
}

/* Watermark styles */
.print-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -50%) rotate(-45deg);
  z-index: -1;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  opacity: 0.08;
}

.watermark-text {
  font-size: 60pt;
  font-weight: bold;
  color: #666;
  white-space: nowrap;
  font-family: Arial, sans-serif;
  letter-spacing: 5px;
}

/* Print styles */
@media print {
  /* Hide everything except print container */
  body > *:not(#printContainer) {
    display: none !important;
  }

  /* Show print container */
  .print-only {
    display: block !important;
  }

  /* Ensure watermark shows on print */
  .print-watermark {
    display: flex !important;
    position: fixed !important;
    z-index: -1 !important;
    opacity: 0.08 !important;
  }

  /* Page setup */
  @page {
    size: A4;
    margin: 2cm;
  }

  /* Density pass 2026-08-22 (owner report: 10 items printed on 3 pages):
     exam-paper compactness — smaller type, tighter leading, slim header,
     inline question numbers, two-column options. Target: 15 items ≈ 1 page. */
  body {
    background: white !important;
    color: black !important;
    font-family: 'Times New Roman', serif;
    font-size: 11pt;
    line-height: 1.4;
    position: relative;
  }

  /* Print header */
  .print-header {
    margin-bottom: 12px;
    border-bottom: 2px solid #000;
    padding-bottom: 8px;
  }

  .print-header h1 {
    font-size: 17pt;
    font-weight: bold;
    margin: 0 0 6px 0;
    color: #000;
    text-align: center;
  }

  .test-info {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    justify-content: center;
    font-size: 9.5pt;
  }

  .test-info p {
    margin: 0;
    color: #000;
  }

  /* Belt on top of the body>* rule below: anything marked no-print (the K2C
     modal above all — tier map §4) must never reach paper. */
  .no-print {
    display: none !important;
  }

  /* The K2C matching code — the paper's only link to its on-screen answer key. */
  .k2c-code {
    display: block;
    text-align: center;
    font-size: 10.5pt;
    border: 2px solid #000;
    padding: 4px 8px;
    margin: 0 0 8px 0;
  }

  /* Test page */
  .test-page h2 {
    font-size: 13pt;
    font-weight: bold;
    margin: 8px 0 8px 0;
    color: #000;
    border-bottom: 1px solid #000;
    padding-bottom: 3px;
  }

  /* Question items — number is inline with the stem */
  .question-item {
    margin-bottom: 10px;
    page-break-inside: avoid;
  }

  .question-text {
    margin: 0 0 3px 0;
    font-size: 11pt;
    line-height: 1.35;
  }

  /* Two-column options like a real exam sheet; a long option simply takes
     the full row and wraps. */
  .options {
    margin-left: 18px;
    display: flex;
    flex-wrap: wrap;
  }

  .options p {
    margin: 1px 8px 1px 0;
    font-size: 10.5pt;
    flex: 1 1 45%;
    min-width: 45%;
  }

  /* Answer-key print styles removed 2026-08-22: the key renders ON-SCREEN
     only (K2C view in the dashboard) and is never part of the printout. */

  /* Remove any background colors, shadows, etc */
  * {
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Ensure text is black */
  h1, h2, h3, h4, h5, h6, p, span, div, strong, em {
    color: #000 !important;
  }

  /* Remove borders from table elements if any */
  table {
    border-collapse: collapse;
  }

  /* Avoid breaking inside important elements */
  h2, h3 {
    page-break-after: avoid;
  }

  /* Print link URLs after links (optional) */
  a[href]:after {
    content: none;
  }

  /* Ensure images fit on page if any */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
}

/* Screen preview styles (optional - for print preview) */
@media screen {
  #printContainer {
    max-width: 21cm;
    margin: 20px auto;
    padding: 2cm;
    background: white;
    color: black;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
  }

  #printContainer .print-header h1 {
    color: #000;
  }

  #printContainer .test-info p,
  #printContainer .question-text,
  #printContainer .options p,
  #printContainer .k2c-code {
    color: #000;
  }
}
