:root {
    --bg-primary: #f9f9f9;
    --bg-secondary: #ffffff;
    --bg-chat: #f0f7ff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --user-bubble: #4cd964;
    --ai-bubble: #ffffff;
    --border-color: #e0e0e0;
    --header-bg: #ffffff;
    --time-bg: rgba(0,0,0,0.1);
    --time-text: #ffffff;
    --theme-btn: #333333;
    --welcome-gradient: linear-gradient(135deg, #4a90e2, #5cb85c);
    --shadow-light: 0 2px 10px rgba(0,0,0,0.05);
    --shadow-medium: 0 4px 15px rgba(0,0,0,0.08);
    --transition-fast: all 0.2s ease;
    --transition-normal: all 0.3s ease;
}
.dark-mode {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-chat: #1a1a2e;
    --text-primary: #f0f0f0;
    --text-secondary: #bbbbbb;
    --user-bubble: #32cd32;
    --ai-bubble: #2d2d44;
    --border-color: #333344;
    --header-bg: #1e1e1e;
    --time-bg: rgba(255,255,255,0.1);
    --time-text: #dddddd;
    --theme-btn: #f0f0f0;
    --welcome-gradient: linear-gradient(135deg, #2c3e50, #27ae60);
    --shadow-light: 0 2px 10px rgba(0,0,0,0.2);
    --shadow-medium: 0 4px 15px rgba(0,0,0,0.3);
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition-normal);
}
/* 顶部导航栏 */
.header {
    height: 55px;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    box-shadow: var(--shadow-light);
    z-index: 10;
}
.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}
.header-actions {
    display: flex;
    gap: 18px;
    align-items: center;
}
.header-icon {
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.header-icon:hover {
    background-color: rgba(0,0,0,0.05);
    transform: scale(1.1);
}
.dark-mode .header-icon:hover {
    background-color: rgba(255,255,255,0.05);
}
.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--theme-btn);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-light);
}
.theme-toggle:hover {
    transform: rotate(30deg) scale(1.05);
    box-shadow: var(--shadow-medium);
}
/* 聊天区域 */
.chat-container {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: var(--bg-chat);
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}
.chat-container::-webkit-scrollbar {
    width: 6px;
}
.chat-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
    transition: var(--transition-fast);
}
.chat-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0,0,0,0.3);
}
.dark-mode .chat-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255,255,255,0.3);
}
/* 时间分割线 */
.time-divider {
    align-self: center;
    margin: 15px auto;
    padding: 5px 12px;
    background-color: var(--time-bg);
    color: var(--time-text);
    font-size: 12px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    letter-spacing: 0.5px;
}
/* 消息样式 */
.message-wrapper {
    display: flex;
    margin: 10px 0;
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 20px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 16px;
    box-shadow: var(--shadow-light);
    transition: var(--transition-fast);
}
.message:hover {
    box-shadow: var(--shadow-medium);
}
.ai-message {
    background-color: var(--ai-bubble);
    color: var(--text-primary);
    border-top-left-radius: 6px;
    margin-right: auto;
}
.user-message {
    background-color: var(--user-bubble);
    color: #333;
    border-top-right-radius: 6px;
    margin-left: auto;
}
/* 头像 */
.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    margin: 0 10px;
    background: var(--welcome-gradient);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    box-shadow: var(--shadow-light);
    font-size: 18px;
    transition: var(--transition-fast);
}
.avatar:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-medium);
}
/* 输入区域 */
.input-area {
    padding: 12px;
    background-color: var(--header-bg);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    transition: var(--transition-normal);
}
.input-container {
    display: flex;
    align-items: center;
    gap: 10px;
}
#messageInput {
    flex: 1;
    min-height: 46px;
    max-height: 140px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 23px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    font-size: 16px;
    resize: none;
    overflow-y: auto;
    transition: var(--transition-fast);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
#messageInput:focus {
    border-color: #5cb85c;
    box-shadow: 0 0 0 2px rgba(92, 184, 92, 0.2), inset 0 1px 3px rgba(0,0,0,0.05);
}
#messageInput::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}
.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--welcome-gradient);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-light);
    position: relative;
    overflow: hidden;
}
.send-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background-color: rgba(255,255,255,0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}
.send-btn:hover::after {
    width: 50px;
    height: 50px;
}
.send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-medium);
}
.send-btn:active {
    transform: scale(0.95);
}
.send-btn:disabled {
    background: linear-gradient(135deg, #cccccc, #999999);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 50%;
    border-top-color: #666;
    animation: spin 1s linear
    infinite;
}
.dark-mode .loading {
    border-color: rgba(255,255,255,0.2);
    border-top-color: #aaa;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* 欢迎消息 */
.welcome-card {
    align-self: center;
    margin: 25px auto 15px;
    padding: 20px 24px;
    background: var(--welcome-gradient);
    border-radius: 16px;
    font-size: 15px;
    color: white;
    max-width: 85%;
    text-align: center;
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}
.welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shine 3s infinite;
}
@keyframes shine {
    100% { left: 100%; }
}
.welcome-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}
/* 响应式优化 */
@media (max-width: 414px) {
    .message {
        max-width: 78%;
        font-size: 15px;
        padding: 11px 15px;
    }
    
    .welcome-card {
        padding: 18px 20px;
        font-size: 14px;
    }
    
    .avatar {
        width: 40px;
        height: 40px;
        margin: 0 8px;
    }
}
@media (max-width: 360px) {
    .message {
        max-width: 75%;
        font-size: 14px;
    }
    
    .header {
        height: 52px;
        padding: 0 15px;
    }
    
    .welcome-card {
        margin: 20px auto 12px;
    }
}