/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 浅色主题 */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    
    --bg-primary: #f8f9fd;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f2f8;
    
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-tertiary: #a0aec0;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    
    --user-msg-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --ai-msg-bg: #ffffff;
    --ai-msg-border: #e2e8f0;
    
    --transition-speed: 0.3s;
}

body.dark-theme {
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-tertiary: #252d3d;
    
    --text-primary: #e2e8f0;
    --text-secondary: #a0aec0;
    --text-tertiary: #718096;
    
    --border-color: #2d3748;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    
    --ai-msg-bg: #1a1f2e;
    --ai-msg-border: #2d3748;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background var(--transition-speed), color var(--transition-speed);
}

/* ==================== 背景装饰 ==================== */
.background-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 20s infinite ease-in-out;
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    top: -200px;
    left: -100px;
    animation-delay: 0s;
}

.circle-2 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    bottom: -250px;
    right: -150px;
    animation-delay: -7s;
}

.circle-3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    top: 50%;
    right: -100px;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* ==================== 主容器 ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

/* ==================== 头部 ==================== */
.header {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    transition: all var(--transition-speed);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-gradient);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    animation: pulse 2s infinite;
}

.logo-icon svg {
    width: 28px;
    height: 28px;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.logo-text h1 {
    font-size: 28px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2px;
}

.tagline {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.header-actions button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.header-actions button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.header-actions button svg {
    width: 20px;
    height: 20px;
}

.theme-toggle .moon-icon {
    display: none;
}

body.dark-theme .theme-toggle .sun-icon {
    display: none;
}

body.dark-theme .theme-toggle .moon-icon {
    display: block;
}

/* ==================== 聊天容器 ==================== */
.chat-container {
    flex: 1;
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all var(--transition-speed);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    scroll-behavior: smooth;
}

/* 自定义滚动条 */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ==================== 欢迎消息 ==================== */
.welcome-message {
    text-align: center;
    padding: 60px 20px;
    animation: fadeInUp 0.6s ease-out;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: wave 2s infinite;
}

@keyframes wave {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(20deg);
    }
    75% {
        transform: rotate(-20deg);
    }
}

.welcome-message h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-message p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.welcome-subtitle {
    font-size: 14px !important;
    margin-bottom: 30px !important;
}

.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.quick-question {
    padding: 12px 24px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-speed);
    font-size: 14px;
    font-weight: 500;
}

.quick-question:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ==================== 消息气泡 ==================== */
.message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
}

.message.user .message-content {
    background: var(--user-msg-bg);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.ai .message-content {
    background: var(--ai-msg-bg);
    border: 1px solid var(--ai-msg-border);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin: 0 12px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    order: 2;
}

.message.ai .message-avatar {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.message-text {
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.message-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 8px;
    opacity: 0.7;
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* 加载动画 */
.message.loading .message-text {
    display: flex;
    gap: 6px;
    padding: 8px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* ==================== 输入区域 ==================== */
.input-area {
    padding: 20px 30px 25px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

.input-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 2px solid var(--border-color);
    padding: 12px 16px;
    transition: all var(--transition-speed);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-container:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#messageInput {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.5;
}

#messageInput::placeholder {
    color: var(--text-tertiary);
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-count {
    font-size: 12px;
    color: var(--text-tertiary);
}

.send-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-speed);
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

.input-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
}

.input-hint kbd {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-family: monospace;
    font-size: 11px;
}

/* ==================== 模态框 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
}

.modal-close:hover {
    background: var(--border-color);
}

.modal-close svg {
    width: 18px;
    height: 18px;
    color: var(--text-primary);
}

.modal-body {
    padding: 30px;
}

.settings-group {
    margin-bottom: 25px;
}

.settings-group:last-child {
    margin-bottom: 0;
}

.settings-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.settings-group input[type="text"],
.settings-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-speed);
}

.settings-group input[type="text"]:focus,
.settings-group input[type="password"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.settings-group input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.settings-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed);
    border: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* ==================== 提示消息 ==================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease-out;
    border: 1px solid var(--border-color);
    max-width: 500px;
    text-align: center;
    line-height: 1.6;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 15px 20px;
        border-radius: 15px;
    }

    .logo-text h1 {
        font-size: 22px;
    }

    .tagline {
        font-size: 11px;
    }

    .header-actions button {
        width: 36px;
        height: 36px;
    }

    .chat-messages {
        padding: 20px 15px;
    }

    .message-content {
        max-width: 85%;
    }

    .welcome-message {
        padding: 40px 15px;
    }

    .welcome-message h2 {
        font-size: 24px;
    }

    .quick-questions {
        flex-direction: column;
    }

    .quick-question {
        width: 100%;
    }

    .input-area {
        padding: 15px;
    }

    .modal-content {
        width: 95%;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
}

/* ==================== 打印样式 ==================== */
@media print {
    .header-actions,
    .input-area,
    .background-decoration,
    .welcome-message {
        display: none;
    }

    .container {
        height: auto;
    }

    .chat-container {
        box-shadow: none;
    }
}

