/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --bg: #f0f4f0;
    --chat-bg: #ffffff;
    --user-bubble: #E8F5E9;
    --ai-bubble: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --border: #e0e0e0;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --radius: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ========== 聊天容器 ========== */
.chat-container {
    width: 100%;
    max-width: 800px;
    height: 92vh;
    background: var(--chat-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========== 头部 ========== */
.chat-header {
    background: linear-gradient(135deg, var(--primary), #66BB6A);
    color: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header .avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.chat-header .info h2 {
    font-size: 17px;
    font-weight: 600;
}

.chat-header .info p {
    font-size: 12px;
    opacity: 0.85;
    margin-top: 2px;
}

/* ========== 消息列表 ========== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* ========== 欢迎消息 ========== */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
}

.welcome-message .welcome-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.welcome-message h2 {
    font-size: 20px;
    color: var(--text);
    margin-bottom: 8px;
}

.welcome-message p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
}

.welcome-message .quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
}

.welcome-message .quick-btn {
    padding: 8px 16px;
    background: var(--user-bubble);
    border: 1px solid #C8E6C9;
    border-radius: 20px;
    font-size: 13px;
    color: var(--primary-dark);
    cursor: pointer;
    transition: all 0.2s;
}

.welcome-message .quick-btn:hover {
    background: #C8E6C9;
    transform: translateY(-1px);
}

/* ========== 消息气泡 ========== */
.message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.assistant {
    align-self: flex-start;
}

.message .msg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.message.user .msg-avatar {
    background: #C8E6C9;
}

.message.assistant .msg-avatar {
    background: #E8F5E9;
}

.message .msg-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.7;
    word-break: break-word;
}

.message.user .msg-content {
    background: var(--user-bubble);
    border-bottom-right-radius: 4px;
}

.message.assistant .msg-content {
    background: var(--ai-bubble);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message.assistant .msg-content p {
    margin-bottom: 8px;
}

.message.assistant .msg-content p:last-child {
    margin-bottom: 0;
}

.message.assistant .msg-content ul,
.message.assistant .msg-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message.assistant .msg-content li {
    margin-bottom: 4px;
}

.message.assistant .msg-content strong {
    color: var(--primary-dark);
}

/* ========== 打字动画 ========== */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #BDBDBD;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ========== 输入区 ========== */
.chat-input {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: #FAFAFA;
}

.chat-input textarea {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 10px 18px;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.5;
    transition: border-color 0.2s;
}

.chat-input textarea:focus {
    border-color: var(--primary);
}

.chat-input .send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-input .send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.chat-input .send-btn:disabled {
    background: #BDBDBD;
    cursor: not-allowed;
    transform: none;
}

/* ========== 免责声明 ========== */
.disclaimer {
    text-align: center;
    padding: 6px;
    font-size: 11px;
    color: #BDBDBD;
    background: #FAFAFA;
    border-top: 1px solid #F5F5F5;
}

/* ========== 响应式 ========== */
@media (max-width: 600px) {
    .chat-container {
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }

    .chat-messages {
        padding: 14px 12px;
    }

    .message {
        max-width: 92%;
    }

    .chat-header {
        padding: 12px 16px;
    }
}
