/* ========== 基础样式 & 动画 ========== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --bg-dark: #0f0f23;
    --bg-card: #1a1a2e;
    --bg-hover: #252542;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* 深海幽蓝主题 */
[data-theme="ocean"] {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --secondary: #06b6d4;
    --accent: #3b82f6;
    --bg-dark: #0c1929;
    --bg-card: #0f2944;
    --bg-hover: #1e3a5f;
    --gradient-1: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    --gradient-2: linear-gradient(135deg, #3b82f6 0%, #0ea5e9 100%);
}

/* 日落橙红主题 */
[data-theme="sunset"] {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --secondary: #ef4444;
    --accent: #fbbf24;
    --bg-dark: #1a0f0f;
    --bg-card: #2e1a1a;
    --bg-hover: #422525;
    --gradient-1: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
    --gradient-2: linear-gradient(135deg, #fbbf24 0%, #f97316 100%);
}

/* 森林翠绿主题 */
[data-theme="forest"] {
    --primary: #22c55e;
    --primary-dark: #16a34a;
    --secondary: #10b981;
    --accent: #84cc16;
    --bg-dark: #0f1a0f;
    --bg-card: #1a2e1a;
    --bg-hover: #254225;
    --gradient-1: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
    --gradient-2: linear-gradient(135deg, #84cc16 0%, #22c55e 100%);
}

/* 银河星云主题 */
[data-theme="galaxy"] {
    --primary: #a855f7;
    --primary-dark: #9333ea;
    --secondary: #ec4899;
    --accent: #6366f1;
    --bg-dark: #0f0a1a;
    --bg-card: #1a102e;
    --bg-hover: #2a1a42;
    --gradient-1: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    --gradient-2: linear-gradient(135deg, #ec4899 0%, #a855f7 100%);
}

/* 糖果甜心主题 */
[data-theme="candy"] {
    --primary: #f472b6;
    --primary-dark: #ec4899;
    --secondary: #fb7185;
    --accent: #fbbf24;
    --bg-dark: #1a0f1a;
    --bg-card: #2e1a2e;
    --bg-hover: #422542;
    --gradient-1: linear-gradient(135deg, #f472b6 0%, #fb7185 100%);
    --gradient-2: linear-gradient(135deg, #fbbf24 0%, #f472b6 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    font-feature-settings: normal;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

body {
    font-size: 16px;
    height: 100vh;
    margin: 0;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(99, 102, 241, 0.2) 0%, transparent 40%);
    transition: background 0.5s ease;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ========== 登录/注册/关于模态框 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 40px;
    max-width: 420px;
    width: 90%;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
}

.large-modal {
    max-width: 480px;
}

.close-modal-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--bg-hover);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
}

.close-modal-btn:hover {
    background: var(--primary);
}

.about-box {
    max-width: 400px;
    text-align: center;
}

.close-about {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: var(--bg-hover);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.close-about:hover {
    background: var(--primary);
}

.about-content .logo-animation {
    margin: 0 auto 20px;
}

.about-content h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.about-text {
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.about-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.about-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.about-links a {
    color: var(--accent);
    text-decoration: none;
}

.about-links a:hover {
    color: var(--primary);
}

.about-links .dot {
    color: var(--text-secondary);
}

.modal.active .modal-content {
    transform: scale(1);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-animation {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--gradient-1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    animation: float 3s ease-in-out infinite, glow 2s ease-in-out infinite alternate;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes glow {
    from { box-shadow: 0 0 20px rgba(99, 102, 241, 0.5); }
    to { box-shadow: 0 0 40px rgba(99, 102, 241, 0.8), 0 0 60px rgba(236, 72, 153, 0.4); }
}

.login-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.input-group {
    position: relative;
    margin-bottom: 16px;
}

.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    transition: color 0.3s;
    z-index: 1;
}

.input-group input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-group input:focus + i,
.input-group:focus-within i {
    color: var(--primary);
}

.math-group {
    position: relative;
}

.math-problem {
    position: absolute;
    right: 45px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    background: var(--bg-hover);
    padding: 4px 8px;
    border-radius: 6px;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.refresh-math {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: var(--bg-card);
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    padding: 0;
    line-height: 1;
}

.refresh-math i {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    width: 100%;
    height: 100%;
}

.refresh-math:hover {
    background: var(--primary);
    color: white;
}

.error-message {
    color: #ef4444;
    font-size: 13px;
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: var(--gradient-1);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.switch-auth {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.switch-auth a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.switch-auth a:hover {
    text-decoration: underline;
}

/* ========== 侧边栏 ========== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.3s;
    padding: 8px;
    border-radius: 12px;
}

.brand:hover {
    background: var(--bg-hover);
}

.brand i {
    width: 40px;
    height: 40px;
    background: var(--gradient-1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-hover);
    border: 1px dashed var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.new-chat-btn:hover {
    background: var(--primary);
    border-style: solid;
    border-color: var(--primary);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.chat-item {
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    margin-bottom: 4px;
    position: relative;
}

.chat-item:hover {
    background: var(--bg-hover);
}

.chat-item.active {
    background: var(--primary);
}

.chat-item i {
    color: var(--text-secondary);
    font-size: 14px;
}

.chat-item.active i {
    color: white;
}

.chat-item-content {
    flex: 1;
    min-width: 0;
}

.chat-item-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.chat-item.active .chat-item-preview {
    color: rgba(255, 255, 255, 0.8);
}

.delete-chat {
    opacity: 0;
    padding: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s;
}

.chat-item:hover .delete-chat {
    opacity: 1;
}

.delete-chat:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    cursor: pointer;
    transition: all 0.3s;
    padding: 8px;
    border-radius: 10px;
}

.user-info:hover {
    background: var(--bg-hover);
}

.avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.theme-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-hover);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.theme-btn:hover {
    background: var(--primary);
    transform: rotate(180deg);
}

/* ========== 主题选择器 ========== */
.theme-selector {
    position: fixed;
    right: -400px;
    top: 0;
    bottom: 0;
    width: 320px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 200;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.theme-selector.active {
    right: 0;
}

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

.theme-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.close-theme {
    width: 32px;
    height: 32px;
    background: var(--bg-hover);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.close-theme:hover {
    background: var(--primary);
}

.theme-grid {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    gap: 16px;
}

.theme-item {
    background: var(--bg-hover);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.theme-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.theme-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.theme-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    margin: 0 auto 12px;
    transition: transform 0.3s;
}

.theme-item:hover .theme-preview {
    transform: scale(1.1);
}

.theme-preview.default {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.theme-preview.ocean {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
}

.theme-preview.sunset {
    background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
}

.theme-preview.forest {
    background: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
}

.theme-preview.galaxy {
    background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
}

.theme-preview.candy {
    background: linear-gradient(135deg, #f472b6 0%, #fb7185 100%);
}

.theme-item span {
    font-size: 14px;
    font-weight: 500;
}

/* ========== 主内容区 ========== */
.main-content {
    margin-left: 280px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.main-content.full {
    margin-left: 0;
}

.top-header {
    height: 64px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 50;
}

.chat-title-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding-left: 20px;
}

.top-header h1 {
    font-size: 18px;
    font-weight: 600;
    text-align: left;
}

.edit-title-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    opacity: 0;
}

.chat-title-wrapper:hover .edit-title-btn {
    opacity: 1;
}

.edit-title-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.icon-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-hover);
    border: none;
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    pointer-events: auto;
    position: relative;
    z-index: 51;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.icon-btn i {
    pointer-events: none;
}

.icon-btn:hover {
    background: var(--primary);
    transform: scale(1.05);
}

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

/* ========== 聊天区域 ========== */
.chat-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.chat-container {
    height: 100%;
    overflow-y: auto;
    padding: 20px 0;
}

.layout {
    max-width: 100%;
    margin: 0;
    padding: 0 20px;
}

.messages-box {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.messages-list {
    flex: 1;
    padding-bottom: 20px;
}

#messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 消息行 - 头像在消息框左边 */
.message-row {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
    align-items: flex-start;
}

.message-row.user {
    flex-direction: row-reverse;
}

.message-row.bot {
    flex-direction: row;
}

/* AI头像 - 在消息框左上角的左边 */
.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
    margin-top: 0;
}

/* 用户头像占位 */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.ai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 消息气泡 */
.message {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 20px;
    line-height: 1.6;
    font-size: 15px;
    animation: messageSlide 0.3s ease;
    position: relative;
}

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

.user-message {
    background: var(--gradient-1);
    color: white;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 20px;
    border-bottom-left-radius: 20px;
    border-top-left-radius: 20px;
}

.bot-message {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
    border-bottom-right-radius: 20px;
    border-bottom-left-radius: 20px;
    border-top-right-radius: 20px;
}

/* AI提示小字 */
.ai-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-style: italic;
    opacity: 0.8;
}

/* 登录提示小字 */
.login-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.login-hint a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.login-hint a:hover {
    text-decoration: underline;
}

/* 固定提示小字 */
.fixed-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    opacity: 0.7;
}

.fixed-hint .login-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.fixed-hint .login-link:hover {
    text-decoration: underline;
}

/* 图片消息 */
.message-image {
    max-width: 300px;
    max-height: 200px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s;
}

.message-image:hover {
    transform: scale(1.02);
}

/* 附件消息 */
.attachment-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.attachment-file:hover {
    background: rgba(255, 255, 255, 0.15);
}

.attachment-file i {
    font-size: 24px;
    color: var(--primary);
}

.attachment-info {
    flex: 1;
}

.attachment-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* 打字指示器 */
.waiting {
    align-self: flex-start;
    padding: 20px;
    margin-left: 20px;
}

.waiting[data-hide="true"] {
    display: none;
}

.typing-indicator {
    display: flex;
    gap: 6px;
}

.typing-indicator span {
    width: 10px;
    height: 10px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ========== 输入区域 ========== */
.input-box {
    padding: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
}

.input-padding {
    max-width: 100%;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px;
    transition: all 0.3s;
    min-height: 56px;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

/* 预览区域 */
.preview-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    width: 100%;
}

.preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item.file {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
}

.preview-item.file i {
    font-size: 24px;
    color: var(--primary);
}

.preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.upload-btn:hover {
    background: var(--bg-card);
    color: var(--primary);
}

#user-input {
    width: 100%;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    padding: 0 8px;
    outline: none;
    line-height: normal;
    display: flex;
    align-items: center;
}

#user-input::placeholder {
    color: var(--text-secondary);
}

#send-button {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

#send-button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

#send-button:disabled {
    background: var(--bg-card);
    cursor: not-allowed;
    transform: none;
}

/* ========== 图片预览模态框 ========== */
.image-modal .modal-content {
    background: transparent;
    border: none;
    box-shadow: none;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .message {
        max-width: 85%;
    }
    
    .modal-content {
        padding: 24px;
    }
    
    .logo-animation {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
    
    .theme-selector {
        width: 100%;
        right: -100%;
    }
    
    .ai-avatar {
        width: 32px;
        height: 32px;
    }
}

/* 遮罩层 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* 时间戳 */
.message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 8px;
    text-align: right;
}

.bot-message .message-time {
    color: var(--text-secondary);
    text-align: left;
}
