/* ============================================
 * PRINT STYLES
 * ============================================
 * Optimized for Bible pages, chat conversations,
 * and sermon notes. Hide interactive UI elements
 * and ensure readability on paper.
 *
 * Loaded via <link rel="stylesheet" media="print">
 * in the root layout. Browsers download the file
 * but do NOT render-block on it, which keeps the
 * landing critical path ~8 KB lighter.
 * ============================================ */

@media print {
  /* Base print setup */
  :root {
    --background: 0 0% 100%;
    --foreground: 0 0% 0%;
    --card: 0 0% 100%;
    --card-foreground: 0 0% 0%;
    --muted-foreground: 0 0% 30%;
    --border: 0 0% 70%;
    --primary: 0 0% 20%;
    --primary-foreground: 0 0% 100%;
  }

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

  html {
    font-size: 12pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    background: white !important;
    color: black !important;
    line-height: 1.5;
    font-family: Georgia, 'Times New Roman', serif;
  }

  /* Hide navigation and interactive elements */
  nav,
  header nav,
  .navigation,
  .skip-nav,
  .cookie-consent,
  .pwa-install-prompt,
  .search-modal,
  button[aria-label="Menu"],
  button[aria-label="Close"],
  [data-print-hide="true"] {
    display: none !important;
  }

  /* Hide specific interactive components */
  .chat-input,
  .send-button,
  .settings-button,
  .theme-toggle,
  .font-size-controls,
  .translation-selector:not(.print-show),
  .audio-player,
  .share-buttons,
  .bookmark-button,
  .copy-button,
  .keyboard-shortcut-hints,
  footer,
  aside {
    display: none !important;
  }

  /* Show main content area */
  main,
  [role="main"],
  #main-content {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Reset card styles for print */
  .card,
  [class*="Card"] {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    background: white !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Typography for print */
  h1 {
    font-size: 24pt !important;
    margin-bottom: 12pt !important;
    page-break-after: avoid;
  }

  h2 {
    font-size: 18pt !important;
    margin-bottom: 10pt !important;
    page-break-after: avoid;
  }

  h3 {
    font-size: 14pt !important;
    margin-bottom: 8pt !important;
    page-break-after: avoid;
  }

  p, li {
    orphans: 3;
    widows: 3;
  }

  /* Bible verse styling for print */
  .verse-text,
  .bible-verse,
  [data-verse] {
    font-family: Georgia, 'Times New Roman', serif !important;
    font-size: 12pt !important;
    line-height: 1.7 !important;
    color: black !important;
    page-break-inside: avoid;
  }

  /* Verse numbers */
  .verse-number,
  [data-verse-number] {
    font-weight: bold !important;
    font-size: 9pt !important;
    vertical-align: super;
    color: #333 !important;
    margin-right: 2pt;
  }

  /* Chat messages for print */
  .chat-message,
  [data-chat-message] {
    border-bottom: 1px solid #ddd !important;
    padding: 12pt 0 !important;
    margin: 0 !important;
    page-break-inside: avoid;
  }

  .chat-message-user,
  [data-chat-role="user"] {
    font-style: italic;
    border-left: 2pt solid #666 !important;
    padding-left: 8pt !important;
  }

  .chat-message-assistant,
  [data-chat-role="assistant"] {
    padding-left: 0 !important;
  }

  /* Sermon and preacher content */
  .sermon-content,
  .sermon-draft,
  .exegesis-content {
    page-break-before: always;
    page-break-inside: auto;
  }

  .sermon-section {
    page-break-inside: avoid;
    margin-bottom: 16pt;
  }

  /* Commentary sections */
  .commentary-panel,
  .commentary-content {
    font-size: 11pt !important;
    border: 1px solid #ccc !important;
    padding: 8pt !important;
    margin: 8pt 0 !important;
    page-break-inside: avoid;
  }

  /* Cross-references */
  .cross-reference,
  [data-cross-ref] {
    font-size: 10pt !important;
    color: #333 !important;
    text-decoration: underline;
  }

  /* Word study content */
  .word-study,
  .strongs-definition {
    border: 1px solid #999 !important;
    padding: 8pt !important;
    margin: 8pt 0 !important;
    page-break-inside: avoid;
  }

  /* Catechism content */
  .catechism-question {
    font-weight: bold !important;
    margin-bottom: 4pt !important;
  }

  .catechism-answer {
    margin-left: 16pt !important;
    margin-bottom: 12pt !important;
    page-break-inside: avoid;
  }

  /* Links - show URL after link text */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }

  a[href^="#"]:after,
  a[href^="/"]:after {
    content: "";
  }

  /* Tables for print */
  table {
    border-collapse: collapse !important;
    width: 100% !important;
    page-break-inside: auto;
  }

  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  th, td {
    border: 1px solid #333 !important;
    padding: 6pt !important;
    text-align: left !important;
  }

  thead {
    display: table-header-group;
  }

  /* Images */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* Print header with title */
  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 24pt;
    padding-bottom: 12pt;
    border-bottom: 1px solid #ccc;
  }

  /* Print footer with page numbers - browser dependent */
  .print-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    width: 100%;
    text-align: center;
    font-size: 9pt;
    color: #666;
  }

  /* Utility class to force page break */
  .print-page-break {
    page-break-before: always !important;
  }

  /* Utility class to prevent page break */
  .print-no-break {
    page-break-inside: avoid !important;
  }

  /* Show elements only when printing */
  .print-only {
    display: block !important;
  }

  /* BijbelAssistent branding for print */
  .print-branding:after {
    content: "Afgedrukt van BijbelAssistent.nl";
    display: block;
    text-align: center;
    font-size: 9pt;
    color: #666;
    margin-top: 24pt;
    padding-top: 12pt;
    border-top: 1px solid #ccc;
  }
}
