/* 基础样式 */
:root {
    --primary-color: #2563eb;
    --secondary-color: #f3f4f6;
    --accent-color: #10b981;
    --text-color: #1f2937;
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --chat-box-bg: #f1f5f9;
    --error-color: #ef4444;
}

/* 暗色模式 */
.dark-theme {
    --bg-color: #1e293b;
    --secondary-color: #334155;
    --text-color: #f1f5f9;
    --card-bg: #1e293b;
    --chat-box-bg: #334155;
    --primary-color: #3b82f6;
    --accent-color: #22d3ee;
    --error-color: #f87171;
}

/* 亮色模式 */
.light-theme {
    --bg-color: #ffffff;
    --secondary-color: #f8fafc;
    --text-color: #1f293b;
    --card-bg: #ffffff;
    --chat-box-bg: #f1f5f9;
    --primary-color: #2563eb;
    --accent-color: #0ea5e9;
    --error-color: #ef4444;
}

/* 通用样式 */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* 卡片组件 */
.card {
    background: var(--card-bg);
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* 主题切换按钮 */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

/* 聊天容器 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 400px;
}

#chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: var(--chat-box-bg);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin: 0.5rem 0;
    max-width: 70%;
    position: relative;
    word-wrap: break-word;
}

.message-bubble.user {
    background-color: var(--primary-color);
    color: white;
    align-self: flex-end;
}

.message-bubble.system {
    background-color: #e5e7eb;
    align-self: flex-start;
}

/* 消息时间戳 */
.message-time {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
    text-align: right;
}

/* 表单布局 */
#message-form {
    display: grid;
    grid-template-columns: 1fr 1fr 3fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.input-field {
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    font-size: 1rem;
    transition: border-color 0.3s;
    background-color: var(--bg-color);
}

.input-field:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease-in-out;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-accent {
    background-color: var(--accent-color);
    color: white;
}

.btn-accent:hover {
    background-color: #059669;
}

/* 文件区域 */
.file-input {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
}

.file-list {
    background: var(--secondary-color);
    border-radius: 0.5rem;
    padding: 1rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.file-item:last-child {
    border-bottom: none;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon-file {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    #message-form {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    #message-input {
        grid-column: span 2;
    }

    .file-input {
        flex-direction: column;
        gap: 0.5rem;
    }

    .chat-container {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
    }

    .card {
        padding: 1rem;
    }

    .message-bubble {
        font-size: 1rem;
        max-width: 85%;
    }
}