/* Print-specific styles for PDF generation */

/* Set page margins to minimum and let CSS padding control spacing */
@page {
  margin: 5mm;
  size: A4;
}

@media print {
  /* Hide navigation and UI elements */
  nav,
  .navbar,
  .subnav,
  .toc,
  .sidefilter,
  .sidetoc,
  .sidetoggle,
  .sidebar,
  .affix,
  .breadcrumb,
  .contribution,
  .footer,
  #_content > .row > .sidetoc,
  .col-md-2,
  .col-lg-2,
  .toc-filter,
  .filter-container,
  .sideaffix,
  aside,
  .mobile-hide,
  #sidetoggle {
    display: none !important;
  }

  /* Expand main content to full width */
  .col-md-10,
  .col-lg-10,
  article,
  .container,
  .content-wrapper,
  main {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    float: none !important;
  }

  /* Remove backgrounds for printing */
  body {
    background: white !important;
    color: black !important;
  }

  /* Page break control */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  pre, code, table, figure, img {
    page-break-inside: avoid;
  }

  /* Ensure code blocks are readable */
  pre {
    border: 1px solid #ddd;
    background: #f9f9f9 !important;
    padding: 10px;
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  /* Table styling for print */
  table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
  }

  table, th, td {
    border: 1px solid #999;
    padding: 5px;
  }

  /* Links should be visible */
  a {
    color: #0066cc;
    text-decoration: underline;
  }
}
