/**
 * Markdown Content Renderer Styles
 * Styles for rendered Markdown content blocks
 */

/* Markdown Content Wrapper */
.markdown-content-wrapper {
    margin: 1.5em 0;
    padding: 1.5em;
    background: var(--color-bg, #ffffff);
    border: 1px solid var(--color-border, #e1e4e8);
    border-radius: 6px;
    line-height: 1.6;
    color: var(--color-text, #24292e);
}

/* Dark theme support */
[data-github-theme="dark"] .markdown-content-wrapper,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper,
[data-github-theme="high_contrast"] .markdown-content-wrapper,
[data-theme="dark"] .markdown-content-wrapper,
body.dark-mode .markdown-content-wrapper,
body.theme-dark .markdown-content-wrapper,
html[data-theme="dark"] .markdown-content-wrapper {
    background: var(--color-dark, #0d1117);
    border-color: var(--color-border-dark, #30363d);
    color: var(--color-text-dark, #c9d1d9);
}

/* Light theme support */
[data-github-theme="light"] .markdown-content-wrapper,
[data-theme="light"] .markdown-content-wrapper,
body.light-mode .markdown-content-wrapper,
body.theme-light .markdown-content-wrapper,
html[data-theme="light"] .markdown-content-wrapper {
    background: var(--color-bg, #ffffff);
    border-color: var(--color-border, #e1e4e8);
    color: var(--color-text, #24292e);
}

/* High contrast theme specific adjustments */
[data-github-theme="high_contrast"] .markdown-content-wrapper {
    border-width: 2px;
    border-color: var(--color-border-dark, #58a6ff);
}

/* Typography */
.markdown-content-wrapper h1,
.markdown-content-wrapper h2,
.markdown-content-wrapper h3,
.markdown-content-wrapper h4,
.markdown-content-wrapper h5,
.markdown-content-wrapper h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.25;
    color: var(--color-text, #24292e);
}

[data-github-theme="dark"] .markdown-content-wrapper h1,
[data-github-theme="dark"] .markdown-content-wrapper h2,
[data-github-theme="dark"] .markdown-content-wrapper h3,
[data-github-theme="dark"] .markdown-content-wrapper h4,
[data-github-theme="dark"] .markdown-content-wrapper h5,
[data-github-theme="dark"] .markdown-content-wrapper h6,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper h1,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper h2,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper h3,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper h4,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper h5,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper h6,
[data-github-theme="high_contrast"] .markdown-content-wrapper h1,
[data-github-theme="high_contrast"] .markdown-content-wrapper h2,
[data-github-theme="high_contrast"] .markdown-content-wrapper h3,
[data-github-theme="high_contrast"] .markdown-content-wrapper h4,
[data-github-theme="high_contrast"] .markdown-content-wrapper h5,
[data-github-theme="high_contrast"] .markdown-content-wrapper h6,
[data-theme="dark"] .markdown-content-wrapper h1,
[data-theme="dark"] .markdown-content-wrapper h2,
[data-theme="dark"] .markdown-content-wrapper h3,
[data-theme="dark"] .markdown-content-wrapper h4,
[data-theme="dark"] .markdown-content-wrapper h5,
[data-theme="dark"] .markdown-content-wrapper h6,
body.dark-mode .markdown-content-wrapper h1,
body.dark-mode .markdown-content-wrapper h2,
body.dark-mode .markdown-content-wrapper h3,
body.dark-mode .markdown-content-wrapper h4,
body.dark-mode .markdown-content-wrapper h5,
body.dark-mode .markdown-content-wrapper h6,
body.theme-dark .markdown-content-wrapper h1,
body.theme-dark .markdown-content-wrapper h2,
body.theme-dark .markdown-content-wrapper h3,
body.theme-dark .markdown-content-wrapper h4,
body.theme-dark .markdown-content-wrapper h5,
body.theme-dark .markdown-content-wrapper h6 {
    color: var(--color-text-dark, #c9d1d9);
}

.markdown-content-wrapper h1 {
    font-size: 2em;
    border-bottom: 1px solid var(--color-border, #e1e4e8);
    padding-bottom: 0.3em;
}

[data-github-theme="dark"] .markdown-content-wrapper h1,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper h1,
[data-github-theme="high_contrast"] .markdown-content-wrapper h1,
[data-theme="dark"] .markdown-content-wrapper h1,
body.dark-mode .markdown-content-wrapper h1,
body.theme-dark .markdown-content-wrapper h1 {
    border-bottom-color: var(--color-border-dark, #30363d);
}

.markdown-content-wrapper h2 {
    font-size: 1.5em;
    border-bottom: 1px solid var(--color-border, #e1e4e8);
    padding-bottom: 0.3em;
}

[data-github-theme="dark"] .markdown-content-wrapper h2,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper h2,
[data-github-theme="high_contrast"] .markdown-content-wrapper h2,
[data-theme="dark"] .markdown-content-wrapper h2,
body.dark-mode .markdown-content-wrapper h2,
body.theme-dark .markdown-content-wrapper h2 {
    border-bottom-color: var(--color-border-dark, #30363d);
}

.markdown-content-wrapper h3 {
    font-size: 1.25em;
}

.markdown-content-wrapper h4 {
    font-size: 1em;
}

.markdown-content-wrapper h5 {
    font-size: 0.875em;
}

.markdown-content-wrapper h6 {
    font-size: 0.85em;
    color: var(--color-text-muted, #6a737d);
}

/* Paragraphs */
.markdown-content-wrapper p {
    margin: 1em 0;
}

.markdown-content-wrapper p:first-child {
    margin-top: 0;
}

.markdown-content-wrapper p:last-child {
    margin-bottom: 0;
}

/* Links */
.markdown-content-wrapper a {
    color: var(--color-link, #0366d6);
    text-decoration: none;
}

.markdown-content-wrapper a:hover {
    text-decoration: underline;
}

[data-github-theme="dark"] .markdown-content-wrapper a,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper a,
[data-github-theme="high_contrast"] .markdown-content-wrapper a,
[data-theme="dark"] .markdown-content-wrapper a,
body.dark-mode .markdown-content-wrapper a,
body.theme-dark .markdown-content-wrapper a,
html[data-theme="dark"] .markdown-content-wrapper a {
    color: var(--color-link-dark, #58a6ff);
}

[data-github-theme="high_contrast"] .markdown-content-wrapper a {
    color: var(--color-link-dark, #1f6feb);
    text-decoration: underline;
}

/* Lists */
.markdown-content-wrapper ul,
.markdown-content-wrapper ol {
    margin: 1em 0;
    padding-left: 2em;
}

.markdown-content-wrapper li {
    margin: 0.5em 0;
}

.markdown-content-wrapper li > p {
    margin-top: 0.5em;
}

.markdown-content-wrapper ul {
    list-style-type: disc;
}

.markdown-content-wrapper ol {
    list-style-type: decimal;
}

.markdown-content-wrapper ul ul,
.markdown-content-wrapper ol ol,
.markdown-content-wrapper ul ol,
.markdown-content-wrapper ol ul {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
}

/* Code */
.markdown-content-wrapper code {
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background-color: var(--color-code-bg, rgba(27, 31, 35, 0.05));
    border-radius: 3px;
    font-family: var(--font-mono, 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace);
    color: var(--color-code-text, #e83e8c);
}

[data-github-theme="dark"] .markdown-content-wrapper code,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper code,
[data-github-theme="high_contrast"] .markdown-content-wrapper code,
[data-theme="dark"] .markdown-content-wrapper code,
body.dark-mode .markdown-content-wrapper code,
body.theme-dark .markdown-content-wrapper code,
html[data-theme="dark"] .markdown-content-wrapper code {
    background-color: var(--color-code-bg-dark, rgba(110, 118, 129, 0.4));
    color: var(--color-code-text-dark, #c9d1d9);
}

.markdown-content-wrapper pre {
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: var(--color-code-bg, #f6f8fa);
    border-radius: 6px;
    margin: 1em 0;
}

[data-github-theme="dark"] .markdown-content-wrapper pre,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper pre,
[data-github-theme="high_contrast"] .markdown-content-wrapper pre,
[data-theme="dark"] .markdown-content-wrapper pre,
body.dark-mode .markdown-content-wrapper pre,
body.theme-dark .markdown-content-wrapper pre,
html[data-theme="dark"] .markdown-content-wrapper pre {
    background-color: var(--color-code-bg-dark, #161b22);
}

.markdown-content-wrapper pre code {
    display: inline;
    max-width: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    line-height: inherit;
    word-wrap: normal;
    background-color: transparent;
    border: 0;
    color: inherit;
}

/* Blockquotes */
.markdown-content-wrapper blockquote {
    padding: 0 1em;
    color: var(--color-text-muted, #6a737d);
    border-left: 0.25em solid var(--color-border, #dfe2e5);
    margin: 1em 0;
}

[data-github-theme="dark"] .markdown-content-wrapper blockquote,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper blockquote,
[data-github-theme="high_contrast"] .markdown-content-wrapper blockquote,
[data-theme="dark"] .markdown-content-wrapper blockquote,
body.dark-mode .markdown-content-wrapper blockquote,
body.theme-dark .markdown-content-wrapper blockquote,
html[data-theme="dark"] .markdown-content-wrapper blockquote {
    color: var(--color-text-muted-dark, #8b949e);
    border-left-color: var(--color-border-dark, #30363d);
}

.markdown-content-wrapper blockquote > :first-child {
    margin-top: 0;
}

.markdown-content-wrapper blockquote > :last-child {
    margin-bottom: 0;
}

/* Tables */
.markdown-content-wrapper table {
    border-spacing: 0;
    border-collapse: collapse;
    display: block;
    width: max-content;
    max-width: 100%;
    overflow: auto;
    margin: 1em 0;
}

.markdown-content-wrapper table th {
    font-weight: 600;
    padding: 6px 13px;
    border: 1px solid var(--color-border, #dfe2e5);
    background-color: var(--color-bg-alt, #f6f8fa);
}

[data-github-theme="dark"] .markdown-content-wrapper table th,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper table th,
[data-github-theme="high_contrast"] .markdown-content-wrapper table th,
[data-theme="dark"] .markdown-content-wrapper table th,
body.dark-mode .markdown-content-wrapper table th,
body.theme-dark .markdown-content-wrapper table th {
    background-color: var(--color-bg-alt-dark, #161b22);
    border-color: var(--color-border-dark, #30363d);
}

.markdown-content-wrapper table td {
    padding: 6px 13px;
    border: 1px solid var(--color-border, #dfe2e5);
}

[data-github-theme="dark"] .markdown-content-wrapper table td,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper table td,
[data-github-theme="high_contrast"] .markdown-content-wrapper table td,
[data-theme="dark"] .markdown-content-wrapper table td,
body.dark-mode .markdown-content-wrapper table td,
body.theme-dark .markdown-content-wrapper table td {
    border-color: var(--color-border-dark, #30363d);
}

.markdown-content-wrapper table tr {
    background-color: var(--color-bg, #ffffff);
    border-top: 1px solid var(--color-border, #c6cbd1);
}

[data-github-theme="dark"] .markdown-content-wrapper table tr,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper table tr,
[data-github-theme="high_contrast"] .markdown-content-wrapper table tr,
[data-theme="dark"] .markdown-content-wrapper table tr,
body.dark-mode .markdown-content-wrapper table tr,
body.theme-dark .markdown-content-wrapper table tr {
    background-color: var(--color-dark, #0d1117);
    border-top-color: var(--color-border-dark, #30363d);
}

.markdown-content-wrapper table tr:nth-child(2n) {
    background-color: var(--color-bg-alt, #f6f8fa);
}

[data-github-theme="dark"] .markdown-content-wrapper table tr:nth-child(2n),
[data-github-theme="dark_dimmed"] .markdown-content-wrapper table tr:nth-child(2n),
[data-github-theme="high_contrast"] .markdown-content-wrapper table tr:nth-child(2n),
[data-theme="dark"] .markdown-content-wrapper table tr:nth-child(2n),
body.dark-mode .markdown-content-wrapper table tr:nth-child(2n),
body.theme-dark .markdown-content-wrapper table tr:nth-child(2n) {
    background-color: var(--color-bg-alt-dark, #161b22);
}

/* Images */
.markdown-content-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1em auto;
    border-radius: 6px;
}

/* Horizontal Rules */
.markdown-content-wrapper hr {
    height: 0.25em;
    padding: 0;
    margin: 1.5em 0;
    background-color: var(--color-border, #e1e4e8);
    border: 0;
}

[data-github-theme="dark"] .markdown-content-wrapper hr,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper hr,
[data-github-theme="high_contrast"] .markdown-content-wrapper hr,
[data-theme="dark"] .markdown-content-wrapper hr,
body.dark-mode .markdown-content-wrapper hr,
body.theme-dark .markdown-content-wrapper hr,
html[data-theme="dark"] .markdown-content-wrapper hr {
    background-color: var(--color-border-dark, #30363d);
}

/* Mermaid diagrams within markdown */
.markdown-content-wrapper .mermaid {
    margin: 1.5em 0;
    padding: 1em;
    background: var(--color-code-bg, #f6f8fa);
    border-radius: 6px;
    overflow-x: auto;
    transition: background-color 0.3s ease;
}

[data-github-theme="dark"] .markdown-content-wrapper .mermaid,
[data-github-theme="dark_dimmed"] .markdown-content-wrapper .mermaid,
[data-github-theme="high_contrast"] .markdown-content-wrapper .mermaid,
[data-theme="dark"] .markdown-content-wrapper .mermaid,
body.dark-mode .markdown-content-wrapper .mermaid,
body.theme-dark .markdown-content-wrapper .mermaid,
html[data-theme="dark"] .markdown-content-wrapper .mermaid {
    background: var(--color-code-bg-dark, #161b22);
}

/* Error message */
.markdown-error {
    padding: 1em;
    background-color: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    color: #c33;
}

[data-github-theme="dark"] .markdown-error,
[data-github-theme="dark_dimmed"] .markdown-error,
[data-github-theme="high_contrast"] .markdown-error,
[data-theme="dark"] .markdown-error,
body.dark-mode .markdown-error,
body.theme-dark .markdown-error,
html[data-theme="dark"] .markdown-error {
    background-color: #3d1a1a;
    border-color: #5a2a2a;
    color: #ff6b6b;
}

/* Smooth transitions for theme switching */
.markdown-content-wrapper {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.markdown-content-wrapper * {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

