﻿/* 基础测试：如果页面背景变灰，说明CSS已加载 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f0f0f0; /* 测试样式 */
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* 聊天容器 */
.chat-container {
    width: 100%;
    max-width: 1000px;
    height: 100vh;
    max-height: 900px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 头部样式 */
.chat-header {
    padding: 16px 24px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    text-align: center;
}
.chat-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

/* 主消息区域 */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.message-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 消息气泡 */
.message {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.4;
    animation: fadeIn 0.3s ease-out;
}
.message-user {
    align-self: flex-end;
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}
.message-ai {
    align-self: flex-start;
    background: #f1f3f4;
    color: #333;
    border-bottom-left-radius: 4px;
}

/* 加载指示器 */
.loading-indicator {
    padding: 10px 20px;
    text-align: center;
}
.hidden {
    display: none;
}
.typing-animation {
    display: inline-flex;
    gap: 4px;
}
.typing-animation span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite ease-in-out;
}
.typing-animation span:nth-child(2) { animation-delay: 0.2s; }
.typing-animation span:nth-child(3) { animation-delay: 0.4s; }

/* 底部输入区 */
.chat-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}
.input-container {
    width: 100%;
}
.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
#messageInput {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    resize: none;
    font-family: inherit;
}
.send-button {
    padding: 12px 24px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}
.send-button:hover:not(:disabled) {
    background: #0056b3;
}
.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* 响应式设计 */
@media (max-width: 600px) {
    .chat-container {
        border-radius: 0;
        height: 100vh;
        max-height: none;
    }
    .message {
        max-width: 90%;
    }
    .chat-footer {
        padding: 15px;
    }
}
