/* Typography for Markdown Content */
/* Scoped to .msg-content to avoid conflicts with global styles */

.msg-content {
    font-size: 0.95rem; /* ~15.2px */
    line-height: 1.6;
    color: #e6edf3; /* text-text-primary fall-back/match */
    overflow-wrap: break-word;
}

/* Headings */
.msg-content h1, 
.msg-content h2, 
.msg-content h3, 
.msg-content h4, 
.msg-content h5, 
.msg-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    font-weight: 600;
    line-height: 1.25;
    color: #fff; /* Ensure bright white for headings */
}

.msg-content h1:first-child,
.msg-content h2:first-child,
.msg-content h3:first-child {
    margin-top: 0; /* Remove top margin for the very first element */
}

.msg-content h1 { font-size: 1.5em; border-bottom: 1px solid #30363d; padding-bottom: 0.3em; }
.msg-content h2 { font-size: 1.3em; border-bottom: 1px solid #30363d; padding-bottom: 0.3em; }
.msg-content h3 { font-size: 1.1em; }
.msg-content h4 { font-size: 1em; }

/* Paragraphs */
.msg-content p {
    margin-bottom: 1em;
    margin-top: 0;
}

.msg-content p:last-child {
    margin-bottom: 0;
}

/* Lists */
.msg-content ul, 
.msg-content ol {
    margin-top: 0.5em;
    margin-bottom: 1em;
    padding-left: 2em; /* Indent lists */
}

.msg-content li {
    margin-bottom: 0.25em;
}

.msg-content li > ul,
.msg-content li > ol {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
}

/* Blockquotes */
.msg-content blockquote {
    margin: 1em 0;
    padding: 0 1em;
    color: #8b949e; /* Muted text */
    border-left: 0.25em solid #30363d; /* Sidebar quote line */
}

/* Code Blocks & Inline Code */
.msg-content pre {
    background-color: #161b22; /* Darker background */
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 1em;
    font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
    font-size: 0.85em;
    border: 1px solid #30363d;
}

.msg-content code {
    font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
    font-size: 0.85em;
    padding: 0.2em 0.4em;
    margin: 0;
    background-color: rgba(110, 118, 129, 0.4); /* Subtle background for inline code */
    border-radius: 6px;
}

.msg-content pre code {
    padding: 0;
    margin: 0;
    background-color: transparent; /* Reset for block code */
    border-radius: 0;
    white-space: pre;
}

/* Tables */
.msg-content table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-top: 0.5em;
    margin-bottom: 1em;
    width: 100%;
    overflow: auto;
    display: block; /* Allows table to scroll if too wide */
}

.msg-content table th,
.msg-content table td {
    padding: 6px 13px;
    border: 1px solid #30363d;
}

.msg-content table th {
    font-weight: 600;
    background-color: #161b22; /* Header bg */
}

.msg-content table tr:nth-child(2n) {
    background-color: #161b22; /* Zebra striping */
}

.msg-content table tr {
    background-color: #0d1117;
}

/* Strong / Emphasis */
.msg-content strong {
    font-weight: 600;
    color: #fff;
}

.msg-content em {
    font-style: italic;
}

/* Links */
.msg-content a {
    color: #58a6ff;
    text-decoration: none;
}

.msg-content a:hover {
    text-decoration: underline;
}

/* Horizontal Rule */
.msg-content hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: #30363d;
    border: 0;
}
