/* ChatGPT-Style Interface for Shift07 */

:root {
    /* Light Mode Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7F7F8;
    --bg-chat: #FFFFFF;
    --bg-user-message: transparent;
    --bg-assistant-message: #F7F7F8;
    --bg-input: #FFFFFF;
    --bg-input-border: #D1D5DB;
    --text-primary: #374151;
    --text-secondary: #6B7280;
    --text-user: #374151;
    --text-assistant: #374151;
    --accent-color: #10A37F;
    --border-color: #E5E7EB;
    --code-bg: #F3F4F6;
    --code-text: #1F2937;
}

[data-theme="dark"] {
    /* Dark Mode Colors */
    --bg-primary: #1E1E20;
    --bg-secondary: #2A2B2E;
    --bg-chat: #1E1E20;
    --bg-user-message: transparent;
    --bg-assistant-message: #2A2B2E;
    --bg-input: #40414F;
    --bg-input-border: #565869;
    --text-primary: #ECECF1;
    --text-secondary: #D9D9E3;
    --text-user: #ECECF1;
    --text-assistant: #ECECF1;
    --accent-color: #10A37F;
    --border-color: #565869;
    --code-bg: #282C34;
    --code-text: #ABB2BF;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Math Equation Styling */
.math-display {
    margin: 1em 0;
    text-align: center;
    overflow-x: auto;
}

.math-inline {
    display: inline;
}

/* Ensure MathJax equations are properly styled */
.MathJax {
    color: var(--text-primary) !important;
}

.MathJax_Display {
    margin: 1em 0 !important;
}

/* Code and Pre styling */
code {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.875em;
}

pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1em 0;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.875em;
    line-height: 1.4;
}

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

/* Agent Sidebar */
.agent-sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 100;
}

.agent-sidebar.hidden {
    transform: translateX(-100%);
}

.sidebar-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.sidebar-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.8;
}

.agent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.agent-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
    animation: slideInLeft 0.5s ease forwards;
}

.agent-item:hover {
    border-color: var(--accent-color);
    box-shadow: 0 2px 8px rgba(16, 163, 127, 0.1);
}

.agent-item.active {
    border-color: var(--accent-color);
    background: rgba(16, 163, 127, 0.05);
}

.agent-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.agent-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.agent-item-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: white;
}

.agent-item-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.agent-item-status.idle {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.agent-item-status.thinking {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.agent-item-status.processing {
    background: rgba(16, 163, 127, 0.2);
    color: var(--accent-color);
}

.agent-item-status.complete {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.agent-item-task {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 8px;
}

.agent-item-progress {
    display: flex;
    gap: 2px;
    height: 4px;
}

.agent-progress-dot {
    flex: 1;
    background: var(--border-color);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.agent-progress-dot.completed {
    background: var(--accent-color);
}

.agent-progress-dot.active {
    background: #f59e0b;
    animation: progressPulse 1.5s infinite;
}

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

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

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

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    min-height: 0; /* Allow flex shrinking */
}

/* Main Layout */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    overflow: hidden;
}

/* Top App Bar */
.top-app-bar {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 100;
}

.app-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

.app-icon {
    font-size: 20px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.app-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--accent-color) 0%, #06d6a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.api-badge {
    background: linear-gradient(135deg, #10A37F, #0EA5E9);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.app-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 4px;
    padding: 2px 6px;
    background: rgba(16, 163, 127, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(16, 163, 127, 0.2);
    transition: all 0.3s ease;
}

.app-title:hover .app-subtitle {
    opacity: 1;
    background: rgba(16, 163, 127, 0.15);
    border-color: rgba(16, 163, 127, 0.3);
}

.app-title:hover .app-icon {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    transition: background-color 0.3s;
}

.status-dot.connected {
    background: #10b981;
}

.status-dot.connecting {
    background: #f59e0b;
    animation: pulse 1.5s infinite;
}

.status-text {
    font-weight: 400;
}

.app-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-chat-button {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(16, 163, 127, 0.2);
}

.new-chat-button:hover {
    background: #0d8f6f;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 163, 127, 0.3);
}

.new-chat-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(16, 163, 127, 0.2);
}

.new-chat-text {
    font-family: inherit;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
}

/* Chat Window */
.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: var(--bg-chat);
    scroll-behavior: smooth;
    /* Hardware acceleration for better performance */
    transform: translateZ(0);
    -webkit-overflow-scrolling: touch;
}

.chat-messages {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 24px 32px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 48px 24px;
}

.welcome-title {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    max-width: 600px;
    line-height: 1.5;
}

.example-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    max-width: 600px;
    width: 100%;
}

.example-prompt {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.example-prompt:hover {
    background: var(--bg-assistant-message);
    border-color: var(--accent-color);
}

.example-prompt-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Message Bubbles */
.message {
    margin-bottom: 24px;
    animation: messageSlideIn 0.3s ease-out;
    will-change: transform, opacity;
    /* Optimize for frequent repaints */
    contain: layout style paint;
}

.message-user {
    display: flex;
    justify-content: flex-start;
}

.message-assistant {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 95%;
    width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.user-bubble {
    background: var(--bg-user-message);
    color: var(--text-user);
    padding: 12px 0;
    font-size: 16px;
    line-height: 1.5;
}

.assistant-bubble {
    background: var(--bg-assistant-message);
    color: var(--text-assistant);
    padding: 24px;
    border-radius: 12px;
    font-size: 16px;
    line-height: 1.7;
    border: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

/* Thinking Indicator */
.thinking-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    margin: 12px 0;
}

.thinking-dots {
    display: flex;
    gap: 4px;
    margin-right: 8px;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: thinkingPulse 1.4s ease-in-out infinite;
    will-change: transform, opacity;
}

.thinking-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.thinking-text {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Premium Grok-Style Agent Progress Layout */
.agent-progress-container {
    margin: 24px 0;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', 'Menlo', 'Consolas', monospace;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    border: 1px solid #333;
    border-radius: 12px;
    padding: 24px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    opacity: 0;
    transform: translateY(15px);
    animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    overflow: hidden;
}

.agent-progress-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #ffcc33, transparent);
    opacity: 0.6;
}

.agent-section {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    transition: all 0.3s ease;
}

.agent-section:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.agent-section:hover {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    margin: -4px;
    padding: 24px 4px 24px 4px;
}

.agent-title {
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-shadow: 0 0 10px rgba(255, 204, 51, 0.3);
}

.agent-title::before {
    content: '▶';
    margin-right: 8px;
    color: #ffcc33;
    font-size: 12px;
    transition: all 0.3s ease;
}

.agent-section.running .agent-title::before {
    animation: pulse 1.5s infinite;
}

.agent-section.done .agent-title::before {
    content: '✓';
    color: #00ff88;
}

.agent-status-badge {
    font-size: 9px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.agent-status-badge.running {
    background: linear-gradient(135deg, #ffcc33, #ff9500);
    color: #000;
    border-color: #ffcc33;
    box-shadow: 0 0 15px rgba(255, 204, 51, 0.4);
    animation: glow 2s infinite alternate;
}

.agent-status-badge.done {
    background: linear-gradient(135deg, #00ff88, #00cc6a);
    color: #000;
    border-color: #00ff88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

.agent-status-badge.waiting {
    background: rgba(108, 114, 128, 0.3);
    color: #9ca3af;
    border-color: #4b5563;
}

.agent-progress-bar {
    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;
    margin-bottom: 16px;
    letter-spacing: 0.2px;
    font-weight: 600;
    text-shadow: 0 0 8px currentColor;
    transition: all 0.3s ease;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.agent-progress-bar.running {
    color: #ffcc33;
    animation: progressShimmer 2s infinite;
}

.agent-progress-bar.done {
    color: #00ff88;
}

.agent-progress-bar.waiting {
    color: #4b5563;
}

.agent-response {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.7;
    color: #e5e7eb;
    margin-left: 0;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid;
    transition: all 0.3s ease;
}

.agent-response.running {
    border-left-color: #ffcc33;
    background: rgba(255, 204, 51, 0.05);
    animation: typewriter 1.5s infinite;
}

.agent-response.done {
    border-left-color: #00ff88;
    background: rgba(0, 255, 136, 0.05);
    color: #f0f9ff;
}

.agent-response.waiting {
    border-left-color: #4b5563;
    color: #9ca3af;
}

.agent-response::before {
    content: "▸ ";
    font-weight: 700;
    margin-right: 6px;
    opacity: 0.8;
}

/* Enhanced Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

@keyframes glow {
    0% {
        box-shadow: 0 0 15px rgba(255, 204, 51, 0.4);
    }
    100% {
        box-shadow: 0 0 25px rgba(255, 204, 51, 0.6);
    }
}

@keyframes progressShimmer {
    0%, 100% {
        text-shadow: 0 0 8px #ffcc33;
    }
    50% {
        text-shadow: 0 0 20px #ffcc33, 0 0 30px #ff9500;
    }
}

@keyframes typewriter {
    0%, 50% {
        opacity: 1;
        transform: translateX(0);
    }
    51%, 100% {
        opacity: 0.7;
        transform: translateX(1px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .agent-progress-container {
        margin: 16px 0;
        padding: 16px;
        border-radius: 8px;
    }

    .agent-title {
        font-size: 12px;
        letter-spacing: 1px;
    }

    .agent-progress-bar {
        font-size: 14px;
    }

    .agent-response {
        font-size: 13px;
        padding: 10px 12px;
    }
}

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

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

@keyframes dotPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* Message Composer */
.message-composer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 16px 32px;
    position: sticky;
    bottom: 0;
    z-index: 100;
    width: 100%;
    box-sizing: border-box;
}

.composer-container {
    max-width: none;
    width: 100%;
    margin: 0;
    position: relative;
}

.composer-input {
    width: 100%;
    min-height: 52px;
    max-height: 200px;
    background: var(--bg-input);
    border: 1px solid var(--bg-input-border);
    border-radius: 12px;
    padding: 14px 52px 14px 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-primary);
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}

.composer-input:focus {
    border-color: var(--accent-color);
}

.composer-input::placeholder {
    color: var(--text-secondary);
}

.send-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
}

.send-button:hover:not(:disabled) {
    background: #0d8f6f;
}

.send-button:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.character-counter {
    position: absolute;
    bottom: -20px;
    right: 0;
    font-size: 11px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.character-counter.warning {
    color: #f59e0b;
}

.character-counter.danger {
    color: #ef4444;
}

/* Optimized Animations with Hardware Acceleration */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes thinkingPulse {
    0%, 80%, 100% {
        transform: scale3d(0.8, 0.8, 1);
        opacity: 0.5;
    }
    40% {
        transform: scale3d(1.2, 1.2, 1);
        opacity: 1;
    }
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .chat-messages {
        padding: 16px 16px;
    }

    .message-composer {
        padding: 16px 16px;
    }

    .message-content {
        max-width: 98%;
    }

    .assistant-bubble {
        padding: 20px;
        font-size: 15px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .example-prompts {
        grid-template-columns: 1fr;
    }

    .top-app-bar {
        padding: 8px 12px;
        flex-direction: column;
        gap: 8px;
    }

    .app-title {
        gap: 6px;
    }

    .app-name {
        font-size: 16px;
    }

    .app-subtitle {
        display: none; /* Hide subtitle on mobile to save space */
    }

    .connection-status {
        font-size: 10px;
    }

    .new-chat-button {
        padding: 6px 8px;
        font-size: 12px;
    }

    .new-chat-text {
        display: none;
    }

    .app-controls {
        gap: 4px;
    }

    .character-counter {
        bottom: -16px;
        font-size: 10px;
    }
}

/* Scrollbar Styling */
.chat-window::-webkit-scrollbar {
    width: 6px;
}

.chat-window::-webkit-scrollbar-track {
    background: transparent;
}

.chat-window::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-window::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Markdown Styles */
.assistant-bubble h1 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 16px 0;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.assistant-bubble h2 {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin: 24px 0 12px 0;
}

.assistant-bubble h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 20px 0 12px 0;
}

.assistant-bubble h4 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 18px 0 10px 0;
}

.assistant-bubble h5 {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    margin: 16px 0 8px 0;
}

.assistant-bubble p {
    margin: 0 0 18px 0;
    line-height: 1.7;
    text-align: justify;
}

.assistant-bubble strong {
    font-weight: 600;
}

.assistant-bubble em {
    font-style: italic;
    color: var(--accent-color);
}

.assistant-bubble code {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
}

.assistant-bubble pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--border-color);
}

.assistant-bubble pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: 14px;
}

.assistant-bubble ul {
    margin: 18px 0;
    padding-left: 0;
}

.assistant-bubble ol {
    margin: 18px 0;
    padding-left: 20px;
}

.assistant-bubble li {
    margin: 10px 0;
    padding-left: 24px;
    position: relative;
    line-height: 1.7;
}

.assistant-bubble ul li::before {
    content: "•";
    color: var(--accent-color);
    font-weight: bold;
    position: absolute;
    left: 8px;
}

.assistant-bubble ol li {
    padding-left: 0;
}

.assistant-bubble ol li::before {
    display: none;
}

/* System Messages */
.system-message {
    margin: 8px 0;
    text-align: center;
}

.system-bubble {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    color: #1565c0;
    border: 1px solid #bbdefb;
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    display: inline-block;
    max-width: 80%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #bbdefb;
    border-radius: 50%;
    border-top-color: #1565c0;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.loading-spinner.small {
    width: 12px;
    height: 12px;
    border-width: 1.5px;
    margin-right: 6px;
}

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

.system-message-with-spinner {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-status-with-spinner {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Agent Processing Container */
.agent-container {
    margin: 12px 0;
}

.agent-processing-bubble {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 16px;
    border-radius: 12px;
    max-width: 90%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.agent-processing-header {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 12px;
    color: #343a40;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 8px;
}

.agent-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 8px;
}

.agent-item {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    transition: all 0.3s ease;
}

.agent-item:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.agent-status {
    display: flex;
    align-items: center;
    font-weight: 500;
}

/* Message Actions */
.message-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.copy-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.copy-button:hover {
    background: var(--bg-secondary);
    color: var(--accent-color);
}

.message-timestamp {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.8;
    margin-bottom: 8px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-timestamp.processing {
    color: var(--accent-color);
    opacity: 1;
}

.message-timestamp .status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-color);
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent-color);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Performance Stats */
.message-stats {
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

.stats-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Math Equation Styles */
.math-display {
    margin: 20px 0;
    text-align: center;
    overflow-x: auto;
    padding: 16px;
    background: var(--code-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.math-inline {
    display: inline;
    margin: 0 3px;
    padding: 2px 4px;
    background: rgba(var(--accent-color-rgb, 16, 163, 127), 0.1);
    border-radius: 3px;
}

/* MathJax specific styling */
.MathJax {
    color: var(--text-primary) !important;
}

.MathJax_Display {
    margin: 0.8em 0 !important;
}

/* Ensure math equations are readable in both themes */
[data-theme="dark"] .MathJax {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .math-display {
    background: var(--code-bg);
    border-color: var(--border-color);
}

/* App Footer */
.app-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 12px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: auto;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

.footer-link:hover {
    color: var(--accent-color);
}

.footer-separator {
    color: var(--border-color);
    font-weight: 300;
}

.footer-copyright {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.8;
}

@media (max-width: 768px) {
    .app-footer {
        padding: 8px 16px;
        font-size: 11px;
    }

    .footer-links {
        gap: 8px;
    }

    .footer-copyright {
        font-size: 10px;
    }
}
