/* ═══════════════════════════════════════════════════════════
   THE MAD SCIENTIST'S RESEARCH LABORATORY
   ⚗️  Where Academia Meets Brilliant Madness  ⚗️
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Special+Elite&family=Share+Tech+Mono&family=Cinzel:wght@600;700&display=swap');

:root {
    /* ── Core palette ── */
    --primary-color:   #00d4ff;   /* electric cyan  */
    --primary-hover:   #00b8d9;
    --secondary-color: #7c3aed;   /* deep violet    */

    /* ── Surfaces ── */
    --background-color: #07101f;  /* midnight lab   */
    --chat-bg:          #0c1a2e;  /* panel surface  */

    /* ── Messages ── */
    --user-message-bg:        #0a2540;
    --user-message-text:      #a5d8ff;
    --assistant-message-bg:   #061a0a;
    --assistant-message-text: #86efac;

    /* ── Borders & shadows ── */
    --border-color: #1a3a5c;
    --shadow: 0 4px 24px rgba(0, 212, 255, 0.12);

    /* ── Typography ── */
    --text-primary:   #d4eeff;
    --text-secondary: #4e7ca0;

    /* ── State colors ── */
    --success-color: #00ff88;
    --error-color:   #ff4444;
    --warning-color: #ffd700;

    /* ── Glow effects ── */
    --glow-cyan:   0 0 18px rgba(0, 212, 255, 0.55);
    --glow-green:  0 0 18px rgba(0, 255, 136, 0.50);
    --glow-amber:  0 0 18px rgba(255, 215,   0, 0.50);
    --glow-red:    0 0 18px rgba(255,  68,  68, 0.55);
    --neon-cyan:   #00d4ff;
    --neon-green:  #00ff88;
    --neon-amber:  #ffd700;
    --neon-purple: #a855f7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Share Tech Mono', 'SFMono-Regular', Consolas, monospace;
    background-color: var(--background-color);
    /* Graph-paper grid — the lab notebook */
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.04) 1px, transparent 1px);
    background-size: 36px 36px;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.header h1 {
    font-family: 'Cinzel', 'Special Elite', Georgia, serif;
    color: var(--neon-cyan);
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-shadow: var(--glow-cyan), 0 0 60px rgba(0, 212, 255, 0.25);
    margin-bottom: 8px;
}

.header p {
    font-family: 'Special Elite', 'Courier New', monospace;
    color: var(--neon-amber);
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-shadow: var(--glow-amber);
    opacity: 0.85;
}

/* Chat Container */
.chat-container {
    background: var(--chat-bg);
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 600px;
}

/* Status Bar */
.status-bar {
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Live Updates (CLI-like feed) */
.live-updates {
    margin: 0 16px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #0f172a;
    color: #e2e8f0;
    box-shadow: var(--shadow);
    max-height: 220px;
    display: flex;
    flex-direction: column;
}

.live-updates__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.9rem;
}

.live-updates__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.15);
    animation: pulse 2s infinite;
}

.live-dot.paused {
    background: var(--warning-color);
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.18);
}

.live-dot.error {
    background: var(--error-color);
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.18);
}

.live-op-count {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
}

.live-updates__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.live-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.live-updates__body {
    padding: 10px 14px;
    overflow-y: auto;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-height: 0;
}

.live-entry {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.live-entry .live-timestamp {
    color: #94a3b8;
    min-width: 64px;
}

.live-entry .live-label {
    font-weight: 600;
    color: #cbd5e1;
}

.live-entry.info .live-label { color: #38bdf8; }
.live-entry.progress .live-label { color: #f59e0b; }
.live-entry.success .live-label { color: #34d399; }
.live-entry.error .live-label { color: #f87171; }
.live-entry.debug .live-label { color: #c084fc; }
.live-entry.warning .live-label { color: #fbbf24; }

.live-entry .live-message {
    color: #e2e8f0;
    word-break: break-word;
}

.live-progress-bar {
    position: relative;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-top: 4px;
}

.live-progress-bar .live-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    width: 0%;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

.status-dot.disconnected {
    background: var(--error-color);
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Messages Area */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fefefe;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message Styles */
.message {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.message-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.user-message .message-avatar {
    background: var(--primary-color);
    color: white;
}

.assistant-message .message-avatar {
    background: var(--success-color);
    color: white;
}

.system-message .message-avatar {
    background: var(--secondary-color);
    color: white;
}

.message-content {
    background: var(--assistant-message-bg);
    padding: 16px;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    position: relative;
}

.user-message {
    align-self: flex-end;
}

.user-message .message-content {
    background: var(--user-message-bg);
    color: var(--user-message-text);
    margin-left: auto;
}

.assistant-message .message-content {
    background: var(--assistant-message-bg);
    color: var(--assistant-message-text);
}

.system-message .message-content {
    background: #f3f4f6;
    color: var(--text-secondary);
    font-style: italic;
    align-self: center;
    max-width: 60%;
    text-align: center;
}

/* Progress Indicator */
.progress-message {
    background: #fef3cd;
    border: 1px solid #fbbf24;
    color: #92400e;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-message .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #fbbf24;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress message slow warning */
.progress-message.progress-slow {
    background-color: #fef3c7;
    border-color: #f59e0b;
}

.progress-message.progress-slow .spinner {
    border-color: #f59e0b;
    border-top-color: transparent;
}

/* Results Display */
.search-results {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 16px;
    margin-top: 10px;
}

.result-item {
    background: white;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    border-left: 4px solid var(--primary-color);
}

.result-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.result-authors {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.result-abstract {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Input Area */
.input-container {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 20px;
}

.input-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

#message-input {
    width: 100%;
    min-height: 50px;
    max-height: 150px;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1rem;
    resize: none;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
    background: white;
}

#message-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#message-input::placeholder {
    color: var(--text-secondary);
}

.send-button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.send-button:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.send-button:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
}

/* Suggestions */
.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.suggestion-chip {
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-chip:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Responsive Design */
/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .quick-actions {
        flex-wrap: wrap;
    }
    
    .action-btn {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    .suggestion-chip {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
    
    .provider-controls {
        flex-direction: column;
    }
    
    .provider-group {
        width: 100%;
    }
}

/* ==================== Formatted Response Styles ==================== */

/* Main formatted response container */
.formatted-response {
    line-height: 1.8;
    color: var(--assistant-message-text);
}

/* Response content area */
.response-content {
    margin-bottom: 1.5rem;
}

/* Headers in responses */
.response-content h1,
.response-content h2,
.response-content h3,
.response-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.response-content h1 {
    font-size: 1.8rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.response-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
}

.response-content h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
}

.response-content h4 {
    font-size: 1.1rem;
}

/* Paragraphs */
.response-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.response-content p.reference {
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--background-color);
    padding: 0.5rem;
    border-left: 3px solid var(--secondary-color);
    margin: 0.5rem 0;
}

/* Lists */
.response-content ul,
.response-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.response-content ul li,
.response-content ol li {
    margin-bottom: 0.5rem;
}

.response-content ul {
    list-style-type: disc;
}

.response-content ol {
    list-style-type: decimal;
}

/* Inline formatting */
.response-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

.response-content em {
    font-style: italic;
}

.response-content code {
    background: var(--background-color);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #d73a49;
}

/* Code blocks */
.response-content pre {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.response-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Links */
.response-content a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px dotted var(--primary-color);
}

.response-content a:hover {
    color: var(--primary-hover);
    border-bottom-style: solid;
}

/* Blockquotes */
.response-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Sources section */
.sources-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.sources-section h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.sources-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--background-color);
    border-radius: 6px;
    transition: all 0.2s;
}

.source-item:hover {
    background: #e0f2fe;
    transform: translateX(5px);
}

.source-number {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 25px;
}

.source-name {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.source-relevance {
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Tables in responses */
.response-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.response-content table th,
.response-content table td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.response-content table th {
    background: var(--background-color);
    font-weight: 600;
    color: var(--text-primary);
}

.response-content table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

/* Horizontal rules */
.response-content hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 2rem 0;
}


/* Loading States */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px;
    background: var(--assistant-message-bg);
    border-radius: 12px;
    max-width: 85%;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Provider Controls Panel */
.provider-panel {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.provider-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.provider-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.provider-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.provider-select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.provider-select:hover {
    border-color: var(--primary-color);
}

.provider-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.provider-status {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.provider-badge {
    background: var(--background-color);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--background-color);
    margin-bottom: 15px;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.upload-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.upload-icon {
    font-size: 1.5rem;
}

/* Quick Action Buttons */
.quick-actions {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

/* Optional literature review toggles */
.literature-review-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 0 0;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--background-color);
}

.literature-review-options__row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.literature-review-options .prompt-search-input {
    flex: 1;
    min-width: 220px;
}

.action-btn {
    background: white;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Paper Results Styling */
.paper-results {
    margin-top: 15px;
    max-height: 500px;
    overflow-y: auto;
}

.paper-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    margin-bottom: 12px;
    background: var(--background-color);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.paper-number {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.paper-details {
    flex: 1;
}

.paper-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.paper-authors {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.paper-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.paper-abstract {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-top: 8px;
}

.paper-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.paper-link:hover {
    text-decoration: underline;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.stat-box {
    background: var(--background-color);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.node-types {
    margin-top: 15px;
    padding: 15px;
    background: var(--background-color);
    border-radius: 8px;
}

.type-badge {
    display: inline-block;
    background: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin: 4px;
    border: 1px solid var(--border-color);
}

.inline-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 8px;
    display: inline-block;
    margin-top: 10px;
    transition: all 0.2s;
}

.inline-link:hover {
    background: var(--primary-color);
    color: white;
}

/* Header Actions */
.header-actions {
    margin-top: 15px;
}

.vue-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.btn-link {
    display: inline-block;
    padding: 8px 16px;
    background: white;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    border: 2px solid var(--primary-color);
    transition: all 0.2s;
}

.btn-link:hover {
    background: var(--primary-color);
    color: white;
}

.btn-link--active {
    background: var(--primary-color);
    color: white;
}

.request-activity {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #bfdbfe;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.request-activity.hidden {
    display: none;
}

.request-activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.request-activity-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e40af;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.request-activity-timer {
    font-size: 0.8rem;
    color: #1d4ed8;
    font-weight: 600;
}

.request-activity-stage {
    color: #1e3a8a;
    font-size: 0.92rem;
    margin-bottom: 8px;
}

.request-activity-progress {
    width: 100%;
    height: 8px;
    background: rgba(30, 64, 175, 0.15);
    border-radius: 999px;
    overflow: hidden;
}

.request-activity-progress-fill {
    height: 100%;
    width: 8%;
    min-width: 8%;
    border-radius: 999px;
    background: linear-gradient(90deg, #1d4ed8, #2563eb, #38bdf8);
    transition: width 0.3s ease;
    animation: requestProgressShimmer 1.2s linear infinite;
}

@keyframes requestProgressShimmer {
    0% {
        filter: brightness(0.95);
    }
    50% {
        filter: brightness(1.1);
    }
    100% {
        filter: brightness(0.95);
    }
}

/* Reset Data Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--background-color);
    margin: 2% auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--chat-bg);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.modal-header .close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-header .close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    background: var(--chat-bg);
}

.warning-message {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.warning-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.warning-text {
    flex: 1;
}

.warning-text strong {
    color: #856404;
    display: block;
    margin-bottom: 0.5rem;
}

.warning-text p {
    margin: 0;
    color: #856404;
    font-size: 0.9rem;
}

.reset-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.reset-option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--chat-bg);
}

.reset-option:hover {
    border-color: var(--primary-color);
    background: var(--user-message-bg);
}

.reset-option input[type="checkbox"] {
    margin-top: 0.2rem;
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-color);
}

.option-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.option-details strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.option-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.3;
}

.confirmation-section {
    padding: 1rem;
    background: var(--chat-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.confirmation-section p {
    margin: 0 0 0.75rem 0;
    font-weight: 600;
    color: var(--text-primary);
}

.confirmation-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: monospace;
    text-align: center;
    transition: border-color 0.2s ease;
}

.confirmation-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    border-color: #bd2130;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.btn-danger:disabled {
    background: var(--border-color);
    border-color: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.danger-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: 1px solid #ff6b6b;
}

.danger-btn:hover {
    background: linear-gradient(135deg, #ff5252, #e53e3e);
    border-color: #ff5252;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
}

.reset-status {
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.progress-container {
    text-align: center;
}

.progress-message {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #4facfe);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.reset-success {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.success-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.success-message strong {
    color: #155724;
    display: block;
    margin-bottom: 0.5rem;
}

.success-message p {
    margin: 0;
    color: #155724;
    font-size: 0.9rem;
}

.reset-error {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.error-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.error-message strong {
    color: #721c24;
    display: block;
    margin-bottom: 0.5rem;
}

.error-message p {
    margin: 0;
    color: #721c24;
    font-size: 0.9rem;
}

.reset-details {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--chat-bg);
    border-radius: 8px;
}

.reset-details h4 {
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
}

.reset-details ul {
    margin: 0;
    padding-left: 1.5rem;
    list-style: none;
}

.reset-details li {
    padding: 0.25rem 0;
    color: var(--text-primary);
}

.reset-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Metadata page dashboard improvements */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.dashboard-actions {
    display: flex;
    gap: 0.75rem;
}

.system-info {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--chat-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row strong {
    color: var(--text-primary);
}

.info-row span {
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 0.9rem;
}

/* Stop Button */
.stop-button {
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: pulseRed 2s infinite;
}

.stop-button:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.stop-button.hidden {
    display: none;
}

@keyframes pulseRed {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

/* Thinking Indicator with Visual Feedback */
.thinking-indicator .thinking-content {
    background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 100%);
    padding: 20px;
    border-radius: 12px;
}

.thinking-animation {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.thinking-bubble {
    font-size: 24px;
    animation: float 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.thinking-text {
    font-style: italic;
    color: var(--text-secondary);
    font-weight: 500;
}

.reasoning-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.reasoning-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border-radius: 8px;
    color: var(--text-secondary);
    opacity: 0.4;
    transition: all 0.3s ease;
}

.reasoning-step.active {
    opacity: 1;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

/* Streaming Message Indicator */
.streaming-message {
    position: relative;
}

.streaming-badge {
    background: var(--error-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.streaming-content {
    min-height: 40px;
}

/* Message Actions - Embedded Actions */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.embedded-action-btn {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.embedded-action-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Fade In Animation for Messages */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Formatted Response */
.formatted-response {
    line-height: 1.8;
}

.formatted-response h1,
.formatted-response h2,
.formatted-response h3 {
    margin: 16px 0 12px 0;
    color: var(--primary-color);
}

.formatted-response h1 {
    font-size: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
}

.formatted-response h2 {
    font-size: 1.3rem;
}

.formatted-response h3 {
    font-size: 1.1rem;
}

.formatted-response strong {
    color: var(--text-primary);
    font-weight: 700;
}

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

.formatted-response code {
    background: var(--background-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #d73a49;
}

/* Context-Aware Highlights */
.context-highlight {
    background: rgba(37, 99, 235, 0.1);
    border-left: 3px solid var(--primary-color);
    padding: 12px;
    margin: 8px 0;
    border-radius: 4px;
}

/* User Preference Controls */
.preference-controls {
    display: flex;
    gap: 15px;
    padding: 10px;
    background: var(--background-color);
    border-radius: 8px;
    margin: 10px 0;
}

.preference-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preference-item label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.preference-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    .provider-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .provider-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .provider-select {
        width: 100%;
    }
    
    .provider-status {
        margin-left: 0;
        flex-direction: column;
    }
    
    .quick-actions {
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-content {
        width: 95%;
        margin: 1% auto;
    }
    
    .reset-options {
        gap: 0.75rem;
    }
    
    .reset-option {
        padding: 0.75rem;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .reset-actions {
        flex-direction: column;
    }
    
    .stop-button {
        font-size: 0.9rem;
        padding: 12px 20px;
        min-width: 80px;
    }
    
    .reasoning-steps {
        font-size: 0.85rem;
    }
    
    .message-actions {
        flex-direction: column;
    }
    
    .embedded-action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Progress System Styles */

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

/* Progress Modal Specific Styles */
.modal.progress-modal {
    z-index: 9999;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal.startup-modal {
    display: block !important;
}

.modal.startup-modal.hidden {
    display: none !important;
}

.modal.startup-modal {
    display: block !important;
}

.progress-modal .modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.5s ease-out;
}

.progress-modal .modal-header {
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.progress-modal .modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.progress-modal .subtitle {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 5px;
}

/* Progress Container */
.progress-container {
    margin: 20px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 4px;
    transition: width 0.3s ease-in-out;
    width: 0%;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.progress-text #startup-progress-percent {
    font-weight: 600;
    color: #4facfe;
}

/* Progress Stages */
.progress-details {
    margin-top: 25px;
    max-height: 300px;
    overflow-y: auto;
}

.progress-stage {
    display: flex;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    transition: all 0.3s ease;
}

.stage-icon {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    font-size: 16px;
}

.stage-text {
    flex: 1;
    margin-right: 12px;
}

.stage-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.progress-stage.pending .stage-status {
    background-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

.progress-stage.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px 12px;
}

.progress-stage.active .stage-icon {
    animation: spin 1s linear infinite;
}

.progress-stage.active .stage-status {
    background-color: #4facfe;
    color: white;
}

.progress-stage.completed .stage-icon {
    color: #4CAF50;
}

.progress-stage.completed .stage-status {
    background-color: #4CAF50;
    color: white;
}

.progress-stage.error .stage-icon {
    color: #f44336;
}

.progress-stage.error .stage-status {
    background-color: #f44336;
    color: white;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: toastSlideIn 0.3s ease-out;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.toast:hover {
    transform: translateX(-5px);
}

.toast.info {
    border-left: 4px solid #2196F3;
}

.toast.success {
    border-left: 4px solid #4CAF50;
}

.toast.warning {
    border-left: 4px solid #FF9800;
}

.toast.error {
    border-left: 4px solid #f44336;
}

.toast.progress {
    border-left: 4px solid #9C27B0;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.toast-message {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.toast-progress {
    margin-top: 8px;
}

.toast-progress .progress-bar {
    height: 4px;
    background-color: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
}

.toast-progress .progress-fill {
    height: 100%;
    background-color: #9C27B0;
    transition: width 0.3s ease;
}

.toast-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #666;
}

/* Animations */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Progress Modal Responsive */
@media (max-width: 768px) {
    .progress-modal .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .toast {
        margin: 0;
        width: 100%;
    }
}

/* ===== LIVE UPDATES STYLING (NEW) ===== */

.live-update {
    padding: 8px 12px;
    margin: 4px 0;
    border-left: 4px solid #ccc;
    background-color: #f9f9f9;
    font-family: 'Courier New', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: slideIn 0.2s ease-out;
}

/* Color-coded update levels */
.live-update--info {
    border-left-color: #0066cc;
    background-color: #f0f5ff;
    color: #0033aa;
}

.live-update--debug {
    border-left-color: #9966cc;
    background-color: #f5f0ff;
    color: #663399;
}

.live-update--warning {
    border-left-color: #ff9900;
    background-color: #fff5f0;
    color: #cc6600;
}

.live-update--error {
    border-left-color: #cc0000;
    background-color: #ffe6e6;
    color: #880000;
}

.live-update--success {
    border-left-color: #00aa00;
    background-color: #e6ffe6;
    color: #006600;
}

.live-update--progress {
    border-left-color: #0099ff;
    background-color: #e6f7ff;
    color: #0055aa;
}

/* Component styling */
.live-time {
    color: #999;
    font-weight: bold;
    white-space: nowrap;
    min-width: 100px;
    font-size: 11px;
}

.live-icon {
    display: inline-block;
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.live-operation {
    color: inherit;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 11px;
    min-width: 70px;
    white-space: nowrap;
    flex-shrink: 0;
}

.live-message {
    flex-grow: 1;
    color: inherit;
    word-break: break-word;
}

.live-status {
    color: inherit;
    font-style: italic;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

.live-percent {
    color: inherit;
    font-weight: bold;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 45px;
    text-align: right;
}

.live-source {
    color: #999;
    font-size: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scrollbar styling for live updates container */
#live-updates-body::-webkit-scrollbar {
    width: 8px;
}

#live-updates-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#live-updates-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#live-updates-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .live-update {
        font-size: 11px;
        padding: 6px 8px;
        gap: 4px;
    }
    
    .live-operation {
        min-width: 50px;
    }
    
    .live-percent {
        display: none;
    }
}

/* ═══════════════════════════════════════════════════════════
   MAD SCIENTIST THEME — OVERRIDES
   Hardcoded colours in the structural CSS that the :root
   variables above cannot reach are patched here.
   ═══════════════════════════════════════════════════════════ */

/* ── Scrollbars ── */
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: #060c16; }
*::-webkit-scrollbar-thumb { background: #1a3a5c; border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--primary-color); }

/* ── Chat container ── */
.chat-container {
    background: var(--chat-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.08), var(--shadow);
}

/* ── Messages area ── */
.messages-container {
    background: var(--chat-bg);
}

.messages-container::-webkit-scrollbar-track { background: var(--chat-bg); }

/* ── Status bar ── */
.status-bar {
    background: linear-gradient(90deg, #060c16 0%, #0c1a2e 50%, #060c16 100%);
    border-bottom: 1px solid var(--border-color);
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 0.04em;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--neon-cyan);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.15);
}

/* ── Message bubbles ── */
.message-content {
    background: var(--assistant-message-bg);
    border: 1px solid #1a2e1a;
    color: var(--assistant-message-text);
    font-family: 'Share Tech Mono', monospace;
}

.user-message .message-content {
    background: var(--user-message-bg);
    border: 1px solid #1a3a5c;
    color: var(--user-message-text);
}

.system-message .message-content {
    background: #0f0f1a;
    color: var(--neon-purple);
    border: 1px dashed #2d1a4e;
}

/* ── Thinking/reasoning blocks ── */
.thinking-indicator .thinking-content {
    background: linear-gradient(135deg, #060c1a 0%, #0a1020 100%);
    border: 1px solid var(--border-color);
    color: var(--neon-cyan);
}

.reasoning-step {
    background: #0a1020;
    color: var(--text-secondary);
    border: 1px solid #1a2a3a;
}

.reasoning-step.active {
    color: var(--neon-cyan);
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
    border-color: var(--primary-color);
}

/* ── Input area ── */
.input-container {
    background: #060c16;
    border-top: 1px solid var(--border-color);
}

#message-input {
    background: #0c1a2e;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'Share Tech Mono', monospace;
    caret-color: var(--neon-cyan);
}

#message-input::placeholder { color: var(--text-secondary); }

#message-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12), var(--glow-cyan);
}

/* ── Buttons ── */
.send-button,
.btn-primary {
    background: linear-gradient(135deg, #005f7a 0%, #007a99 100%);
    border: 1px solid var(--primary-color);
    color: var(--neon-cyan);
    font-family: 'Special Elite', monospace;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: var(--glow-cyan);
}

.send-button:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #007a99 0%, #009bbf 100%);
    box-shadow: 0 0 28px rgba(0, 212, 255, 0.7);
    transform: translateY(-1px);
}

.send-button:disabled,
.btn-primary:disabled {
    background: #1a2a3a;
    border-color: #2a3a4a;
    color: #3a5a7a;
    box-shadow: none;
}

.btn-secondary {
    background: #0f1a2e;
    border: 1px solid #2a3a5a;
    color: var(--text-secondary);
    font-family: 'Share Tech Mono', monospace;
}

.btn-secondary:hover:not(:disabled) {
    background: #1a2a3e;
    border-color: var(--primary-color);
    color: var(--neon-cyan);
}

.btn-danger,
.danger-btn {
    background: linear-gradient(135deg, #5a0000, #7a0000);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    font-family: 'Share Tech Mono', monospace;
    box-shadow: var(--glow-red);
}

.btn-danger:hover:not(:disabled),
.danger-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #7a0000, #990000);
    box-shadow: 0 0 28px rgba(255, 68, 68, 0.7);
}

/* ── Nav links ── */
.btn-link {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    transition: all 0.2s;
}

.btn-link:hover {
    background: rgba(0, 212, 255, 0.08);
    border-color: var(--primary-color);
    box-shadow: var(--glow-cyan);
    color: var(--neon-cyan);
}

.btn-link--active {
    background: rgba(0, 212, 255, 0.12);
    border-color: var(--primary-color);
    color: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
}

/* ── Provider panel ── */
.provider-panel {
    background: #0c1a2e;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.06);
}

.provider-group label { color: var(--text-secondary); font-family: 'Share Tech Mono', monospace; }

.provider-select {
    background: #07101f;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'Share Tech Mono', monospace;
}

.provider-select:hover,
.provider-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
    outline: none;
}

.provider-badge {
    background: #07101f;
    border: 1px solid var(--border-color);
    color: var(--neon-cyan);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.78rem;
}

/* ── File upload ── */
.file-upload-area {
    background: #07101f;
    border-color: var(--border-color);
    border-style: dashed;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.04);
    box-shadow: var(--glow-cyan);
}

.upload-prompt { color: var(--text-secondary); }

/* ── Suggestion chips / action buttons ── */
.suggestion-chip,
.action-btn {
    background: #0c1a2e;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.8rem;
}

.suggestion-chip:hover,
.action-btn:hover {
    background: rgba(0, 212, 255, 0.08);
    border-color: var(--primary-color);
    color: var(--neon-cyan);
    box-shadow: var(--glow-cyan);
}

/* ── Paper results ── */
.paper-item {
    background: #0c1a2e;
    border-left: 3px solid var(--primary-color);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.paper-title  { color: var(--neon-cyan); }
.paper-authors { color: var(--text-secondary); }
.paper-abstract { color: var(--text-primary); }
.paper-link { color: var(--neon-green); }

.paper-number {
    background: linear-gradient(135deg, #005f7a, #007a99);
    box-shadow: var(--glow-cyan);
}

/* ── Result items ── */
.result-item {
    background: #0c1a2e;
    border-left: 4px solid var(--primary-color);
}

.result-title { color: var(--neon-cyan); }

.search-results {
    background: #061a0a;
    border: 1px solid #1a3a1a;
}

/* ── Source items ── */
.source-item {
    background: #0c1a2e;
    border: 1px solid var(--border-color);
}

.source-item:hover {
    background: rgba(0, 212, 255, 0.06);
    transform: translateX(5px);
    box-shadow: var(--glow-cyan);
}

.source-number { color: var(--neon-cyan); }
.source-relevance { background: var(--neon-green); color: #000; }

/* ── Stats ── */
.stat-box {
    background: #0c1a2e;
    border: 1px solid var(--border-color);
}

.stat-value { color: var(--neon-cyan); text-shadow: var(--glow-cyan); }

.node-types { background: #07101f; }

.type-badge {
    background: #0c1a2e;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* ── Inline links ── */
.inline-link {
    background: rgba(0, 212, 255, 0.08);
    color: var(--primary-color);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.inline-link:hover {
    background: var(--primary-color);
    color: #000;
}

/* ── Response content ── */
.response-content a { color: var(--neon-cyan); border-bottom-color: var(--neon-cyan); }
.response-content a:hover { color: var(--primary-hover); }
.response-content code { background: #0c1a2e; color: var(--neon-green); }
.response-content pre { background: #07101f; border-color: var(--border-color); }
.response-content blockquote { border-left-color: var(--neon-amber); color: var(--neon-amber); }
.response-content h1 { color: var(--neon-cyan); border-bottom-color: var(--primary-color); }
.response-content h2 { color: var(--neon-cyan); border-bottom-color: var(--border-color); }
.response-content h3 { color: var(--neon-cyan); }
.response-content strong { color: var(--neon-amber); }
.response-content table th { background: #07101f; color: var(--neon-cyan); }
.response-content table td,
.response-content table th { border-color: var(--border-color); }

.formatted-response code { background: #07101f; color: var(--neon-green); }
.formatted-response h1,
.formatted-response h2,
.formatted-response h3 { color: var(--neon-cyan); }
.formatted-response strong { color: var(--neon-amber); }
.formatted-response em { color: var(--text-secondary); }

/* ── Context highlight ── */
.context-highlight {
    background: rgba(0, 212, 255, 0.06);
    border-left-color: var(--primary-color);
}

/* ── Progress bars ── */
.progress-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--neon-green));
}

.request-activity {
    background: linear-gradient(135deg, #07101f, #0c1a2e);
    border: 1px solid var(--border-color);
}

.request-activity-label { color: var(--neon-cyan); }
.request-activity-timer { color: var(--neon-amber); }
.request-activity-stage { color: var(--text-primary); }

.request-activity-progress { background: rgba(0, 212, 255, 0.1); }

.request-activity-progress-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--neon-green), var(--primary-color));
}

/* ── Progress modal ── */
.progress-modal .modal-content {
    background: linear-gradient(135deg, #060c16 0%, #0c1a2e 100%);
    border: 1px solid var(--primary-color);
    box-shadow: var(--glow-cyan), 0 20px 40px rgba(0,0,0,0.8);
    color: var(--text-primary);
}

.progress-modal .modal-header { border-bottom-color: var(--border-color); }
.progress-modal .modal-header h3 { font-family: 'Cinzel', serif; color: var(--neon-cyan); }

/* ── Modals ── */
.modal-content {
    background: #0c1a2e;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.modal-header { background: #07101f; border-bottom: 1px solid var(--border-color); }
.modal-header h3 { color: var(--neon-cyan); font-family: 'Cinzel', serif; }
.modal-footer { background: #07101f; border-top: 1px solid var(--border-color); }
.modal-header .close { color: var(--text-secondary); }
.modal-header .close:hover { background: var(--border-color); color: var(--text-primary); }

/* ── Warnings & alerts ── */
.warning-message {
    background: #1a1200;
    border: 1px solid var(--neon-amber);
    color: var(--neon-amber);
}

.warning-text strong,
.warning-text p { color: var(--neon-amber); }

.reset-success {
    background: #061a0a;
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
}

.success-message strong,
.success-message p { color: var(--neon-green); }

.reset-error {
    background: #1a0606;
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.error-message strong,
.error-message p { color: var(--error-color); }

/* ── Toasts ── */
.toast {
    background: #0c1a2e;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.toast-title { color: var(--text-primary); }
.toast-message { color: var(--text-secondary); }
.toast.info    { border-left-color: var(--neon-cyan); }
.toast.success { border-left-color: var(--neon-green); }
.toast.warning { border-left-color: var(--neon-amber); }
.toast.error   { border-left-color: var(--error-color); }
.toast.progress{ border-left-color: var(--neon-purple); }

/* ── Live updates feed ── */
.live-updates {
    border-color: var(--border-color);
    box-shadow: var(--glow-cyan);
}

#live-updates-body::-webkit-scrollbar-track { background: #060c16; }
#live-updates-body::-webkit-scrollbar-thumb { background: #1a3a5c; }
#live-updates-body::-webkit-scrollbar-thumb:hover { background: var(--primary-color); }

/* ── Confirmation input ── */
.confirmation-input {
    background: #07101f;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'Share Tech Mono', monospace;
}

.confirmation-input:focus { border-color: var(--primary-color); box-shadow: var(--glow-cyan); }

/* ── Reset options ── */
.reset-option {
    background: #07101f;
    border-color: var(--border-color);
}

.reset-option:hover {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.04);
}

.option-details strong { color: var(--text-primary); }
.option-desc { color: var(--text-secondary); }

/* ── Dashboard ── */
.system-info {
    background: #07101f;
    border-color: var(--border-color);
}

.info-row { border-bottom-color: var(--border-color); }
.info-row strong { color: var(--neon-cyan); }
.info-row span   { color: var(--text-secondary); }

/* ── Literature review toggles ── */
.literature-review-options {
    background: #07101f;
    border-color: var(--border-color);
}

/* ── Animated header decoration ── */
.header::before {
    content: "⚗  H₂O · C₆H₁₂O₆ · NaCl · C₁₂H₂₂O₁₁  ⚗";
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: rgba(0, 212, 255, 0.25);
    letter-spacing: 0.15em;
    margin-bottom: 8px;
    animation: formula-scroll 8s ease-in-out infinite alternate;
}

@keyframes formula-scroll {
    from { opacity: 0.2; letter-spacing: 0.12em; }
    to   { opacity: 0.45; letter-spacing: 0.18em; }
}

/* ── Stop button glow ── */
.stop-button {
    background: linear-gradient(135deg, #5a0000, #7a0000);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    box-shadow: var(--glow-red);
}

.stop-button:hover { background: linear-gradient(135deg, #7a0000, #990000); }

@keyframes pulseRed {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7); }
    50%       { box-shadow: 0 0 0 12px rgba(255, 68, 68, 0); }
}

/* ── Streaming badge ── */
.streaming-badge {
    background: var(--error-color);
    box-shadow: var(--glow-red);
    font-family: 'Share Tech Mono', monospace;
}

/* ── Embedded action buttons ── */
.embedded-action-btn {
    background: #07101f;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    font-family: 'Share Tech Mono', monospace;
}

.embedded-action-btn:hover {
    background: var(--primary-color);
    color: #000;
    box-shadow: var(--glow-cyan);
}

/* ── Literature review / textarea / selects inside panels ── */
textarea, select, input[type="text"], input[type="search"] {
    background: #07101f;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: 'Share Tech Mono', monospace;
}

textarea:focus, select:focus, input[type="text"]:focus, input[type="search"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.15);
}

textarea::placeholder,
input::placeholder { color: var(--text-secondary); }

option { background: #0c1a2e; color: var(--text-primary); }

