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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #1a1a1a;
    height: 100vh;
    overflow: hidden;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 0;
    flex-shrink: 0;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-secondary {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.model-selector select {
    background: #ffffff;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.main {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

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

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    scroll-behavior: smooth;
}

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

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

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

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

.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.welcome-logo {
    height: 5rem;
    width: auto;
    object-fit: contain;
    margin-bottom: 1rem;
}

.welcome-message h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #212529;
}

.welcome-message p {
    font-size: 1.125rem;
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.capabilities {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.capability {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    color: #495057;
    font-size: 0.875rem;
}

.capability-icon {
    font-size: 1.25rem;
}

.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.3s ease-out;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.user-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.assistant-avatar {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

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

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.message-role {
    font-weight: 600;
    font-size: 0.875rem;
}

.user-role {
    color: #667eea;
}

.assistant-role {
    color: #6c757d;
}

.message-time {
    font-size: 0.75rem;
    color: #adb5bd;
}

.message-text {
    line-height: 1.6;
    color: #212529;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-text h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #212529;
    margin: 1.5rem 0 1rem 0;
    line-height: 1.2;
}

.message-text h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
    margin: 1.25rem 0 0.75rem 0;
    line-height: 1.3;
}

.message-text h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin: 1rem 0 0.5rem 0;
    line-height: 1.4;
}

.message-text p {
    margin: 0.75rem 0;
    line-height: 1.6;
}

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

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

.message-text strong {
    font-weight: 600;
    color: #212529;
}

.message-text em {
    font-style: italic;
    color: #495057;
}

.message-text ul,
.message-text ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.message-text li {
    margin: 0.5rem 0;
    line-height: 1.5;
}

.message-text ul li {
    list-style-type: disc;
}

.message-text ol li {
    list-style-type: decimal;
}

.message-text ul ul li {
    list-style-type: circle;
}

.message-text ol ol li {
    list-style-type: lower-alpha;
}

.message-text blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
}

.message-text a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s;
}

.message-text a:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

.message-text pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
}

.message-text code {
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    color: #e83e8c;
}

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

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6c757d;
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

.typing-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #a0a0a0;
    animation: typingDot 1.4s infinite;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

.input-container {
    padding: 2rem;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.input-wrapper {
    position: relative;
    display: flex;
    gap: 0.75rem;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 1rem;
    padding: 1rem;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: #667eea;
}

#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #212529;
    font-size: 1rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 200px;
    min-height: 24px;
}

#message-input::placeholder {
    color: #adb5bd;
}

.send-button {
    background: #667eea;
    border: none;
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-button:hover {
    background: #5a6fd8;
    transform: scale(1.05);
}

.send-button:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    transform: none;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0 0.5rem;
}

.char-count {
    font-size: 0.75rem;
    color: #adb5bd;
}

.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.tool-usage {
    background: #e2e3ff;
    border: 1px solid #c5c6f7;
    color: #4c4dff;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-icon {
    font-size: 1rem;
}

.citation-ref {
    background: #e2e3ff;
    color: #4c4dff;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0 0.125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.citation-ref:hover {
    background: #d1d3ff;
    transform: translateY(-1px);
}

.references-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
}

.references-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

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

.citation-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    transition: all 0.2s, background-color 2s ease;
}

.citation-item:hover {
    border-color: #adb5bd;
    background: #f8f9fa;
}

.citation-number {
    background: #e2e3ff;
    color: #4c4dff;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.citation-content {
    color: #495057;
    line-height: 1.4;
    word-break: break-word;
}

.citation-content a {
    color: #4c4dff;
    text-decoration: none;
    transition: color 0.2s;
}

.citation-content a:hover {
    color: #667eea;
    text-decoration: underline;
}

.progress-container {
    margin: 1rem 0;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.progress-container.researching {
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    animation: researchPulse 2s ease-in-out infinite;
}

@keyframes researchPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
        border-color: #667eea;
    }
    50% {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.6);
        border-color: #8888ff;
    }
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #e9ecef;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.progress-container.researching .progress-header {
    background: linear-gradient(90deg, #e9ecef, #d1ecf1, #e9ecef);
    background-size: 200% 100%;
    animation: progressHeaderShimmer 3s ease-in-out infinite;
}

@keyframes progressHeaderShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.progress-header:hover {
    background: #dee2e6;
}

.progress-title {
    font-weight: 600;
    color: #212529;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.progress-container.researching .progress-title {
    color: #4c4dff;
}

.progress-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-count {
    background: #667eea;
    color: #ffffff;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 1.5rem;
    text-align: center;
}

.progress-toggle {
    color: #6c757d;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.progress-container.collapsed .progress-toggle {
    transform: rotate(180deg);
}

.progress-list {
    max-height: 300px;
    overflow-y: auto;
    background: #ffffff;
    transition: max-height 0.3s ease;
}

.progress-container.collapsed .progress-list {
    max-height: 0;
    overflow: hidden;
}

.progress-item {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s;
}

.progress-item:last-child {
    border-bottom: none;
}

.progress-item.in_progress {
    background: #fff3cd;
}

.progress-item.completed {
    background: #d4edda;
}

.progress-item.error {
    background: #f8d7da;
}

.progress-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.progress-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.progress-message {
    color: #495057;
    flex: 1;
    min-width: 0;
}

.progress-url {
    color: #4c4dff;
    font-size: 0.75rem;
    font-family: monospace;
    background: #e9ecef;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-time {
    color: #adb5bd;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.progress-list::-webkit-scrollbar {
    width: 4px;
}

.progress-list::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.progress-list::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 2px;
}

.progress-list::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

.research-plan-message {
    background: #f8f9ff;
    border: 2px solid #e3e6ff;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.research-plan-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.research-plan-message .message-role {
    color: #667eea;
    font-weight: 600;
}

.research-plan-header {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    border-radius: 6px;
    padding: 0.5rem;
    margin: -0.5rem;
}

.research-plan-header:hover {
    background: rgba(102, 126, 234, 0.05);
}

.research-plan-toggle {
    color: #667eea;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.research-plan-message.collapsed .research-plan-toggle {
    transform: rotate(180deg);
}

.research-plan-text {
    background: #ffffff;
    border: 1px solid #e3e6ff;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.research-plan-message.collapsed .research-plan-text {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    opacity: 0;
}

.research-plan-text h1,
.research-plan-text h2,
.research-plan-text h3,
.research-plan-text h4,
.research-plan-text h5,
.research-plan-text h6 {
    color: #495057;
    border-left: 3px solid #667eea;
    padding-left: 0.75rem;
    margin-left: -0.75rem;
}

.research-plan-text ul,
.research-plan-text ol {
    margin-left: 1rem;
}

.research-plan-text li {
    margin-bottom: 0.25rem;
    color: #495057;
}

.research-plan-text strong {
    color: #667eea;
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .messages {
        padding: 1rem;
    }
    
    .input-container {
        padding: 1rem;
    }
    
    .capabilities {
        flex-direction: column;
        align-items: center;
    }
    
    .welcome-message {
        padding: 2rem 1rem;
    }
} 