/* Responsive Table Wrapper with Horizontal Scroll */
.table-wrapper,
.aichat-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin: 16px 0;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    -webkit-overflow-scrolling: touch;
    background: #ffffff;
}

.table-wrapper table,
.aichat-table-wrap table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    margin: 0 !important;
    font-size: 13.5px;
}

/* Markdown rendered content styles */
.markdown-content table,
.prose-content table,
.prose table,
.blog-content table,
.video-description table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 13.5px;
}

.markdown-content table thead,
.prose-content table thead,
.prose table thead,
.video-description table thead {
    background: #f8f9fa;
}

.markdown-content table th,
.prose-content table th,
.prose table th,
.video-description table th {
    border: 1px solid #e9ecef;
    padding: 10px 14px;
    text-align: left;
    font-weight: 700;
    color: #112240;
    white-space: nowrap;
}

.markdown-content table td,
.prose-content table td,
.prose table td,
.video-description table td {
    border: 1px solid #e9ecef;
    padding: 10px 14px;
    color: #334155;
    white-space: nowrap;
}

.markdown-content table tbody tr:hover,
.prose-content table tbody tr:hover,
.prose table tbody tr:hover,
.video-description table tbody tr:hover {
    background: #f1f5f9;
}

.markdown-content table tbody tr:nth-child(even),
.prose-content table tbody tr:nth-child(even),
.prose table tbody tr:nth-child(even),
.video-description table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

/* Markdown Images */
.prose img,
.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
    display: block;
}

/* Markdown Blockquotes - Synced with AI Chat */
.prose blockquote,
.markdown-content blockquote {
    border-left: 3px solid #186af7;
    padding: 8px 16px;
    margin: 14px 0;
    color: #475569;
    font-style: italic;
    background: rgba(24,106,247,0.04);
    border-radius: 0 6px 6px 0;
}

/* Markdown Lists */
.prose ul,
.markdown-content ul {
    list-style-type: disc;
    padding-left: 24px;
    margin: 12px 0;
}

.prose ol,
.markdown-content ol {
    list-style-type: decimal;
    padding-left: 24px;
    margin: 12px 0;
}

.prose li,
.markdown-content li {
    margin-bottom: 4px;
}

/* Code Blocks & Syntax Highlighting - Synced with AI Chat (#112240) */
.prose pre,
.markdown-content pre,
.blog-content pre {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    white-space: pre !important;
    word-wrap: normal !important;
    word-break: normal !important;
    background: #112240;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    margin: 16px 0;
    border: 1px solid rgba(255,255,255,0.05);
    -webkit-overflow-scrolling: touch;
}

/* Inline Code Badge - Synced with AI Chat (#186af7 accent) */
.prose code,
.markdown-content code {
    background: rgba(24,106,247,0.08);
    color: #186af7;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12.5px;
    font-weight: 500;
}

.prose pre code,
.markdown-content pre code {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    font-size: 13px !important;
    white-space: pre !important;
    overflow-wrap: normal;
    tab-size: 4;
    font-variant-ligatures: none;
}

/* MathJax Formulas Horizontal Scroll */
mjx-container[jax="CHTML"][display="true"] {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    max-width: 100% !important;
    padding: 8px 0 !important;
}

/* Custom Thin Scrollbars for Tables & Code Blocks */
.table-wrapper::-webkit-scrollbar,
.aichat-table-wrap::-webkit-scrollbar,
.prose pre::-webkit-scrollbar,
mjx-container::-webkit-scrollbar {
    height: 6px;
}

.table-wrapper::-webkit-scrollbar-thumb,
.aichat-table-wrap::-webkit-scrollbar-thumb,
.prose pre::-webkit-scrollbar-thumb,
mjx-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover,
.aichat-table-wrap::-webkit-scrollbar-thumb:hover,
.prose pre::-webkit-scrollbar-thumb:hover,
mjx-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

@media (max-width: 768px) {
    .markdown-content table th,
    .markdown-content table td,
    .prose-content table th,
    .prose-content table td,
    .prose table th,
    .prose table td,
    .video-description table th,
    .video-description table td {
        padding: 8px 10px;
        font-size: 12px;
    }
}
