/* Theme switching for GitHub Markdown CSS */

/* Override any custom strong tag styling - this is the main fix for the original issue */
.markdown-body strong {
  background: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  position: static !important;
}

/* Allow background to inherit from parent container */
.markdown-body {
  background: inherit !important;
}

/* Ensure text color is readable on both light and dark backgrounds */
.markdown-body {
  color: inherit !important;
}

/* MARKDOWN HEADING SIZE OVERRIDES */
/* Override GitHub Markdown CSS heading sizes to make them more appropriate for UI */
.markdown-body h1 {
  font-size: 1.25rem !important; /* Reduce from default large size */
  line-height: 2rem !important;
  margin-top: 1.5rem !important;
  margin-bottom: 1rem !important;
}

.markdown-body h2 {
  font-size: 1.15rem !important; /* Reduce from default size */
  line-height: 1.75rem !important;
  margin-top: 1.25rem !important;
  margin-bottom: 0.75rem !important;
}

.markdown-body h3 {
  font-size: 1.1rem !important; /* Reduce from default size */
  line-height: 1.5rem !important;
  margin-top: 1rem !important;
  margin-bottom: 0.5rem !important;
}

.markdown-body h4 {
  font-size: 1rem !important; /* Reduce from default size */
  line-height: 1.4rem !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.5rem !important;
}

.markdown-body h5 {
  font-size: 0.9rem !important; /* Reduce from default size */
  line-height: 1.3rem !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.5rem !important;
}

.markdown-body h6 {
  font-size: 0.85rem !important; /* Reduce from default size */
  line-height: 1.2rem !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0.5rem !important;
}

/* Specific overrides for user messages (gray background) */
.bg-gray-100 .markdown-body {
  color: #374151 !important; /* Dark text on gray background */
}

/* Specific overrides for agent messages (white background) */
.bg-white .markdown-body {
  color: #24292f !important; /* Dark text on white background */
}

/* Background context specific styling */
.markdown-body-user {
  background: inherit !important;
  color: #374151 !important; /* Dark text for user messages */
}

.markdown-body-agent {
  background: inherit !important;
  color: #24292f !important; /* Dark text for agent messages */
}

.markdown-body-default {
  background: inherit !important;
  color: #24292f !important; /* Default dark text */
}

/* PRE TAG WIDTH CONSTRAINTS */
/* Ensure pre tags don't break the layout width */
.markdown-body pre {
  max-width: 100% !important;
  overflow-x: auto !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  white-space: pre-wrap !important;
  width: 100% !important;
}

/* Ensure code blocks within pre tags are also constrained */
.markdown-body pre code {
  max-width: 100% !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  white-space: pre-wrap !important;
}

/* TABLE LAYOUT IMPROVEMENTS */
/* Fixed layout for stable rendering */
.markdown-body table {
  table-layout: fixed !important;
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 0 !important;
  display: table !important;
}

/* Table cell improvements - allow wrapping for readability */
.markdown-body table td,
.markdown-body table th {
  padding: 0.375rem 0.5rem !important;
  border: 1px solid #e5e7eb !important;
  vertical-align: top !important;
  word-wrap: break-word !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
}

/* Table header styling */
.markdown-body table th {
  background-color: #f9fafb !important;
  font-weight: 600 !important;
  text-align: left !important;
  font-size: 0.75rem !important;
}

/* Table body cells */
.markdown-body table td {
  font-size: 0.75rem !important;
}

/* Table row hover effects */
.markdown-body table tr:hover {
  background-color: #f9fafb !important;
}
