/* 全局样式重置和基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主要颜色 */
    --primary-color: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --secondary-color: #06b6d4;
    --secondary-light: #67e8f9;
    
    /* 中性色 */
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --surface-dark: #f1f5f9;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* 状态颜色 */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* 圆角 */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* 间距 */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* 头部样式 */
.header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
}

.logo {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.logo:hover {
    transform: translateY(-2px);
    color: var(--primary-dark);
}

.logo i {
    margin-right: var(--spacing-sm);
    font-size: 1.75rem;
    transition: all 0.5s ease;
    animation: logoBreath 3s ease-in-out infinite;
    position: relative;
}

.logo:hover i {
    transform: rotate(360deg) scale(1.1);
    color: var(--secondary-color);
    text-shadow: 0 0 20px rgba(79, 70, 229, 0.5);
}

.logo::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.1), transparent);
    transition: left 0.5s ease;
}

.logo:hover::before {
    left: 100%;
}

/* Logo呼吸动画 */
@keyframes logoBreath {
    0%, 100% { 
        transform: scale(1);
        opacity: 0.9;
    }
    50% { 
        transform: scale(1.05);
        opacity: 1;
    }
}

/* Logo闪烁效果 */
@keyframes logoGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(79, 70, 229, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(79, 70, 229, 0.6), 0 0 30px rgba(6, 182, 212, 0.3);
    }
}

/* Logo点击时的特效 */
.logo:active {
    transform: translateY(0) scale(0.95);
    transition: transform 0.1s ease;
}

.logo:active i {
    animation: logoClick 0.3s ease;
}

@keyframes logoClick {
    0% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

/* Logo加载时的入场动画 */
.logo {
    animation: logoEntrance 1s ease-out;
}

@keyframes logoEntrance {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.8);
    }
    50% {
        opacity: 0.7;
        transform: translateY(5px) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Logo文字的渐变效果 */
.logo span {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.logo:hover span {
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: var(--spacing-xl);
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
}

.header-actions {
    display: flex;
    gap: var(--spacing-md);
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 0.875rem;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: var(--surface-dark);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 主要内容区域 */
.main-content {
    display: flex;
    gap: var(--spacing-xl);
    padding: var(--spacing-xl);
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 200px);
    background: rgba(248, 250, 252, 0.3);
    border-radius: var(--radius-xl);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

/* 侧边栏样式 */
.sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.quick-questions,
.chat-history {
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.quick-questions h3,
.chat-history h3 {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
}

.question-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.quick-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--surface-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    text-align: left;
}

.quick-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.quick-btn i {
    opacity: 0.7;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: var(--spacing-sm);
    color: var(--text-muted);
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: color 0.2s ease;
}

.history-item:hover {
    color: var(--text-secondary);
}

.history-item:last-child {
    border-bottom: none;
}

/* 聊天区域 */
.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

/* 欢迎界面 */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    text-align: center;
}

.welcome-content {
    max-width: 600px;
}

.robot-avatar {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-xl);
    box-shadow: var(--shadow-xl);
}

.robot-avatar i {
    font-size: 3rem;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.welcome-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-content > p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-2xl);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.feature-card {
    padding: var(--spacing-lg);
    background: var(--surface-dark);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.feature-card i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
}

.feature-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.start-hint {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    padding: var(--spacing-xl);
    overflow-y: auto;
    display: none;
}

.chat-messages.active {
    display: block;
}

.message {
    display: flex;
    margin-bottom: var(--spacing-lg);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    position: relative;
    word-wrap: break-word;
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-bottom-right-radius: var(--spacing-sm);
}

.message.bot .message-content {
    background: var(--surface-dark);
    color: var(--text-primary);
    border-bottom-left-radius: var(--spacing-sm);
    border: 1px solid var(--border-color);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 var(--spacing-md);
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    color: white;
    order: 1;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-light));
    color: white;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
    text-align: right;
}

.message.bot .message-time {
    text-align: left;
}

/* 输入区域 */
.chat-input-section {
    padding: var(--spacing-xl);
    background: var(--surface-dark);
    border-top: 1px solid var(--border-color);
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: var(--spacing-sm);
    transition: border-color 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#messageInput {
    flex: 1;
    border: none;
    outline: none;
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 1rem;
    color: var(--text-primary);
    background: transparent;
}

#messageInput::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-sm);
    padding: 0 var(--spacing-lg);
}

.char-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.typing-indicator {
    font-size: 0.875rem;
    color: var(--primary-color);
    display: none;
}

.typing-indicator.active {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* 底部样式 */
.footer {
    background: #0f172a;
    color: rgba(255, 255, 255, 0.8);
    margin-top: auto;
    box-shadow: 0 -1px 3px 0 rgb(0 0 0 / 0.1);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
    padding: var(--spacing-2xl) 0;
}

.footer-section h4 {
    color: white;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
}

.social-links {
    display: flex;
    gap: var(--spacing-md);
}

.social-links a {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
}

.social-links a:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.footer-bottom {
    text-align: center;
    padding: var(--spacing-lg) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.875rem;
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    color: var(--primary-light);
}

.loading-spinner p {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        padding: var(--spacing-lg);
    }
    
    .sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .quick-questions,
    .chat-history {
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .nav {
        order: -1;
    }
    
    .sidebar {
        flex-direction: column;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .welcome-content h1 {
        font-size: 2rem;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .main-content {
        padding: var(--spacing-md);
        gap: var(--spacing-lg);
    }
    
    .welcome-content h1 {
        font-size: 1.75rem;
    }
    
    .robot-avatar {
        width: 100px;
        height: 100px;
    }
    
    .robot-avatar i {
        font-size: 2.5rem;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--surface-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 选择文本样式 */
::selection {
    background: rgba(79, 70, 229, 0.2);
}

/* 焦点样式 */
button:focus,
input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 过渡动画 */
* {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
