/* Custom KaTeX styling to reduce formula size */
.katex {
  font-size: 1em !important; /* Default size adjustment */
}

/* Adjust inline math formulas */
.katex-inline {
  font-size: 1em !important;
}

/* Adjust display/block math formulas */
.katex-display {
  font-size: 1.1em !important;
  margin: 0.5em 0;
}

/* Fix spacing issues */
.katex-display > .katex {
  display: inline-block;
  text-align: left;
  max-width: 100%;
}

/* Ensure proper line wrapping for long formulas */
.katex-display > .katex > .katex-html {
  white-space: normal;
  word-break: break-word;
}

/* Adjust font weights to make them less bold */
.katex .mord {
  font-weight: normal;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  color: #2c3e50 !important;
  margin-top: 24px !important;
  margin-bottom: 16px !important;
}
.prose h1 {
  font-size: 2em !important;
  border-bottom: 2px solid #eaecef !important;
  padding-bottom: 8px !important;
}
.prose h2 {
  font-size: 1.5em !important;
  border-bottom: 1px solid #eaecef !important;
  padding-bottom: 4px !important;
}
.prose p {
  margin-bottom: 16px !important;
}
.prose code {
  background-color: #f6f8fa !important;
  padding: 2px 4px !important;
  border-radius: 3px !important;
  font-family: "Courier New", monospace !important;
}
.prose pre {
  background-color: #f6f8fa !important;
  padding: 16px !important;
  border-radius: 6px !important;
  overflow-x: auto !important;
}
.prose blockquote {
  border-left: 4px solid #dfe2e5 !important;
  padding-left: 16px !important;
  margin-left: 0 !important;
  color: #6a737d !important;
}
.prose ul,
.prose ol {
  padding-left: 24px !important;
  list-style: disc !important;
}
.prose li {
  margin-bottom: 4px !important;
}
.prose table {
  border-collapse: collapse !important;
  width: 100% !important;
  margin-bottom: 16px !important;
}
.prose th,
.prose td {
  border: 1px solid #dfe2e5 !important;
  padding: 8px 12px !important;
  text-align: left !important;
}
.prose th {
  background-color: #f6f8fa !important;
  font-weight: bold !important;
}
/* Enhanced KaTeX math styling for PDF */
.prose .katex {
  font-size: 1.1em !important;
  color: #000 !important;
}
.katex-display {
  margin: 1.5em 0 !important;
  text-align: center !important;
  overflow-x: auto !important;
}
.katex-display > .katex {
  display: inline-block !important;
  text-align: center !important;
}
/* Ensure fractions render correctly */
.katex .mfrac .frac-line {
  border-bottom: 1px solid #000 !important;
  margin: 0.1em 0 !important;
}
/* Better spacing for subscripts and superscripts */
.katex .msupsub {
  position: relative !important;
}
/* Checkbox styling */
.prose input[type="checkbox"] {
  margin-right: 8px;
}
/* Better list item spacing */
.prose li {
  margin-bottom: 8px;
  line-height: 1.8;
}
/* Print optimizations */
@media print {
  body {
    margin: 0;
    -webkit-print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  .katex {
    font-size: 1em !important;
    color: #000 !important;
  }
  .katex-display {
    break-inside: avoid !important;
  }
}
/* Ensure proper rendering of mathematical symbols */
.katex .base {
  display: inline-block !important;
  position: relative !important;
}
.katex .strut {
  display: inline-block !important;
}
