/* ==================== 全局样式 ==================== */

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #f1f5f9;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --bg: #ffffff;
    --bg-alt: #f8fafc;
    --success: #10b981;
    --error: #ef4444;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 16px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ==================== 按钮 ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

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

.btn-large {
    padding: 16px 32px;
    font-size: 17px;
    border-radius: var(--radius-lg);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-full {
    width: 100%;
}

/* ==================== 导航栏 ==================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 20px;
}

.logo-icon {
    font-size: 28px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a:not(.btn) {
    color: var(--text-light);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:not(.btn):hover {
    color: var(--primary);
}

/* ==================== Hero ==================== */

.hero {
    padding: 160px 0 100px;
    background: linear-gradient(180deg, var(--bg-alt) 0%, var(--bg) 100%);
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-content h1 {
    font-size: 56px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 24px;
}

.hero-content .highlight {
    color: var(--primary);
    position: relative;
}

.hero-content .highlight::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 0;
    right: 0;
    height: 8px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 4px;
    z-index: -1;
}

.subtitle {
    font-size: 20px;
    color: var(--text-light);
    margin-bottom: 32px;
}

.hero-actions {
    display: flex;
    gap: 16px;
}

/* 聊天预览 */
.chat-preview {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.chat-message {
    margin-bottom: 16px;
    padding: 16px;
    border-radius: var(--radius);
}

.chat-message.user {
    background: var(--primary);
    color: white;
    margin-left: 40px;
}

.chat-message.assistant {
    background: var(--secondary);
    margin-right: 40px;
}

.chat-message.assistant ul {
    margin: 12px 0;
    padding-left: 20px;
}

.chat-message .source {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-light);
}

/* ==================== 功能区域 ==================== */

.features {
    padding: 100px 0;
}

.features h2 {
    text-align: center;
    font-size: 40px;
    margin-bottom: 60px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.feature-card {
    padding: 32px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.3s;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.feature-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.feature-card h3 {
    font-size: 20px;
    margin-bottom: 12px;
}

.feature-card p {
    color: var(--text-light);
    font-size: 15px;
}

/* ==================== 使用场景 ==================== */

.scenarios {
    padding: 100px 0;
    background: var(--bg-alt);
}

.scenarios h2 {
    text-align: center;
    font-size: 40px;
    margin-bottom: 60px;
}

.scenarios-list {
    max-width: 800px;
    margin: 0 auto;
}

.scenario {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    padding: 24px;
    background: var(--bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.scenario-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
    opacity: 0.3;
}

.scenario-content h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.scenario-content p {
    color: var(--text-light);
}

/* ==================== 关于 ==================== */

.about {
    padding: 100px 0;
    text-align: center;
}

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

.about p {
    max-width: 600px;
    margin: 0 auto 32px;
    color: var(--text-light);
    font-size: 18px;
}

.about-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.about-item {
    padding: 24px;
    background: var(--bg-alt);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.about-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.about-item h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text);
}

.about-item p {
    font-size: 14px;
    color: var(--text-light);
    margin: 0;
}

/* 新的使用场景网格布局 */
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.scenario-card {
    padding: 32px;
    background: var(--bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.scenario-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.scenario-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.scenario-card h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.scenario-card ul {
    list-style: none;
    padding: 0;
}

.scenario-card li {
    padding: 6px 0;
    color: var(--text-light);
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.scenario-card li:last-child {
    border-bottom: none;
}

/* 配额信息显示 */
.quota-info {
    margin: 12px 0;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.quota-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
}

.quota-item:last-child {
    margin-bottom: 0;
}

.quota-label {
    color: var(--text-light);
}

.quota-value {
    font-weight: 600;
    color: var(--primary);
}

/* ==================== CTA ==================== */

.cta {
    padding: 100px 0;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    color: white;
    text-align: center;
}

.cta h2 {
    font-size: 36px;
    margin-bottom: 16px;
}

.cta p {
    opacity: 0.9;
    margin-bottom: 32px;
}

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

.cta .btn-primary:hover {
    background: var(--bg-alt);
}

/* ==================== 页脚 ==================== */

.footer {
    padding: 60px 0 30px;
    background: var(--text);
    color: var(--secondary);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
}

.footer-brand .logo-icon,
.footer-brand .logo-text {
    color: white;
}

.footer-brand p {
    margin-top: 8px;
    font-size: 14px;
}

.footer-links {
    display: flex;
    gap: 60px;
}

.footer-section h4 {
    color: white;
    margin-bottom: 16px;
}

.footer-section a {
    display: block;
    color: var(--secondary);
    font-size: 14px;
    margin-bottom: 8px;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 14px;
}

/* ==================== 认证页面 ==================== */

.auth-page {
    background: linear-gradient(135deg, var(--bg-alt) 0%, var(--bg) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.auth-card {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}

.auth-card h1 {
    font-size: 28px;
    text-align: center;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 32px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    transition: all 0.2s;
}

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

.auth-footer {
    margin-top: 24px;
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* ==================== 聊天页面 ==================== */

.chat-page {
    height: 100vh;
    overflow: hidden;
}

.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 100vh;
}

/* 侧边栏 */
.chat-sidebar {
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

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

.knowledge-panel {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.knowledge-panel h3 {
    font-size: 16px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.upload-section {
    margin-bottom: 16px;
    flex-shrink: 0;
}

.document-list-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    margin-top: 8px;
}

.document-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.report-panel {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    max-height: 250px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.report-panel .panel-header {
    flex-shrink: 0;
    margin-bottom: 10px;
}

.report-panel .panel-header h3 {
    font-size: 16px;
    margin: 0;
}

#report-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    margin-bottom: 8px;
}

.knowledge-panel h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.upload-section {
    margin-bottom: 16px;
}

.document-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 13px;
}

.document-item.indexed {
    border: 1px solid var(--success);
}

.document-item.indexing {
    border: 1px solid var(--border);
    opacity: 0.7;
}

.doc-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-delete {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
}

.doc-delete:hover {
    color: var(--error);
}

.empty-hint {
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    padding: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-alt);
}

.user-info {
    margin-bottom: 12px;
    font-weight: 500;
}

/* 主聊天区 */
.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    height: 100vh;
    overflow: hidden;
}

.chat-header {
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 44px;
}

.chat-header-left {
    display: flex;
    align-items: center;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: row;
}

.header-username {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.header-divider {
    color: var(--border);
    font-size: 12px;
}

.header-quota {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
}

.header-logout {
    background: transparent;
    border: none;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.header-logout:hover {
    color: var(--error);
    background: var(--bg-alt);
}

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

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease;
}

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: var(--secondary);
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--primary);
}

.message-content {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    background: var(--secondary);
}

.message.user .message-content {
    background: var(--primary);
    color: white;
}

.message-content p {
    margin-bottom: 8px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.example-questions {
    margin-top: 12px;
    padding-left: 0;
    list-style: none;
}

.example-questions li {
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.example-questions li:hover {
    background: var(--primary);
    color: white;
}

.system-notice {
    padding: 12px 16px;
    background: var(--secondary);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-light);
    text-align: center;
}

/* 输入区域 - 固定在底部 */
.chat-input-area {
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

.input-options {
    margin-bottom: 12px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-light);
    cursor: pointer;
}

.input-wrapper {
    display: flex;
    gap: 12px;
}

.input-wrapper textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 15px;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
}

.input-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* ==================== 响应式 ==================== */

@media (max-width: 1024px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero .container {
        grid-template-columns: 1fr;
    }
    
    .hero-visual {
        display: none;
    }
}

@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-links a:not(.btn) {
        display: none;
    }
    
    .chat-layout {
        grid-template-columns: 1fr;
    }
    
    .chat-sidebar {
        display: none;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 40px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 30px;
    }
}