.chat-area {
    width: 100%;
    max-width: 800px;
    /* Limit width for readability */
    margin: 0 auto;
    gap: var(--space-lg);
    display: flex;
    flex-direction: column;
}

/* Scroll to bottom button - floating above input container */
.scroll-to-bottom-btn {
    position: fixed;
    bottom: 180px;
    /* Center in main content area (accounting for sidebar ~280px) */
    left: calc(50% + 140px);
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px var(--glass-shadow, rgba(0, 0, 0, 0.2));
    transition: all 0.3s ease;
    z-index: 100;
    opacity: 1;
}

.scroll-to-bottom-btn svg {
    width: 18px;
    height: 18px;
}

.scroll-to-bottom-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateX(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(243, 123, 32, 0.3);
}

.scroll-to-bottom-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

.chat-messages-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

/* Gemini-style Message Layout */
.message-row {
    display: flex;
    gap: var(--space-md);
    width: 100%;
    animation: fadeIn 0.3s ease-out;
    position: relative;
    margin-bottom: 1.5rem;
}

/* User message - right aligned with bubble */
.user-message {
    justify-content: flex-end !important;
    flex-direction: row;
}

.user-message .message-content {
    background: #374151 !important;
    border-radius: 20px 20px 4px 20px !important;
    padding: 12px 18px !important;
    max-width: 70%;
    flex: none;
}

/* Light theme user bubble - using CSS variables for consistency */
.light-theme .user-message .message-content {
    background: var(--user-bubble-bg, #e5e7eb) !important;
}

.light-theme .user-message .message-text {
    color: var(--user-bubble-text, #1f2937) !important;
}

.user-message .message-avatar {
    display: none !important; /* Hide user avatar in Gemini style */
}

/* Model message - left aligned with icon */
.model-message {
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
}

.model-message .message-content {
    background: transparent;
    padding: 0;
    flex: 1;
}

.model-message> :not(.message-avatar) {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-surface-hover);
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.model-message .message-avatar {
    background: var(--avatar-bg-gradient, #F37B20);
    color: white;
}

/* LLM Avatar Animation During Typing */
.typing-indicator-row .message-avatar {
    animation: avatar-pulse 2s ease-in-out infinite;
}

@keyframes avatar-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--accent-glow);
    }

    50% {
        transform: scale(1.08);
        box-shadow: 0 0 0 8px transparent;
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--accent-glow);
    }
}

/* Container for both content and actions */
.message-body-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 0;
    width: 100%;
    /* Ensure full width */
}

.message-content {
    flex: 1;
    min-width: 0;
}

/* User message content is already styled above */

.message-sender {
    font-weight: 600;
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.message-text {
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    background-color: transparent;
}

/* User message text */
.user-message .message-text {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Other User Messages (Shared Conversations) */
.other-user-message {
    flex-direction: row !important;
}

.other-user-message .message-content {
    background: linear-gradient(135deg, rgba(100, 116, 139, 0.15) 0%, rgba(148, 163, 184, 0.1) 100%);
    border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
}

.other-user-avatar {
    background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%) !important;
}

.message-author {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-author::before {
    content: '👤';
    font-size: 0.7rem;
}

/* New Message Notification Banner */
.new-message-banner {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, var(--accent-color) 0%, #ff9e5e 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin: 8px 16px;
    box-shadow: 0 4px 12px var(--accent-glow);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.banner-icon {
    font-size: 1.2rem;
}

.banner-text {
    flex: 1;
    font-size: 0.9rem;
}

.banner-text strong {
    font-weight: 600;
}

.banner-refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.banner-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.banner-close-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.2s;
}

.banner-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Other User Typing Indicator */
.other-user-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 8px 16px;
    background: var(--bg-surface);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease-out;
}

.typing-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
    border-radius: 50%;
    font-size: 0.9rem;
}

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

.typing-dots {
    display: flex;
    gap: 2px;
}

.typing-dots span {
    animation: typingBounce 1.4s infinite ease-in-out;
    font-weight: bold;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Other User Processing Indicator (AI responding) */
.other-user-processing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 8px 16px;
    background: linear-gradient(135deg, rgba(243, 123, 32, 0.15) 0%, rgba(255, 158, 94, 0.1) 100%);
    border: 1px solid rgba(243, 123, 32, 0.3);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease-out;
}

.processing-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f37b20 0%, #ff9e5e 100%);
    border-radius: 50%;
    font-size: 0.9rem;
    animation: pulse 1.5s infinite;
}

.processing-text {
    color: var(--text-primary);
    font-weight: 500;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

/* Markdown Styles */
.message-text p {
    margin: 0.5em 0;
    background-color: transparent;
}

.message-text p:first-child {
    margin-top: 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text strong {
    font-weight: 600;
    color: var(--text-primary);
    background-color: transparent;
}

.message-text code {
    font-family: 'Roboto Mono', monospace;
    background-color: var(--bg-code-block);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.9em;
}

.message-text pre {
    background-color: var(--bg-surface);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.message-text pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.9em;
    color: var(--text-primary);
    white-space: pre;
    /* Keep pre for code blocks */
}

.message-text ul,
.message-text ol {
    margin-left: 1.2em;
    margin-bottom: 0.3em;
    /* Reduced from 0.5em */
    margin-top: 0;
    padding-left: 0;
    background-color: transparent;
}

.message-text li {
    margin-bottom: 0.1em;
    /* Reduced from 0.2em */
    background-color: transparent;
}

.message-text a {
    color: var(--accent-color);
    text-decoration: underline;
    background-color: transparent;
}

.message-text h1,
.message-text h2,
.message-text h3 {
    margin-top: 0.8em;
    /* Reduced from 1em */
    margin-bottom: 0.2em;
    /* Reduced from 0.3em */
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    background-color: transparent;
}

.message-text h1:first-child,
.message-text h2:first-child,
.message-text h3:first-child {
    margin-top: 0;
}

/* Debug: Chips Unhidden */
/* .hero-chips { display: none !important; } */

.hero-chips {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 800px;
    /* Match Media Creator */
}

.hero-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.hero-chip:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--text-secondary);
}

.chip-icon {
    font-size: 1.1rem;
}

/* Welcome State */
/* Welcome State */
#chat-area .welcome-message,
.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: auto;
    text-align: center;
    color: var(--text-secondary);
    animation: fadeIn 0.5s ease-out;
    margin-bottom: 24px;
    width: 100%;
    /* Ensure no frame/card style - High Specificity */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    background: var(--gradient-welcome);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-message h1 {
    font-size: 4rem;
    /* Match Media Creator */
    font-weight: 600;
    /* Match Media Creator */
    margin-bottom: 32px;
    /* Match Media Creator */
    color: var(--text-primary) !important;
    /* Force White text */
    line-height: 1.1;
    /* Match Media Creator */
}

.gradient-text {
    background: var(--gradient-text);
    /* Match Media Creator Reddish Gradient */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    /* Ensure gradient works on span */
}

/* Datastore Welcome State */
.datastore-welcome {
    padding: 40px 20px;
}

.datastore-welcome-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.datastore-welcome h1 {
    font-size: 2rem !important;
    margin-bottom: 12px !important;
}

.datastore-welcome-desc {
    font-size: 15px;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto 32px;
    line-height: 1.5;
}

/* Error Message */
.error-message {
    color: var(--color-error);
    background-color: var(--bg-error-transparent);
    padding: 12px 16px;
    border-radius: 8px;
    margin: var(--space-md) 0;
    width: 100%;
    text-align: center;
    border: 1px solid var(--border-error-transparent);
}

/* Typing Indicator */
.typing-indicator-row .message-content {
    display: flex;
    align-items: center;
}

.typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 20px;
    background-color: transparent !important;
    border-radius: 16px;
    width: fit-content;
    min-height: 32px;
    margin-top: 4px;
    position: relative;
    z-index: 10;
    border: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #F37B20 !important;
    /* Kinguin Orange - Forced */
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out both;
    box-shadow: none !important;
    opacity: 1;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.8) translateY(0);
        opacity: 0.5;
    }

    40% {
        transform: scale(1.2) translateY(-4px);
        opacity: 1;
    }
}

/* Copy Button */
.message-actions {
    display: flex;
    justify-content: flex-start;
    /* Left align */
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--bg-surface-transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

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

.action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    transition: all 0.2s;
    font-size: 0.8rem;
    width: auto;
    /* Auto width, not full width */
    max-width: fit-content;
}

.action-btn:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.action-btn svg {
    width: 14px;
    height: 14px;
}

/* Compact File Attachment Display */
.message-attachments {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.attachment-item {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-surface);
    transition: all 0.2s;
}

.attachment-item:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--text-secondary);
}

.attachment-item svg {
    display: block;
}

/* Force transparent backgrounds for copy-paste (except user message bubble and typing indicator) */
.model-message .message-text,
.model-message .message-text *:not(.typing-indicator span),
.model-message .message-content {
    background-color: transparent !important;
}

/* User message bubble should keep its background */
.user-message .message-content {
    background-color: var(--user-bubble-bg, #374151) !important;
}

.user-message .message-text {
    background-color: transparent !important;
    color: var(--user-bubble-text, var(--text-primary)) !important;
}

/* Typing indicator dots must have their color */
.typing-indicator span {
    background-color: #F37B20 !important;
}

/* Streaming message animation */
.streaming-message .streaming-text::after {
    content: '|';
    animation: cursor-blink 0.8s infinite;
    color: var(--accent-color);
    font-weight: 400;
    margin-left: 1px;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Animated text placeholder prior to payload */
.animated-dots::after {
    content: "";
    animation: blink-dots-content 1.5s steps(4, end) infinite;
}
@keyframes blink-dots-content {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75% { content: "..."; }
    100% { content: ""; }
}
.generating-text {
    color: var(--text-secondary);
    opacity: 0.7;
    font-size: 0.9em;
}

/* Ensure list styling is visible */
.message-text ul {
    list-style-type: disc;
    margin-left: 1.5em;
    padding-left: 0;
}

.message-text li {
    margin-bottom: 0.2em;
}

/* Markdown Table Styling */
.message-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

.message-text table th,
.message-text table td {
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    text-align: left;
    background-color: transparent;
}

.message-text table th {
    background-color: var(--bg-surface-transparent);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.message-text table tr:nth-child(even) {
    background-color: var(--bg-surface-transparent-hover);
}

.message-text table tr:hover {
    background-color: var(--bg-surface-transparent-hover);
}

/* Code Block Styling */
.message-text pre {
    background-color: var(--bg-surface-hover);
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    margin: 1em 0;
}

.message-text code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.message-text pre code {
    background-color: transparent;
    padding: 0;
}

.message-text :not(pre)>code {
    background-color: var(--bg-code-block);
    padding: 2px 6px;
    border-radius: 3px;
}

/* ===== DEEP RESEARCH STYLES ===== */
.deep-research-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin: 16px 0;
    animation: fadeIn 0.3s ease-out;
}

.research-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

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

.research-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.research-status {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 4px 12px;
    background: var(--bg-surface-transparent);
    border-radius: 20px;
}

.research-status.complete {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.research-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Progress Steps */
.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.research-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-surface-transparent);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.research-step.active {
    background: rgba(243, 123, 32, 0.15);
    color: var(--accent-color);
}

.research-step.active .step-icon {
    animation: pulse 1s infinite;
}

.research-step.done {
    color: #22c55e;
}

.research-step.done .step-icon {
    color: #22c55e;
}

.step-icon {
    font-size: 0.8rem;
    width: 16px;
    text-align: center;
}

.step-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Research Content */
.research-content {
    margin-top: 16px;
}

.research-answer {
    padding: 12px 16px;
    background: var(--bg-surface-transparent);
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 3px solid var(--accent-color);
}

.research-answer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Final Report */
.research-report {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.research-report h4 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Markdown in report */
.report-content {
    line-height: 1.7;
    color: var(--text-primary);
}

.report-content h2 {
    font-size: 1.3rem;
    margin: 20px 0 12px 0;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.report-content h3 {
    font-size: 1.1rem;
    margin: 16px 0 10px 0;
    color: var(--text-primary);
}

.report-content h4 {
    font-size: 1rem;
    margin: 14px 0 8px 0;
    color: var(--text-secondary);
}

.report-content p {
    margin: 12px 0;
}

.report-content ul, .report-content ol {
    margin: 12px 0;
    padding-left: 24px;
}

.report-content li {
    margin: 6px 0;
}

.report-content code {
    background: var(--bg-surface-transparent);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
}

.report-content pre {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}

.report-content pre code {
    background: none;
    padding: 0;
}

.report-content blockquote {
    border-left: 3px solid var(--accent-color);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.report-content a {
    color: var(--accent-color);
    text-decoration: none;
}

.report-content a:hover {
    text-decoration: underline;
}

.report-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.report-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Partial/streaming content */
.research-partial {
    padding: 16px;
    background: var(--bg-surface-transparent);
    border-radius: 12px;
    margin-top: 12px;
    border-left: 3px solid var(--accent-color);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% { border-left-color: var(--accent-color); }
    50% { border-left-color: rgba(243, 123, 32, 0.3); }
}

.partial-content {
    line-height: 1.6;
    color: var(--text-secondary);
}

.answer-text {
    line-height: 1.6;
}

.report-content {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.report-content p {
    margin-bottom: 12px;
}

.report-content strong {
    color: var(--accent-color);
}

/* Sources */
.research-sources {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.research-sources h5 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.research-sources ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.research-sources li {
    font-size: 0.85rem;
}

.research-sources a {
    color: var(--accent-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.research-sources a:hover {
    text-decoration: underline;
}

.research-sources a::before {
    content: '🔗';
    font-size: 0.8rem;
}

/* Error State */
.research-error {
    padding: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 0.9rem;
}

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

/* ===== MESSAGE SOURCES (Grounding) ===== */
.message-sources {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.sources-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sources-title::before {
    content: '🌐';
    font-size: 0.9rem;
}

.sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--bg-surface-transparent);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--accent-color);
    text-decoration: none;
    transition: all 0.2s ease;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-link:hover {
    background: var(--bg-surface-hover);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.source-link::before {
    content: '🔗';
    font-size: 0.75rem;
}

/* Copy button animation */
.copy-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
}

.copy-btn .copy-icon,
.copy-btn .copy-text {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.copy-btn .copy-icon {
    opacity: 1;
    transform: scale(1);
}

.copy-btn .copy-text {
    position: absolute;
    opacity: 0;
    transform: scale(0.8);
    font-size: 0.75rem;
    color: #4caf50;
    font-weight: 500;
    white-space: nowrap;
}

.copy-btn.copied {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.copy-btn.copied .copy-icon {
    opacity: 0;
    transform: scale(0.8);
}

.copy-btn.copied .copy-text {
    opacity: 1;
    transform: scale(1);
}

/* ===== CHAIN OF THOUGHT (CoT) ===== */
.thought-process {
    margin: 16px 0;
    border-radius: 12px;
    background: var(--bg-surface-transparent);
    border: 1px solid var(--border-color);
    overflow: hidden;
    font-size: 0.95em;
    animation: fadeIn 0.3s ease-out;
}

.thought-process summary {
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    user-select: none;
    transition: background 0.2s, color 0.2s;
}

.thought-process summary:hover {
    background: var(--bg-surface-transparent-hover);
    color: var(--text-primary);
}

.thought-process[open] summary {
    border-bottom: 1px solid var(--border-color);
}

.thought-content {
    padding: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    background: rgba(0, 0, 0, 0.1);
    white-space: pre-wrap;
}

body.light-theme .thought-content {
    background: rgba(255, 255, 255, 0.4);
}