/* 全局样式 */
:root {
    --primary-color: #2196f3;
    --secondary-color: #1a237e;
    --background-color: #f5f5f5;
    --user-message-bg: #e8f5e9;
    --assistant-message-bg: #e3f2fd;
    --text-color: #333;
    --light-text: #666;
    --border-radius: 10px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

#app {
    height: 100%;
}
#app, .chat-app {
    width: 100%;
}
/* 主应用容器 */
.chat-app {
    max-width: 1000px;
    height: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 0;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.chat-header {
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.control-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 聊天容器 */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: white;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

/* 消息样式 */
.message-wrapper {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

.message-bubble {
    display: flex;
    align-items: flex-start;
    max-width: 85%;
    gap: 12px;
}

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

.user-message .message-bubble {
    flex-direction: row-reverse;
    margin-left: auto;
}

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

.user-message .message-avatar {
    background: #fff;
    border: 2px solid var(--primary-color);
}

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

.message-avatar .material-icons {
    font-size: 20px;
}

.user-message .message-avatar .material-icons {
    color: var(--primary-color);
}

.assistant-message .message-avatar .material-icons {
    color: white;
}

.message-content {
    background: var(--assistant-message-bg);
    padding: 14px 18px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    position: relative;
    min-width: 50px;
    font-size: 14px;
    line-height: 1.6;
    letter-spacing: 0.2px;
}

.user-message .message-content {
    background: var(--user-message-bg);
}

.text-content {
    white-space: pre-wrap;
    word-break: break-word;
}

/* 输入区域 */
.chat-input-container {
    flex-shrink: 0;
    padding: 16px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

.message-input {
    flex: 1;
    height: 40px;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.message-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.send-button {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-button:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

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

.send-button .material-icons {
    font-size: 20px;
}

/* Markdown 样式 */
.markdown-body {
    font-size: 14px;
    line-height: 1.25;
    letter-spacing: 0.2px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 0px;
    margin-bottom: 0px;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-body h1 { font-size: 1.5em; }
.markdown-body h2 { font-size: 1.3em; }
.markdown-body h3 { font-size: 1.2em; }
.markdown-body h4 { font-size: 1.1em; }
.markdown-body h5 { font-size: 1em; }
.markdown-body h6 { font-size: 1em; }

.markdown-body p {
    margin-top: 0;
    margin-bottom: 12px;
}

.markdown-body ul,
.markdown-body ol {
    margin-top: 0;
    margin-bottom: 12px;
    padding-left: 1.5em;
}

.markdown-body li {
    margin: 2px 0;
}

.markdown-body pre {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 16px 0;
}

.markdown-body code {
    background: rgba(0, 0, 0, 0.05);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 14px;
    font-family: Consolas, Monaco, 'Andale Mono', monospace;
}

.markdown-body a {
    color: #1976d2;
    text-decoration: none;
    background: #e3f2fd;
    padding: 4px 8px;
    border-radius: 4px;
    margin: 4px;
    display: inline-block;
    transition: background-color 0.2s;
}

.markdown-body a:hover {
    background: #bbdefb;
    text-decoration: none;
}

.markdown-body p {
    margin: 8px 0;
}

.markdown-body ul {
    list-style: none;
    padding: 0;
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.markdown-body li {
    margin: 0;
    padding: 0;
}

.qa-link {
    color: #1976d2;
    text-decoration: none;
    background: #e3f2fd;
    border-radius: 4px;
    display: inline-block;
    transition: background-color 0.2s;
}

.qa-link:hover {
    background: #bbdefb;
    text-decoration: none;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 滚动条样式 */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

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

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* 加载动画 */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading .material-icons {
    animation: rotate 1s linear infinite;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-app {
        margin: 0;
        height: 100vh;
        border-radius: 0;
    }

    .message-bubble {
        max-width: 90%;
    }
    
    .message-input {
        font-size: 16px;
    }
}
