/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #2d2d2d;
}
::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Chat Styles */
.chat-container {
    height: calc(100vh - 180px);
}
/* .message {
    max-width: 85%;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
} */
.user-message {
    background-color: #444654;
    color: #ffffff;
    margin-left: auto;
}
.assistant-message {
    background-color: #343541;
    color: #ffffff;
    border: 1px solid #444654;
}
.typing-indicator {
    display: inline-block;
    padding: 1rem;
}
.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #90cdf4;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
}

/* Enhanced Content Rendering Styles */
.message-content {
    line-height: 1.6;
    color: #ffffff;
}
.message-content p {
    margin-bottom: 1rem;
}
.message-content pre {
    background-color: #1e1e1e;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
}
.message-content code {
    font-family: 'Consolas', monospace;
}
.message-content :not(pre) > code {
    background-color: #444654;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.9em;
}
.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    overflow-x: auto;
    display: block;
}
.message-content th,
.message-content td {
    border: 1px solid #444654;
    padding: 0.5rem;
    text-align: left;
}
.message-content th {
    background-color: #444654;
    font-weight: bold;
}
.message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}
.message-content blockquote {
    border-left: 4px solid #444654;
    padding-left: 1rem;
    margin-left: 0;
    color: #a0aec0;
}
.message-content ul, .message-content ol {
    padding-left: 2rem;
    margin-bottom: 1rem;
}
.message-content ul {
    list-style-type: disc;
}
.message-content ol {
    list-style-type: decimal;
}
.message-content h1, .message-content h2, .message-content h3, 
.message-content h4, .message-content h5, .message-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #ffffff;
}
.message-content h1 { font-size: 1.8rem; }
.message-content h2 { font-size: 1.5rem; }
.message-content h3 { font-size: 1.3rem; }
.message-content h4 { font-size: 1.1rem; }
.mermaid {
    background-color: #343541;
    padding: 1rem;
    border-radius: 0.5rem;
}
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem 0;
    margin: 0.5rem 0;
}
.katex {
    font-size: 1.1em;
}

.katex-display {
    margin: 1em 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5em;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

/* Improve subscript display */
sub, .katex .msub {
    font-size: 0.8em;
    vertical-align: sub;
}

/* Fix for chemical arrows */
.assistant-message .katex .mrel {
    color: #ffffff;
}

/* Ensure chemical formulas display properly */
.message-content {
    overflow-x: auto;
}
.katex-display > .katex {
    font-size: 1.3em;
}
/* Fix for LaTeX display in tables */
.message-content table .katex-display {
    margin: 0;
}
/* Improve code block styling */
.message-content pre code.hljs {
    padding: 0;
    background: transparent;
}
/* Fix for inline code with LaTeX */
.message-content code .katex {
    background: transparent;
}

/* SVG rendering styles */
.rendered-svg, .svg-preview svg {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    background-color: #ffffff;
    padding: 1rem;
    border-radius: 0.5rem;
}

.svg-preview {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #ffffff;
    border-radius: 0.5rem;
    overflow: auto;
}

.svg-preview-wrapper {
    margin: 1rem 0;
}

.svg-preview-toggle {
    cursor: pointer;
    transition: background-color 0.2s;
}

.svg-preview-toggle:hover {
    background-color: #4a5568;
}

/* Source References Styles */
.source-references {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #444654;
}

.source-references h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #a0aec0;
}

.source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.source-item {
    background-color: #2d3748;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    max-width: 100%;
}

.source-item:hover {
    background-color: #4a5568;
}

.source-item .page-number {
    background-color: #4299e1;
    color: white;
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    margin-left: 0.5rem;
    font-size: 0.75rem;
}

/* PDF Viewer Styles */
.pdf-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.pdf-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #1a1a1a;
    border-bottom: 1px solid #333;
}

.pdf-viewer-title {
    font-size: 1.2rem;
    color: white;
    font-weight: bold;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-viewer-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pdf-viewer-page-info {
    color: white;
    margin-right: 1rem;
}

.pdf-viewer-close {
    background-color: #e53e3e;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.pdf-viewer-close:hover {
    background-color: #c53030;
}

.pdf-viewer-iframe {
    flex: 1;
    width: 100%;
    height: calc(100% - 60px);
    border: none;
    background-color: #f0f0f0;
}

.highlight-text {
    background-color: rgba(255, 255, 0, 0.3);
    padding: 0.125rem 0;
}

/* PDF Loading Indicator */
#pdf-loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 2rem;
    border-radius: 0.5rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

.loading-text {
    color: white;
    font-size: 1.2rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* PDF Error Message */
#pdf-error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 2rem;
    border-radius: 0.5rem;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    color: #e53e3e;
    margin-bottom: 1rem;
}

.error-text {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.error-details {
    color: #a0aec0;
    font-size: 0.9rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* PDF Page Navigation Controls */
.pdf-page-nav-controls {
    display: flex;
    align-items: center;
    margin-right: 1rem;
}

.page-nav-info {
    color: white;
    margin-right: 1rem;
    font-size: 0.9rem;
}

.page-nav-highlight {
    color: #90cdf4;
    font-style: italic;
    margin-left: 0.5rem;
}

.jump-to-page-btn {
    background-color: #4299e1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.jump-to-page-btn:hover {
    background-color: #3182ce;
}

/* Page Jump Modal */
.page-jump-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-jump-modal-content {
    background-color: #2d3748;
    padding: 2rem;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
}

.page-jump-modal-content h3 {
    color: white;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.page-jump-modal-content p {
    color: white;
    margin-bottom: 1rem;
}

.page-jump-modal-content ol {
    color: white;
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.page-jump-modal-content li {
    margin-bottom: 0.5rem;
}

.search-text {
    background-color: #1a202c;
    padding: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1.5rem;
    color: #e2e8f0;
    font-size: 0.9rem;
}

.close-modal-btn {
    background-color: #4299e1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.close-modal-btn:hover {
    background-color: #3182ce;
}

/* Page Navigation Hint */
.page-nav-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(45, 55, 72, 0.9);
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1002;
    display: flex;
    align-items: center;
    max-width: 80%;
    animation: slide-up 0.5s ease-out;
}

.hint-content {
    color: white;
    font-size: 0.9rem;
    margin-right: 1rem;
}

.hint-highlight {
    display: block;
    margin-top: 0.5rem;
    color: #90cdf4;
    font-style: italic;
}

.hint-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.hint-fade-out {
    animation: fade-out 0.5s ease-out forwards;
}

@keyframes slide-up {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Chemical equation styling */
/* .katex {
    font-size: 1.1em;
}

.katex-display {
    margin: 1em 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5em;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
} */


/* Improve MathJax rendering */
mjx-container {
    overflow-x: auto !important;
    padding: 0.5rem 0 !important;
}

mjx-container[jax="CHTML"][display="true"] {
    background-color: rgba(30, 30, 47, 0.5) !important;
    border-radius: 4px !important;
    padding: 0.5rem !important;
    margin: 1rem 0 !important;
}

/* Enhanced Math and Chemistry Rendering */
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1rem;
    margin: 1rem 0;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
}

.katex {
    font-size: 1.1em;
    color: #ffffff;
}

/* Improve chemical formula display */
.katex .msupsub {
    text-align: left;
}

.katex .mord.mathnormal {
    font-style: normal;
}

/* Improve display of chemical arrows */
.katex .mrel {
    color: #ffffff;
}

/* Ensure proper spacing in chemical formulas */
.katex .mord + .mord {
    margin-left: 0.05em;
}

/* Improve code block styling for LaTeX */
.message-content pre code.language-latex {
    background-color: rgba(255, 255, 255, 0.05);
    color: #f8f8f2;
}

/* Improve table styling */
.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    overflow-x: auto;
    display: block;
}

.message-content table th,
.message-content table td {
    border: 1px solid #444654;
    padding: 0.75rem;
    text-align: left;
}

.message-content table th {
    background-color: #2d3748;
    color: #ffffff;
}

.message-content table tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.05);
}


/* Fix for chemical formulas with subscripts */
.message-content sub, 
.message-content .katex .msub,
.message-content mjx-container mjx-sub {
    font-size: 0.8em !important;
    vertical-align: sub !important;
}

/* Fix for chemical arrows */
.message-content .katex .mrel,
.message-content mjx-container mjx-arrow {
    color: #ffffff !important;
}

/* Ensure chemical formulas display properly */
.message-content {
    overflow-x: auto !important;
}

/* Improve subscript display */
sub, .katex .msub {
    font-size: 0.8em;
    vertical-align: sub;
}

/* Fix for chemical arrows */
.assistant-message .katex .mrel {
    color: #ffffff;
}

/* Ensure chemical formulas display properly */
.message-content {
    overflow-x: auto;
}
.katex-display > .katex {
    font-size: 1.3em;
}
/* Fix for LaTeX display in tables */
.message-content table .katex-display {
    margin: 0;
}
/* Improve code block styling */
.message-content pre code.hljs {
    padding: 0;
    background: transparent;
}
/* Fix for inline code with LaTeX */
.message-content code .katex {
    background: transparent;
}

/* SVG rendering styles */
.rendered-svg, .svg-preview svg {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    background-color: #ffffff;
    padding: 1rem;
    border-radius: 0.5rem;
}

.svg-preview {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #ffffff;
    border-radius: 0.5rem;
    overflow: auto;
}

.svg-preview-wrapper {
    margin: 1rem 0;
}

.svg-preview-toggle {
    cursor: pointer;
    transition: background-color 0.2s;
}

.svg-preview-toggle:hover {
    background-color: #4a5568;
}

/* Source References Styles */
.source-references {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #444654;
}

.source-references h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #a0aec0;
}

.source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.source-item {
    background-color: #2d3748;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    max-width: 100%;
}

.source-item:hover {
    background-color: #4a5568;
}

.source-item .page-number {
    background-color: #4299e1;
    color: white;
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    margin-left: 0.5rem;
    font-size: 0.75rem;
}

/* PDF Viewer Styles */
.pdf-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.pdf-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #1a1a1a;
    border-bottom: 1px solid #333;
}

.pdf-viewer-title {
    font-size: 1.2rem;
    color: white;
    font-weight: bold;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-viewer-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pdf-viewer-page-info {
    color: white;
    margin-right: 1rem;
}

.pdf-viewer-close {
    background-color: #e53e3e;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.pdf-viewer-close:hover {
    background-color: #c53030;
}

.pdf-viewer-iframe {
    flex: 1;
    width: 100%;
    height: calc(100% - 60px);
    border: none;
    background-color: #f0f0f0;
}

.highlight-text {
    background-color: rgba(255, 255, 0, 0.3);
    padding: 0.125rem 0;
}

/* PDF Loading Indicator */
#pdf-loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 2rem;
    border-radius: 0.5rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

.loading-text {
    color: white;
    font-size: 1.2rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* PDF Error Message */
#pdf-error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 2rem;
    border-radius: 0.5rem;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    color: #e53e3e;
    margin-bottom: 1rem;
}

.error-text {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.error-details {
    color: #a0aec0;
    font-size: 0.9rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* PDF Page Navigation Controls */
.pdf-page-nav-controls {
    display: flex;
    align-items: center;
    margin-right: 1rem;
}

.page-nav-info {
    color: white;
    margin-right: 1rem;
    font-size: 0.9rem;
}

.page-nav-highlight {
    color: #90cdf4;
    font-style: italic;
    margin-left: 0.5rem;
}

.jump-to-page-btn {
    background-color: #4299e1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.jump-to-page-btn:hover {
    background-color: #3182ce;
}

/* Page Jump Modal */
.page-jump-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-jump-modal-content {
    background-color: #2d3748;
    padding: 2rem;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
}

.page-jump-modal-content h3 {
    color: white;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.page-jump-modal-content p {
    color: white;
    margin-bottom: 1rem;
}

.page-jump-modal-content ol {
    color: white;
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.page-jump-modal-content li {
    margin-bottom: 0.5rem;
}

.search-text {
    background-color: #1a202c;
    padding: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 1.5rem;
    color: #e2e8f0;
    font-size: 0.9rem;
}

.close-modal-btn {
    background-color: #4299e1;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
}

.close-modal-btn:hover {
    background-color: #3182ce;
}

/* Page Navigation Hint */
.page-nav-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(45, 55, 72, 0.9);
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1002;
    display: flex;
    align-items: center;
    max-width: 80%;
    animation: slide-up 0.5s ease-out;
}

.hint-content {
    color: white;
    font-size: 0.9rem;
    margin-right: 1rem;
}

.hint-highlight {
    display: block;
    margin-top: 0.5rem;
    color: #90cdf4;
    font-style: italic;
}

.hint-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.hint-fade-out {
    animation: fade-out 0.5s ease-out forwards;
}

@keyframes slide-up {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}



/* Mermaid Diagram Styles - Enhanced for better visualization */
.mermaid-wrapper {
    margin: 1.5rem 0;
    overflow: hidden;
    border-radius: 0.5rem;
    background-color: #1e1e2f;
    padding: 1.5rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.mermaid {
    background-color: #1e1e2f;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow: visible;
    text-align: center;
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Improve mermaid diagram visibility with better contrast */
.mermaid .node rect, 
.mermaid .node circle, 
.mermaid .node ellipse, 
.mermaid .node polygon,
.mermaid .node path {
    fill: #2d3748 !important;
    stroke: #90cdf4 !important;
    stroke-width: 2px !important;
}

.mermaid .cluster rect {
    fill: #1a202c !important;
    stroke: #4a5568 !important;
    stroke-width: 1px !important;
}

.mermaid .label {
    color: #e2e8f0 !important;
    font-family: 'Roboto', sans-serif !important;
    font-weight: 500 !important;
}

.mermaid .nodeLabel {
    color: white !important;
    font-weight: 500 !important;
}

.mermaid .edgeLabel {
    background-color: #1e1e2f !important;
    color: #e2e8f0 !important;
    font-size: 0.9em !important;
    padding: 2px 4px !important;
    border-radius: 4px !important;
}

.mermaid .edgePath .path {
    stroke: #90cdf4 !important;
    stroke-width: 2px !important;
}

.mermaid .flowchart-link {
    stroke: #90cdf4 !important;
    stroke-width: 2px !important;
}

/* Fix for chemistry diagrams specifically */
.mermaid [id^="flowchart-"] {
    fill: #1e1e2f !important;
}

/* Improve visibility of diagram text */
.mermaid text {
    fill: #ffffff !important;
    font-family: 'Roboto', sans-serif !important;
    font-size: 14px !important;
}

/* Add loading state for mermaid diagrams */
.mermaid.loading {
    position: relative;
    min-height: 150px;
}

.mermaid.loading:after {
    content: "Rendering diagram...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #90cdf4;
    font-size: 14px;
}

/* Ensure SVG elements in mermaid are properly sized */
.mermaid svg {
    max-width: 100% !important;
    height: auto !important;
}

/* Add this to your existing Mermaid styles */
.mermaid-error {
    color: #ff6b6b;
    background-color: rgba(255, 107, 107, 0.1);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #ff6b6b;
    margin: 1rem 0;
    font-family: monospace;
    white-space: pre-wrap;
    text-align: left;
}

.mermaid.error {
    background-color: #2d2d3d;
    min-height: auto;
}
/* Add these styles for chemical equations */
.message-content .MathJax {
    font-size: 1.2em !important;
    margin: 0.5rem 0;
}

/* Improve display of chemical equations */
.message-content mjx-container {
    overflow-x: auto;
    padding: 0.5rem 0;
}

/* Ensure chemical arrows display properly */
.message-content mjx-container mjx-arrow {
    color: #ffffff !important;
}

/* Ensure subscripts display properly */
.message-content mjx-container mjx-sub {
    font-size: 0.8em;
}

/* Add a subtle background to equations for better visibility */
.message-content mjx-container[jax="CHTML"][display="true"] {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 0.5rem;
    margin: 1rem 0;
}