/* Markdown rendering inside chat bubbles */

.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4 {
    color: var(--text-primary);
    font-weight: 600;
    margin: 0.6em 0 0.3em;
}

.message-text h1 { font-size: 1.3em; }
.message-text h2 { font-size: 1.15em; }
.message-text h3 { font-size: 1.05em; }
.message-text h4 { font-size: 1em; }

.message-text p {
    margin: 0.4em 0;
    line-height: 1.5;
}

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

.message-text em {
    font-style: italic;
    color: var(--text-secondary);
}

.message-text ol,
.message-text ul {
    margin: 0.4em 0;
    padding-left: 1.4em;
}

.message-text li {
    margin: 0.3em 0;
    line-height: 1.5;
}

.message-text li + li {
    margin-top: 0.25em;
}

.message-text code {
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary-color);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
}

.message-text pre {
    background: var(--bg-color);
    border: 1px solid var(--surface-light);
    border-radius: 8px;
    padding: 0.8em 1em;
    margin: 0.5em 0;
    overflow-x: auto;
}

.message-text pre code {
    background: none;
    color: var(--text-primary);
    padding: 0;
    font-size: 0.85em;
}

.message-text blockquote {
    border-left: 3px solid var(--primary-color);
    margin: 0.5em 0;
    padding: 0.3em 0.8em;
    color: var(--text-secondary);
    background: rgba(139, 92, 246, 0.05);
    border-radius: 0 6px 6px 0;
}

.message-text a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.message-text a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.message-text hr {
    border: none;
    border-top: 1px solid var(--surface-light);
    margin: 0.6em 0;
}

.message-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
    font-size: 0.9em;
}

.message-text th,
.message-text td {
    border: 1px solid var(--surface-light);
    padding: 0.4em 0.6em;
    text-align: left;
}

.message-text th {
    background: rgba(139, 92, 246, 0.1);
    font-weight: 600;
}

/* First and last element margin cleanup inside bubbles */
.message-text > :first-child {
    margin-top: 0;
}

.message-text > :last-child {
    margin-bottom: 0;
}
