/**
 * Markdown-Formatierung für Chat-Nachrichten
 * Dark-Mode-kompatibel
 */

/* Tabellen */
.markdown-table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.markdown-table thead {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.dark-mode .markdown-table thead {
    background-color: #2c3034;
    border-bottom-color: #495057;
}

.markdown-table th,
.markdown-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    text-align: left;
}

.dark-mode .markdown-table th,
.dark-mode .markdown-table td {
    border-color: #495057;
}

.markdown-table th {
    font-weight: 600;
    color: #495057;
}

.dark-mode .markdown-table th {
    color: #e9ecef;
}

.markdown-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.dark-mode .markdown-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Code-Blöcke */
.code-block-container {
    background-color: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    overflow: hidden;
    margin: 0.75rem 0;
}

.dark-mode .code-block-container {
    background-color: #1e1e1e;
    border-color: #3e3e42;
}

.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background-color: #e1e4e8;
    border-bottom: 1px solid #d1d5da;
}

.dark-mode .code-block-header {
    background-color: #2d2d30;
    border-bottom-color: #3e3e42;
}

.code-language {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #586069;
}

.dark-mode .code-language {
    color: #a0a0a0;
}

.code-copy-btn {
    background: transparent;
    border: none;
    color: #586069;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.code-copy-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #24292e;
}

.dark-mode .code-copy-btn {
    color: #a0a0a0;
}

.dark-mode .code-copy-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.code-copy-btn.copied {
    color: #28a745;
}

.code-block-container pre {
    margin: 0;
    padding: 0.75rem;
    overflow-x: auto;
    background-color: transparent;
}

.code-block-container code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #24292e;
    background-color: transparent;
}

.dark-mode .code-block-container code {
    color: #d4d4d4;
}

/* Inline-Code */
.inline-code {
    background-color: rgba(140, 82, 255, 0.1);
    color: #8c52ff;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.dark-mode .inline-code {
    background-color: rgba(140, 82, 255, 0.2);
    color: #a78bfa;
}

/* Listen */
.markdown-list {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.markdown-list li {
    margin-bottom: 0.25rem;
    line-height: 1.6;
}

.markdown-list ul,
.markdown-list ol {
    margin-top: 0.25rem;
}

/* Blockquotes */
.markdown-blockquote {
    border-left: 4px solid #8c52ff;
    padding-left: 1rem;
    margin: 0.75rem 0;
    color: #6c757d;
    font-style: italic;
}

.dark-mode .markdown-blockquote {
    border-left-color: #a78bfa;
    color: #adb5bd;
}

/* Links */
.markdown-link {
    color: #8c52ff;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.markdown-link:hover {
    border-bottom-color: #8c52ff;
}

.dark-mode .markdown-link {
    color: #a78bfa;
}

.dark-mode .markdown-link:hover {
    border-bottom-color: #a78bfa;
}

/* Überschriften in Chat-Nachrichten */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6,
.regio-it-message-content h1,
.regio-it-message-content h2,
.regio-it-message-content h3,
.regio-it-message-content h4,
.regio-it-message-content h5,
.regio-it-message-content h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.3;
}

.message-content h1,
.regio-it-message-content h1 {
    font-size: 1.5rem;
}

.message-content h2,
.regio-it-message-content h2 {
    font-size: 1.3rem;
}

.message-content h3,
.regio-it-message-content h3 {
    font-size: 1.1rem;
}

.message-content h4,
.regio-it-message-content h4 {
    font-size: 1rem;
}

.message-content h5,
.regio-it-message-content h5,
.message-content h6,
.regio-it-message-content h6 {
    font-size: 0.9rem;
}

/* Erste Überschrift ohne oberen Margin */
.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child,
.message-content h4:first-child,
.message-content h5:first-child,
.message-content h6:first-child,
.regio-it-message-content h1:first-child,
.regio-it-message-content h2:first-child,
.regio-it-message-content h3:first-child,
.regio-it-message-content h4:first-child,
.regio-it-message-content h5:first-child,
.regio-it-message-content h6:first-child {
    margin-top: 0;
}

/* Paragraphen */
.message-content p,
.regio-it-message-content p {
    margin-bottom: 0.75rem;
}

.message-content p:last-child,
.regio-it-message-content p:last-child {
    margin-bottom: 0;
}

/* Responsive Anpassungen */
@media (max-width: 768px) {
    .markdown-table {
        font-size: 0.8rem;
    }

    .markdown-table th,
    .markdown-table td {
        padding: 0.4rem 0.5rem;
    }

    .code-block-container code {
        font-size: 0.75rem;
    }

    .message-content h1,
    .regio-it-message-content h1 {
        font-size: 1.3rem;
    }

    .message-content h2,
    .regio-it-message-content h2 {
        font-size: 1.1rem;
    }
}

