/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 亮色模式变量（默认） */
:root {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8ed;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-glass-light: rgba(255, 255, 255, 0.5);
    
    --text-primary: #1a1a24;
    --text-secondary: #6b6b75;
    --text-muted: #a1a1aa;
    
    --accent-blue: #5a7cd9;
    --accent-pink: #d98a9e;
    --accent-purple: #8b6bd9;
    --accent-green: #5cd98a;
    
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 40px rgba(90, 124, 217, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    --font-sans: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Noto Serif SC', serif;
}

/* 深色模式 */
.dark-mode {
    --bg-primary: #0f0f14;
    --bg-secondary: #1a1a24;
    --bg-tertiary: #252532;
    --bg-glass: rgba(30, 30, 45, 0.6);
    --bg-glass-light: rgba(50, 50, 70, 0.4);
    
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1aa;
    --text-muted: #6b6b75;
    
    --accent-blue: #7c9aeb;
    --accent-pink: #e8a2c0;
    --accent-purple: #a78bfa;
    --accent-green: #86efac;
    
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(124, 154, 235, 0.15);
}

/* 基础样式 */
html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 背景效果 */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* 漂浮模糊块 */
.floating-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: blobFloat 20s ease-in-out infinite;
}

.dark-mode .floating-blob {
    opacity: 0.3;
}

.dark-mode .particle {
    opacity: 0.4;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-blue));
    bottom: -50px;
    left: -50px;
    animation-delay: -7s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -20px) scale(1.1); }
    50% { transform: translate(-20px, 30px) scale(0.95); }
    75% { transform: translate(20px, 20px) scale(1.05); }
}

/* 微粒效果 */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-blue);
    border-radius: 50%;
    opacity: 0.2;
    animation: particleFloat 8s ease-in-out infinite;
}

.dark-mode .particle {
    opacity: 0.4;
}

@keyframes particleFloat {
    0% {
        bottom: -10px;
        opacity: 0;
        transform: translateX(0);
    }
    10% {
        opacity: 0.4;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        bottom: 110%;
        opacity: 0;
        transform: translateX(50px);
    }
}

/* 主容器 */
.chat-container {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: transform 0.3s ease;
}

.dark-mode .sidebar {
    border-right-color: rgba(255, 255, 255, 0.05);
}

.sidebar-header {
    padding: 20px 0 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.dark-mode .sidebar-header {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.logo {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 2px;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    margin: 20px 0;
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dark-mode .new-chat-btn {
    border-color: rgba(255, 255, 255, 0.1);
}

.new-chat-btn:hover {
    background: rgba(90, 124, 217, 0.2);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.new-chat-btn i {
    font-size: 16px;
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 4px;
}

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

.conversation-item.active {
    background: rgba(124, 154, 235, 0.15);
    border-left: 2px solid var(--accent-blue);
}

.conversation-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background-image: url('https://big-eventz-znj.oss-cn-beijing.aliyuncs.com/avatar.png');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.conversation-avatar i {
    display: none;
}

.conversation-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.conversation-title {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 11px;
    color: var(--text-muted);
}

/* 移动端侧边栏切换 */
.mobile-sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.dark-mode .mobile-sidebar-toggle {
    border-color: rgba(255, 255, 255, 0.1);
}

.mobile-sidebar-toggle:hover {
    background: var(--bg-tertiary);
}

/* 聊天区域 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
}

/* 聊天头部 */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.dark-mode .chat-header {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.online {
    background: var(--accent-green);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

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

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

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dark-mode .action-btn {
    border-color: rgba(255, 255, 255, 0.1);
}

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

/* 消息容器 */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

/* 欢迎消息 */
.welcome-message {
    text-align: center;
    padding: 60px 40px;
    max-width: 510px;
    margin: auto;
}

.avatar-wrapper {
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
    border-radius: 50%;
    background-image: url('https://big-eventz-znj.oss-cn-beijing.aliyuncs.com/avatar.png');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.avatar-wrapper.breathing {
    animation: breathing 3s ease-in-out infinite;
}

@keyframes breathing {
    0%, 100% { transform: scale(1); box-shadow: var(--shadow-glow); }
    50% { transform: scale(1.05); box-shadow: 0 0 60px rgba(124, 154, 235, 0.25); }
}

.avatar-wrapper i {
    display: none;
}

.welcome-message h3 {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

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

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

.quick-btn {
    padding: 10px 20px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dark-mode .quick-btn {
    border-color: rgba(255, 255, 255, 0.1);
}

.quick-btn:hover {
    background: rgba(90, 124, 217, 0.2);
    border-color: var(--accent-blue);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* 消息列表 */
.messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 消息气泡 */
.message {
    display: flex;
    gap: 12px;
    animation: messageFadeIn 0.4s ease-out;
}

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

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

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

.message-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-image: url('https://big-eventz-znj.oss-cn-beijing.aliyuncs.com/useravatar.png');
    background-size: cover;
    background-position: center;
}

.dark-mode .message.user .message-avatar {
    border-color: rgba(255, 255, 255, 0.1);
}

.message.ai .message-avatar {
    background-image: url('https://big-eventz-znj.oss-cn-beijing.aliyuncs.com/avatar.png');
    background-size: cover;
    background-position: center;
}

.message-avatar i {
    display: none;
}

.message.ai .message-avatar i {
    display: none !important;
}

.message-content {
    max-width: 60%;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

.message.ai .message-content {
    background: var(--bg-glass-light);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 8px;
    box-shadow: var(--shadow-soft);
}

.dark-mode .message.ai .message-content {
    border-color: rgba(255, 255, 255, 0.05);
}

.message.user .message-content {
    background: var(--bg-glass-light);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg) var(--radius-lg) 8px var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.dark-mode .message.user .message-content {
    border-color: rgba(255, 255, 255, 0.05);
}

.message-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: right;
}

/* 打字指示器 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 20px;
    background: var(--bg-glass-light);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-mode .typing-indicator {
    border-color: rgba(255, 255, 255, 0.05);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingDot 1.4s ease-in-out infinite;
}

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

@keyframes typingDot {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* 输入区域 */
.input-area {
    padding: 20px 30px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
}

.dark-mode .input-area {
    border-top-color: rgba(255, 255, 255, 0.05);
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-full);
    padding: 6px 6px 6px 20px;
    transition: all 0.3s ease;
}

.dark-mode .input-wrapper {
    border-color: rgba(255, 255, 255, 0.1);
}

.input-wrapper:focus-within {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow);
}
/* 
#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    padding: 10px 0;
    margin: 0;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    overflow-y: auto;
    word-break: break-word;
    white-space: pre-wrap;
    box-sizing: border-box;
} */
#messageInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  padding: 10px 0;
  margin: 0;
  resize: none;
  min-height: 24px;
  max-height: 200px;
  overflow-y: auto;
  word-break: break-word;
  white-space: pre-wrap;
  box-sizing: border-box;
  width: 100%;
  font-family: inherit;
}
#messageInput::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    gap: 6px;
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(90, 124, 217, 0.4);
}

.send-btn:active {
    transform: scale(0.98);
}

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

.input-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-full);
}

.dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Markdown 样式 */
.message-text strong {
    font-weight: 600;
    color: var(--accent-pink);
}

.message-text em {
    font-style: italic;
    color: var(--accent-blue);
}

.message-text code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
}

.message-text pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 8px 0;
}

.message-text pre code {
    background: transparent;
    padding: 0;
}

.message-text ul, .message-text ol {
    padding-left: 20px;
    margin: 8px 0;
}

.message-text li {
    margin: 4px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        width: 280px;
        transform: translateX(-100%);
        z-index: 50;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .mobile-sidebar-toggle {
        display: flex;
    }
    
    .chat-area {
        width: 100%;
    }
    
    .chat-header {
        padding: 16px 20px;
        padding-left: 70px;
    }
    
    .messages-container {
        padding: 20px;
    }
    
    .input-area {
        padding: 16px 20px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .welcome-message {
        padding: 40px 20px;
    }
    
    .quick-questions {
        flex-direction: column;
        align-items: center;
    }
    
    .quick-btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .avatar-wrapper {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
    }
    
    .avatar-wrapper i {
        font-size: 32px;
    }
    
    .welcome-message h3 {
        font-size: 20px;
    }
    
    .message-content {
        padding: 12px 16px;
    }
    
    .message-text {
        font-size: 14px;
    }
}