/*
 * APPLICATION.CSS - Global Application Styles
 * ============================================
 *
 * This file contains global styles that apply across the entire application.
 *
 * IMPORTANT - Rails 8 + Propshaft Asset Pipeline:
 * -----------------------------------------------
 * Propshaft does NOT process CSS @import directives like Sprockets did!
 *
 * ❌ DON'T DO THIS (won't work):
 *    @import "dashboards.css";
 *    @import "components/my_feature.css";
 *
 * ✅ DO THIS INSTEAD:
 *    Add stylesheet_link_tag in layouts:
 *    app/views/layouts/application.html.erb
 *    app/views/layouts/admin.html.erb
 *
 * See docs/PROPSHAFT_STYLESHEET_GUIDE.md for complete documentation.
 */

/* Remove default margin from tables */
table {
  margin: 0;
}

/* Claude Chat Prose Styling - Theme-Aware Override for Tailwind Typography
 *
 * Problem: @tailwindcss/typography plugin uses hardcoded gray colors that don't
 * respect semantic theme variables, causing near-invisible text in chat responses.
 *
 * Solution: Override prose classes to use semantic theme colors for proper contrast
 * across all themes (Default, CHDS) and modes (light, dark).
 */

/* Base prose styles - use semantic colors */
.prose {
  /* Override Tailwind Typography's hardcoded colors */
  color: var(--color-text-primary) !important;
  max-width: none;
}

.prose strong {
  color: var(--color-text-primary) !important;
  font-weight: 600;
}

.prose em {
  color: var(--color-text-primary) !important;
}

.prose code {
  color: var(--color-text-primary) !important;
  background-color: var(--color-surface-secondary);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.prose pre {
  background-color: var(--color-surface-secondary) !important;
  color: var(--color-text-primary) !important;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
}

.prose pre code {
  background-color: transparent !important;
  color: inherit !important;
  padding: 0;
  border-radius: 0;
  font-size: 0.875rem;
}

/* Headings - ensure visibility and hierarchy */
.prose h1 {
  color: var(--color-text-primary) !important;
  font-size: 1.875rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  line-height: 2.25rem;
}

.prose h2 {
  color: var(--color-text-primary) !important;
  font-size: 2.25rem;  /* 1.5x larger: was 1.5rem, now 2.25rem (36px) */
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  line-height: 2.5rem;
}

.prose h3 {
  color: var(--color-text-primary) !important;
  font-size: 1.875rem;  /* 1.5x larger: was 1.25rem, now 1.875rem (30px) */
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.875rem;
  line-height: 2.25rem;
}

.prose h4 {
  color: var(--color-text-primary) !important;
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 0.875rem;
  margin-bottom: 0.625rem;
  line-height: 1.5rem;
}

.prose h5,
.prose h6 {
  color: var(--color-text-primary) !important;
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}

/* Paragraphs */
.prose p {
  color: var(--color-text-primary) !important;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  line-height: 1.75;
}

/* Lists */
.prose ul,
.prose ol {
  color: var(--color-text-primary) !important;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  padding-left: 1.625rem;
}

.prose li {
  color: var(--color-text-primary) !important;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.prose ul > li {
  padding-left: 0.375rem;
}

.prose ol > li {
  padding-left: 0.375rem;
}

/* Blockquotes */
.prose blockquote {
  color: var(--color-text-secondary) !important;
  border-left: 0.25rem solid var(--color-border-strong);
  padding-left: 1rem;
  font-style: italic;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

/* Links */
.prose a {
  color: var(--color-link) !important;
  text-decoration: underline;
  font-weight: 500;
}

.prose a:hover {
  color: var(--color-link-hover) !important;
}

/* Tables */
.prose table {
  width: 100%;
  table-layout: auto;
  text-align: left;
  margin-top: 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--color-border);
}

.prose thead {
  border-bottom: 1px solid var(--color-border-strong);
}

.prose thead th {
  color: var(--color-text-primary) !important;
  font-weight: 600;
  vertical-align: bottom;
  padding: 0.5rem 0.75rem;
  background-color: var(--color-surface-secondary);
}

.prose tbody tr {
  border-bottom: 1px solid var(--color-border);
}

.prose tbody td {
  color: var(--color-text-primary) !important;
  vertical-align: top;
  padding: 0.5rem 0.75rem;
}

/* Horizontal rules */
.prose hr {
  border-color: var(--color-border) !important;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Images */
.prose img {
  border-radius: 0.5rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

/* Dark mode specific overrides */
.dark .prose {
  /* Ensure dark mode uses the correct text colors */
  color: var(--color-text-primary) !important;
}

/* CHDS theme - sharp corners for code blocks */
[data-theme="chds"] .prose pre,
[data-theme="chds"] .prose code {
  border-radius: 0 !important;
}

/* Width constraints - prevent overflow in chat container */
.prose {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.prose pre {
  max-width: 100%;
  overflow-x: auto;
}

.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}
