/* 智教AI - 现代化界面样式 */

/* CSS变量定义 - 基于UI设计指导 */
:root {
    /* 主色调 */
    --color-primary-blue: #2563EB;
    --color-primary-blue-hover: #1D4ED8;
    --color-primary-blue-light: #3B82F6;
    --color-accent-purple: #7C3AED;
    --color-accent-purple-hover: #6D28D9;
    --color-accent-purple-light: #A78BFA;

    /* 中性色 */
    --color-neutral-bg: #F8FAFC;
    --color-neutral-bg-alt: #F0F4F8;
    --color-card-bg: #FFFFFF;
    --color-border-light: #E5E7EB;
    --color-border-medium: #D1D5DB;

    /* 文字颜色 */
    --color-text-dark: #1F2937;
    --color-text-medium: #4B5563;
    --color-text-light: #6B7280;
    --color-text-muted: #9CA3AF;

    /* 状态色 */
    --color-success: #10B981;
    --color-success-bg: #ECFDF5;
    --color-success-text: #047857;
    --color-warning: #F97316;
    --color-warning-bg: #FFF7ED;
    --color-warning-text: #B45309;
    --color-error: #EF4444;
    --color-error-bg: #FEF2F2;
    --color-error-text: #B91C1C;
    --color-info-bg: #EFF6FF;
    --color-info-text: #1E40AF;

    /* 渐变色 */
    --gradient-primary: linear-gradient(135deg, var(--color-primary-blue) 0%, var(--color-accent-purple) 100%);
    --gradient-light: linear-gradient(135deg, var(--color-info-bg) 0%, #EDE9FE 100%);

    /* 阴影 */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* 圆角 */
    --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;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background: var(--color-neutral-bg);
    color: var(--color-text-medium);
    line-height: 1.5;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* 高科技背景粒子效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(37, 99, 235, 0.02) 0%, transparent 50%);
    z-index: -2;
    animation: float 20s ease-in-out infinite;
}

/* 网格背景效果 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    opacity: 0.5;
}

/* 顶部导航栏 */
.top-navbar {
    background: var(--color-card-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border-light);
    padding: var(--spacing-md) var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease-in-out;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.nav-brand i {
    font-size: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-brand span {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-dark);
}

.nav-brand small {
    font-size: 0.75rem;
    color: var(--color-text-light);
    margin-left: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-info-bg);
    border-radius: var(--radius-full);
    font-weight: 500;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-btn {
    background: var(--color-primary-blue);
    color: white;
    border: none;
    padding: 0.625rem var(--spacing-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.nav-btn:hover {
    background: var(--color-primary-blue-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* 侧边栏 */
.sidebar {
    position: fixed;
    top: 80px;
    left: 0;
    width: 280px;
    height: calc(100vh - 80px);
    background: var(--color-card-bg);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--color-border-light);
    padding: var(--spacing-lg);
    overflow-y: auto;
    z-index: 999;
    box-shadow: var(--shadow-sm);
}

.sidebar-header h3 {
    color: var(--color-text-dark);
    font-size: 1.1rem;
    margin-bottom: var(--spacing-md);
    font-weight: 600;
}

.sidebar-nav {
    margin-bottom: var(--spacing-xl);
    position: relative;
}

/* 导航背景光效 */
.sidebar-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: -10px;
    right: -10px;
    bottom: 0;
    background: linear-gradient(180deg,
        rgba(37, 99, 235, 0.02) 0%,
        rgba(124, 58, 237, 0.02) 50%,
        rgba(37, 99, 235, 0.02) 100%
    );
    border-radius: var(--radius-lg);
    z-index: -1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem var(--spacing-md);
    color: var(--color-text-light);
    text-decoration: none;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

/* 导航项光效 */
.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(37, 99, 235, 0.1),
        transparent
    );
    transition: left 0.6s ease;
}

.nav-item:hover::before {
    left: 100%;
}

.nav-item:hover {
    background: var(--color-info-bg);
    color: var(--color-primary-blue);
    transform: translateX(4px) scale(1.02);
    border-color: rgba(37, 99, 235, 0.2);
    box-shadow:
        var(--shadow-sm),
        0 0 15px rgba(37, 99, 235, 0.1);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow:
        var(--shadow-md),
        0 0 20px rgba(37, 99, 235, 0.4);
    border-color: var(--color-primary-blue);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 1) 50%,
        rgba(255, 255, 255, 0.8) 100%
    );
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.nav-item:hover i {
    transform: scale(1.1);
}

.nav-item.active i {
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* 侧边栏状态和建议 */
.sidebar-status, .sidebar-suggestions, .sidebar-recent {
    margin-bottom: var(--spacing-lg);
}

.sidebar-status h4, .sidebar-suggestions h4, .sidebar-recent h4 {
    font-size: 0.875rem;
    color: var(--color-text-dark);
    margin-bottom: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-item, .suggestion-item, .recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    font-size: 0.8rem;
    color: var(--color-text-light);
    border-bottom: 1px solid var(--color-border-light);
    transition: all 0.2s ease-in-out;
}

.status-item:hover, .suggestion-item:hover, .recent-item:hover {
    color: var(--color-text-medium);
    padding-left: var(--spacing-xs);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-warning);
    animation: pulse 2s infinite;
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
}

.status-indicator.processing {
    background: var(--color-primary-blue);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
}

.status-indicator.success {
    background: var(--color-success);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: none;
}

@keyframes pulse {
    0% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
    }
    70% {
        opacity: 0.7;
        box-shadow: 0 0 0 10px rgba(249, 115, 22, 0);
    }
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
    }
}

/* 主内容区域 */
.main-content {
    margin-left: 280px;
    margin-top: 80px;
    padding: var(--spacing-xl);
    min-height: calc(100vh - 80px);
}

.container {
    max-width: none;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.section {
    background: var(--color-card-bg);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
    transition: all 0.2s ease-in-out;
}

.section:hover {
    box-shadow: var(--shadow-md);
}

/* 通用样式 */
.hidden {
    display: none !important;
}

h1, h2, h3, h4, h5, h6 {
    color: #333;
    font-weight: 600;
}

/* 按钮样式 */
button, .btn {
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.625rem var(--spacing-md);
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    text-decoration: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.primary-btn {
    background: var(--color-primary-blue);
    color: white;
    box-shadow: var(--shadow-sm);
}

.primary-btn:hover {
    background: var(--color-primary-blue-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.primary-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.secondary-btn {
    background: var(--color-card-bg);
    color: var(--color-primary-blue);
    border: 1px solid var(--color-border-medium);
}

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

.control-btn {
    background: var(--color-card-bg);
    color: var(--color-text-medium);
    border: 1px solid var(--color-border-light);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.8rem;
}

.control-btn:hover {
    background: var(--color-info-bg);
    color: var(--color-primary-blue);
    border-color: var(--color-border-medium);
}

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

.control-btn.primary:hover {
    background: var(--color-primary-blue-hover);
    border-color: var(--color-primary-blue-hover);
}

.danger-btn, .control-btn.danger {
    background: var(--color-error);
    color: white;
    border-color: var(--color-error);
}

.danger-btn:hover, .control-btn.danger:hover {
    background: #DC2626;
    border-color: #DC2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

button:disabled, .btn:disabled {
    background: var(--color-border-light);
    color: var(--color-text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: var(--color-border-light);
}

/* 表单样式 */
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="number"], input[type="range"],
select, textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--color-border-medium);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--color-card-bg);
    color: var(--color-text-dark);
    transition: all 0.2s ease-in-out;
    outline: none;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--color-primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

input:hover, select:hover, textarea:hover {
    border-color: var(--color-border-medium);
}

input::placeholder, textarea::placeholder {
    color: var(--color-text-muted);
}

.input-group {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-end;
}

.input-group input {
    flex: 1;
}

/* 特殊输入框样式 */
.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.search-box input {
    padding-left: 2.5rem;
}

.search-box .clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease-in-out;
}

.search-box .clear-btn:hover {
    background: var(--color-border-light);
    color: var(--color-text-medium);
}

/* 卡片样式 */
.card {
    background: var(--color-card-bg);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
    transition: all 0.2s ease-in-out;
}

.card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-medium);
}

/* 登录卡片 */
.login-card {
    max-width: 400px;
    margin: var(--spacing-xl) auto;
    text-align: center;
    background: var(--color-card-bg);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border-light);
}

.login-card h2 {
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-dark);
    font-weight: 700;
    font-size: 1.5rem;
}

.login-card p {
    color: var(--color-text-light);
    margin-bottom: var(--spacing-xl);
    line-height: 1.6;
}

.login-card i {
    color: var(--color-primary-blue);
    margin-right: var(--spacing-sm);
}

/* AI助理工作台样式 - 高科技风格 */
.workspace-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    position: relative;
    padding: var(--spacing-2xl) 0;
}

/* 标题背景光效 */
.workspace-header::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle,
        rgba(37, 99, 235, 0.1) 0%,
        rgba(124, 58, 237, 0.05) 50%,
        transparent 100%
    );
    border-radius: 50%;
    filter: blur(40px);
    z-index: -1;
    animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.workspace-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: var(--spacing-md);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    letter-spacing: -0.02em;
    text-shadow: 0 0 30px rgba(37, 99, 235, 0.3);
}

/* 标题装饰线 */
.workspace-header h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

.workspace-header p {
    color: var(--color-text-medium);
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.9;
}

/* 模式选择卡片 - 高科技风格 */
.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-2xl);
}

.mode-card {
    background: var(--color-card-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--color-border-light);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* 高科技光效背景 */
.mode-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg at 50% 50%,
        transparent 0deg,
        rgba(37, 99, 235, 0.1) 60deg,
        rgba(124, 58, 237, 0.1) 120deg,
        transparent 180deg,
        rgba(37, 99, 235, 0.05) 240deg,
        rgba(124, 58, 237, 0.05) 300deg,
        transparent 360deg
    );
    opacity: 0;
    transition: all 0.6s ease;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mode-card:hover::before {
    opacity: 1;
}

/* 边框光效 */
.mode-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-xl);
    padding: 1px;
    background: linear-gradient(135deg,
        var(--color-primary-blue),
        var(--color-accent-purple),
        var(--color-primary-blue-light)
    );
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: xor;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mode-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow:
        var(--shadow-xl),
        0 0 40px rgba(37, 99, 235, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.mode-card:hover::after {
    opacity: 1;
}

.mode-card.active {
    border-color: var(--color-primary-blue);
    background: linear-gradient(135deg,
        var(--color-info-bg) 0%,
        rgba(124, 58, 237, 0.05) 100%
    );
    box-shadow:
        var(--shadow-lg),
        0 0 30px rgba(37, 99, 235, 0.3);
}

.mode-card.active::after {
    opacity: 1;
}

.mode-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    box-shadow:
        var(--shadow-lg),
        0 0 20px rgba(37, 99, 235, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 图标外圈光环效果 */
.mode-icon::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: linear-gradient(45deg,
        var(--color-primary-blue),
        var(--color-accent-purple),
        var(--color-primary-blue-light),
        var(--color-accent-purple-light)
    );
    opacity: 0;
    transition: all 0.3s ease;
    z-index: -1;
    filter: blur(8px);
}

.mode-card:hover .mode-icon::before {
    opacity: 0.6;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
}

.mode-card:hover .mode-icon {
    transform: scale(1.1) rotateY(10deg);
    box-shadow:
        var(--shadow-xl),
        0 0 30px rgba(37, 99, 235, 0.6),
        inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.mode-card.active .mode-icon {
    transform: scale(1.05);
    box-shadow:
        var(--shadow-lg),
        0 0 25px rgba(37, 99, 235, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.mode-card.active .mode-icon::before {
    opacity: 0.4;
}

.mode-icon i {
    font-size: 2rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.mode-card:hover .mode-icon i {
    transform: scale(1.1);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.mode-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-dark);
    position: relative;
    z-index: 2;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.mode-card:hover h3 {
    transform: translateY(-2px);
    text-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.mode-card p {
    color: var(--color-text-medium);
    margin-bottom: var(--spacing-lg);
    position: relative;
    z-index: 2;
    line-height: 1.6;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.mode-card:hover p {
    color: var(--color-text-dark);
    transform: translateY(-1px);
}

.mode-features {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    justify-content: center;
    position: relative;
    z-index: 2;
}

.feature-tag {
    background: linear-gradient(135deg,
        rgba(37, 99, 235, 0.1) 0%,
        rgba(124, 58, 237, 0.1) 100%
    );
    color: var(--color-primary-blue);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(37, 99, 235, 0.2);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* 标签光效 */
.feature-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transition: left 0.6s ease;
}

.mode-card:hover .feature-tag::before {
    left: 100%;
}

.feature-tag:hover {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--color-primary-blue);
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        var(--shadow-md),
        0 0 15px rgba(37, 99, 235, 0.4);
}

.mode-card.active .feature-tag {
    background: linear-gradient(135deg,
        rgba(37, 99, 235, 0.2) 0%,
        rgba(124, 58, 237, 0.2) 100%
    );
    border-color: var(--color-primary-blue);
    color: var(--color-primary-blue);
    font-weight: 700;
}

/* 不同模式的专属颜色主题 */
.mode-card[data-mode="teaching"] {
    --mode-color: #10B981;
    --mode-color-light: rgba(16, 185, 129, 0.1);
    --mode-color-medium: rgba(16, 185, 129, 0.2);
}

.mode-card[data-mode="dialogue"] {
    --mode-color: #3B82F6;
    --mode-color-light: rgba(59, 130, 246, 0.1);
    --mode-color-medium: rgba(59, 130, 246, 0.2);
}

.mode-card[data-mode="analysis"] {
    --mode-color: #8B5CF6;
    --mode-color-light: rgba(139, 92, 246, 0.1);
    --mode-color-medium: rgba(139, 92, 246, 0.2);
}

.mode-card[data-mode="practice"] {
    --mode-color: #F59E0B;
    --mode-color-light: rgba(245, 158, 11, 0.1);
    --mode-color-medium: rgba(245, 158, 11, 0.2);
}

.mode-card[data-mode="review"] {
    --mode-color: #EF4444;
    --mode-color-light: rgba(239, 68, 68, 0.1);
    --mode-color-medium: rgba(239, 68, 68, 0.2);
}

/* 应用专属颜色 */
.mode-card[data-mode]:hover .mode-icon {
    background: linear-gradient(135deg, var(--mode-color), var(--color-accent-purple));
    box-shadow:
        var(--shadow-xl),
        0 0 30px var(--mode-color-medium);
}

.mode-card[data-mode].active {
    border-color: var(--mode-color);
    background: linear-gradient(135deg, var(--mode-color-light), var(--color-info-bg));
    box-shadow:
        var(--shadow-lg),
        0 0 30px var(--mode-color-medium);
}

.mode-card[data-mode].active .mode-icon {
    background: linear-gradient(135deg, var(--mode-color), var(--color-accent-purple));
}

.mode-card[data-mode].active .feature-tag {
    background: var(--mode-color-light);
    border-color: var(--mode-color);
    color: var(--mode-color);
}

.mode-card[data-mode]:hover .feature-tag:hover {
    background: var(--mode-color);
    border-color: var(--mode-color);
}

.workspace-actions {
    text-align: center;
}

/* 状态消息 */
.status-message {
    position: fixed;
    top: 100px;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.status-message.show {
    transform: translateX(0);
}

.status-success {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.status-error {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.status-info {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

/* 知识库中心样式 */
.knowledge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.knowledge-header h2 {
    font-size: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.knowledge-header p {
    color: #666;
    margin: 0.5rem 0;
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    font-size: 1.25rem;
    color: white;
}

.stat-info h3 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 0.25rem;
}

.stat-info p {
    color: #666;
    font-size: 0.875rem;
}

/* 知识库控制面板 */
.knowledge-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.search-bar {
    flex: 1;
    position: relative;
}

.search-bar i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

.search-bar input {
    padding-left: 2.5rem;
}

.filter-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* 文档网格 */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.document-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.document-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.document-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.document-type-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.document-type-icon i {
    color: white;
    font-size: 1.1rem;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.document-meta {
    font-size: 0.8rem;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.document-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.document-card:hover .document-actions {
    opacity: 1;
}

.action-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 0.25rem;
}

.action-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    color: #667eea;
}

/* 聊天界面样式 */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-title h2 {
    font-size: 1.5rem;
    color: #333;
}

.mode-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mode-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: pulse 2s infinite;
}

.chat-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.advanced-search-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #667eea;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.875rem;
    color: #666;
}

/* 模式提示信息 */
.mode-prompt-info {
    margin-bottom: 1.5rem;
}

.prompt-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid #667eea;
}

.prompt-card h4 {
    color: #667eea;
    margin-bottom: 0.5rem;
}

.prompt-card p {
    color: #666;
    margin: 0;
}

/* 聊天容器 */
.chat-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    height: calc(100vh - 200px); /* 固定高度，减去顶部导航等空间 */
    max-height: 800px;
    min-height: 500px;
}

.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%; /* 确保占满容器高度 */
}

.chat-window {
    flex: 1;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-y: auto;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* 确保聊天窗口有固定的最大高度并可滚动 */
    max-height: calc(100% - 120px); /* 减去输入区域的高度 */
    min-height: 300px;
}

/* 欢迎消息 */
.welcome-message {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-avatar i {
    color: white;
    font-size: 1.1rem;
}

.welcome-content h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

.welcome-content p {
    color: #666;
    margin-bottom: 1rem;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.quick-btn {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
}

/* 聊天消息样式 */
.chat-message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.3s ease;
}

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

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

.message-avatar.ai {
    background: var(--color-card-bg);
    color: var(--color-primary-blue);
    border: 2px solid var(--color-primary-blue);
}

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

.message-bubble {
    background: var(--color-card-bg);
    border-radius: var(--radius-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
    position: relative;
    max-width: 70%;
    line-height: 1.6;
    word-wrap: break-word;
}

.chat-message.user .message-bubble {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    border-bottom-right-radius: var(--radius-sm);
}

.chat-message.ai .message-bubble {
    background: var(--color-card-bg);
    color: var(--color-text-dark);
    border-color: var(--color-border-light);
    border-bottom-left-radius: var(--radius-sm);
}

.message-time {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.5rem;
}

/* 临时消息样式（正在思考） */
.chat-message.temporary {
    opacity: 0.8;
}

.chat-message.temporary .message-bubble {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    color: #666;
    font-style: italic;
}

.chat-message.temporary .message-avatar.ai {
    animation: pulse 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* 聊天输入区域 */
.chat-input-area {
    background: var(--color-card-bg);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    border: 1px solid var(--color-border-light);
    box-shadow: var(--shadow-sm);
    /* 固定在底部，不随内容增长 */
    flex-shrink: 0;
    min-height: 100px;
    max-height: 150px;
}

/* 上下文状态指示器 */
.context-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: linear-gradient(135deg, var(--color-success-bg) 0%, var(--color-info-bg) 100%);
    border: 1px solid var(--color-success);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-md);
    font-size: 0.875rem;
    color: var(--color-success-text);
    transition: all 0.3s ease;
}

.context-indicator i {
    color: var(--color-success);
    animation: pulse-context 2s ease-in-out infinite;
}

.context-indicator small {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    margin-left: auto;
}

.context-indicator.hidden {
    display: none;
}

@keyframes pulse-context {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

.input-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.input-container textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    resize: none;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.4;
}

.input-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.action-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
    color: #667eea;
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--color-primary-blue);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: var(--shadow-sm);
}

.send-btn:hover {
    background: var(--color-primary-blue-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.send-btn:disabled {
    background: var(--color-border-light);
    color: var(--color-text-muted);
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

/* 高科技动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(37, 99, 235, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(37, 99, 235, 0.6);
    }
}

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

/* 页面加载动画 */
.mode-card {
    animation: scaleIn 0.6s ease-out;
}

.mode-card:nth-child(1) { animation-delay: 0.1s; }
.mode-card:nth-child(2) { animation-delay: 0.2s; }
.mode-card:nth-child(3) { animation-delay: 0.3s; }
.mode-card:nth-child(4) { animation-delay: 0.4s; }
.mode-card:nth-child(5) { animation-delay: 0.5s; }

.nav-item {
    animation: slideInFromLeft 0.4s ease-out;
}

.nav-item:nth-child(1) { animation-delay: 0.1s; }
.nav-item:nth-child(2) { animation-delay: 0.2s; }
.nav-item:nth-child(3) { animation-delay: 0.3s; }
.nav-item:nth-child(4) { animation-delay: 0.4s; }
.nav-item:nth-child(5) { animation-delay: 0.5s; }

.status-available {
    background-color: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid var(--color-success);
}

.status-processing {
    background-color: var(--color-warning-bg);
    color: var(--color-warning-text);
    border: 1px solid var(--color-warning);
}

.status-error {
    background-color: var(--color-error-bg);
    color: var(--color-error-text);
    border: 1px solid var(--color-error);
}

.status-success {
    background-color: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid var(--color-success);
}

.document-actions {
    display: flex;
    gap: 5px;
}

.small-btn {
    padding: 5px 10px;
    font-size: 12px;
    min-width: auto;
}

.loading {
    text-align: center;
    color: var(--color-text-light);
    font-style: italic;
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
}

.loading::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border-light);
    border-top: 2px solid var(--color-primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    color: var(--color-text-light);
    padding: var(--spacing-2xl);
    background: var(--color-neutral-bg-alt);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--color-border-light);
}

.empty-state i {
    font-size: 2rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
    display: block;
}

/* 代码块和语法高亮样式 */
.chat-message .bubble pre {
    background-color: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    margin: 10px 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.45;
}

.chat-message .bubble code {
    background-color: rgba(175, 184, 193, 0.2);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 85%;
}

.chat-message .bubble pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

/* Markdown样式 */
.chat-message .bubble h1,
.chat-message .bubble h2,
.chat-message .bubble h3,
.chat-message .bubble h4,
.chat-message .bubble h5,
.chat-message .bubble h6 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.25;
}

.chat-message .bubble h1 { font-size: 1.5em; border-bottom: 1px solid #eaecef; padding-bottom: 8px; }
.chat-message .bubble h2 { font-size: 1.3em; border-bottom: 1px solid #eaecef; padding-bottom: 6px; }
.chat-message .bubble h3 { font-size: 1.2em; }
.chat-message .bubble h4 { font-size: 1.1em; }
.chat-message .bubble h5 { font-size: 1em; }
.chat-message .bubble h6 { font-size: 0.9em; color: #6a737d; }

.chat-message .bubble blockquote {
    padding: 0 16px;
    margin: 0;
    color: #6a737d;
    border-left: 4px solid #dfe2e5;
}

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

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

.chat-message .bubble table {
    border-collapse: collapse;
    margin: 16px 0;
    width: 100%;
}

.chat-message .bubble th,
.chat-message .bubble td {
    border: 1px solid #dfe2e5;
    padding: 8px 12px;
    text-align: left;
}

.chat-message .bubble th {
    background-color: #f6f8fa;
    font-weight: 600;
}

.chat-message .bubble strong {
    font-weight: 600;
}

.chat-message .bubble em {
    font-style: italic;
}

.chat-message .bubble a {
    color: #0366d6;
    text-decoration: none;
}

.chat-message .bubble a:hover {
    text-decoration: underline;
}

/* 数学公式样式 */
.chat-message .bubble .katex {
    font-size: 1.1em;
}

.chat-message .bubble .katex-display {
    margin: 16px 0;
    text-align: center;
}

/* 聊天头部控制区域 */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.chat-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-btn {
    background-color: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.control-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* 高级检索开关 */
.advanced-search-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #3f51b5;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

/* 高级检索信息卡片 */
.advanced-search-info {
    margin-bottom: 20px;
}

.info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.info-card h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.info-card p {
    margin: 0 0 12px 0;
    font-size: 14px;
    line-height: 1.5;
    opacity: 0.9;
}

.search-strategy {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.strategy-tag {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* 模态框样式 */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    color: #1a237e;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.close-btn:hover {
    background-color: #e9ecef;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* 历史记录列表 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-lg);
    background-color: var(--color-card-bg);
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

.history-item:hover {
    border-color: var(--color-primary-blue);
    background-color: var(--color-info-bg);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.history-item.selected {
    border-color: var(--color-primary-blue);
    background: linear-gradient(135deg, var(--color-info-bg) 0%, var(--color-card-bg) 100%);
    box-shadow: var(--shadow-md);
}

.history-content {
    flex: 1;
    padding: 16px;
    cursor: pointer;
}

.history-actions {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.delete-conversation-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    font-size: 16px;
    transition: background-color 0.3s;
    color: #666;
}

.delete-conversation-btn:hover {
    background-color: #ffebee;
    color: #d32f2f;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-title {
    font-weight: 600;
    color: var(--color-text-dark);
    font-size: 0.875rem;
    margin: 0;
}

.history-time {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

.history-mode {
    font-size: 0.6875rem;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-full);
    background: var(--color-primary-blue);
    color: white;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-preview {
    font-size: 13px;
    color: #555;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-stats {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 11px;
    color: #888;
    align-items: center;
}

.advanced-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 500;
}

.standard-tag {
    background-color: #f0f0f0;
    color: #666;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 500;
}

/* 文档选择容器 */
.document-selection-container {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.selection-mode-panel {
    margin-bottom: 20px;
}

.mode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.mode-header h3 {
    margin: 0;
    color: #495057;
    font-size: 18px;
}

.mode-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* AI选择模式 */
.ai-selection-mode {
    padding: 16px;
    background-color: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.ai-features {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.feature-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* 手动选择模式 */
.manual-selection-mode {
    padding: 16px;
    background-color: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.manual-controls {
    width: 100%;
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.control-header h4 {
    margin: 0;
    color: #495057;
    font-size: 16px;
}

.selection-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-btn.small {
    padding: 6px 12px;
    font-size: 12px;
}

.control-btn.primary {
    background-color: #3f51b5;
    color: white;
    border-color: #3f51b5;
}

.control-btn.primary:hover {
    background-color: #303f9f;
    border-color: #303f9f;
}

.primary-btn {
    background-color: #3f51b5;
    color: white;
    border: 1px solid #3f51b5;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.primary-btn:hover {
    background-color: #303f9f;
    border-color: #303f9f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(63, 81, 181, 0.3);
}

.primary-btn:disabled {
    background-color: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 选择操作面板 */
.selection-actions-panel {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

/* 历史记录容器 */
.history-container {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.history-stats-summary {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #495057;
}

.history-controls {
    display: flex;
    gap: 12px;
}

/* 当前选择信息 */
.current-selection-info {
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
}

.selection-summary {
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-text {
    font-size: 14px;
    color: #1976d2;
    font-weight: 500;
}

#current-selection-text {
    font-weight: 600;
    color: #0d47a1;
}

/* AI推荐结果显示 */
.ai-recommendation-result {
    margin-top: 16px;
}

.recommendation-card {
    background-color: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    padding: 16px;
}

.recommendation-card h5 {
    margin: 0 0 12px 0;
    color: #2e7d32;
    font-size: 16px;
}

.recommendation-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recommendation-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.recommendation-item .label {
    font-weight: 600;
    color: #1b5e20;
    min-width: 80px;
    flex-shrink: 0;
}

.recommendation-item .value {
    color: #2e7d32;
    flex: 1;
    word-break: break-word;
}

.recommendation-item .value.loading {
    color: #666;
    font-style: italic;
}

/* AI预览功能 */
.ai-preview-section {
    margin-top: 16px;
    padding: 16px;
    background-color: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.preview-header h5 {
    margin: 0 0 8px 0;
    color: #495057;
    font-size: 16px;
}

.preview-header p {
    margin: 0 0 12px 0;
    color: #6c757d;
    font-size: 14px;
}

.preview-input-area {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.preview-input-area textarea {
    flex: 1;
    min-height: 60px;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
}

.preview-input-area textarea:focus {
    outline: none;
    border-color: #3f51b5;
    box-shadow: 0 0 0 2px rgba(63, 81, 181, 0.1);
}

/* 引用符号样式 */
.citation-ref {
    display: inline-block;
    background: linear-gradient(135deg, #3f51b5 0%, #303f9f 100%);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin: 0 2px;
    transition: all 0.3s;
    text-decoration: none;
    vertical-align: super;
    line-height: 1;
}

.citation-ref:hover {
    background: linear-gradient(135deg, #303f9f 0%, #1a237e 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(63, 81, 181, 0.3);
}

.citation-ref.highlighted {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4);
    animation: pulse 2s infinite;
}

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

/* 未登录时的引用符号样式 */
.citation-ref-disabled {
    display: inline-block;
    background: #e0e0e0;
    color: #757575;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 500;
    margin: 0 1px;
    cursor: not-allowed;
    text-decoration: none;
    vertical-align: super;
    line-height: 1;
    opacity: 0.7;
}

/* 引文浮窗样式 */
.citation-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.citation-content {
    background-color: white;
    border-radius: 12px;
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: citationFadeIn 0.3s ease-out;
}

@keyframes citationFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.citation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #3f51b5 0%, #303f9f 100%);
    color: white;
}

.citation-title {
    font-size: 18px;
    font-weight: 600;
}

.citation-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.citation-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.citation-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.citation-text {
    background-color: #f8f9fa;
    border-left: 4px solid #3f51b5;
    padding: 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.citation-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

.citation-source,
.citation-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.citation-meta .label {
    font-weight: 600;
    color: #495057;
    min-width: 80px;
}

.citation-meta .value {
    color: #6c757d;
    flex: 1;
}

.document-selection-info {
    margin-top: 8px;
}

.ai-selection-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-text {
    font-size: 14px;
    color: #6c757d;
    font-style: italic;
}

/* 文档选择模态框样式 */
.selection-mode-tabs {
    display: flex;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    color: #6c757d;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #3f51b5;
    border-bottom-color: #3f51b5;
    font-weight: 600;
}

.tab-btn:hover {
    color: #3f51b5;
    background-color: #f8f9fa;
}

.selection-content {
    min-height: 300px;
}

.selection-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.selected-count {
    font-size: 14px;
    color: #6c757d;
    margin-left: auto;
}

.document-selection-list {
    max-height: 400px;
    overflow-y: auto;
}

.document-selection-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.3s;
    cursor: pointer;
}

.document-selection-item:hover {
    border-color: #3f51b5;
    background-color: #f8f9fa;
}

.document-selection-item.selected {
    border-color: #3f51b5;
    background-color: #e3f2fd;
}

.document-checkbox {
    margin-right: 12px;
}

.document-selection-info {
    flex: 1;
}

.document-selection-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.document-selection-meta {
    font-size: 12px;
    color: #6c757d;
}

/* AI推荐样式 */
.ai-recommendation {
    padding: 16px;
}

.recommendation-header h4 {
    margin: 0 0 8px 0;
    color: #3f51b5;
}

.recommendation-header p {
    margin: 0 0 16px 0;
    color: #6c757d;
    font-size: 14px;
}

.query-input-area {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.query-input-area textarea {
    flex: 1;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
}

.recommendation-result {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    background-color: #f8f9fa;
}

.result-header h5 {
    margin: 0 0 12px 0;
    color: #333;
}

.recommendation-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.keywords, .reasoning {
    font-size: 14px;
    color: #495057;
}

.keywords span, .reasoning span {
    font-weight: 600;
    color: #3f51b5;
}

.recommended-docs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recommended-doc-item {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.recommended-doc-item.selected {
    border-color: #3f51b5;
    background-color: #e3f2fd;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

/* 流式输出动画 */
.typing-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    animation: typing 1.4s infinite ease-in-out;
    margin-left: 4px;
}

@keyframes typing {
    0%, 80%, 100% {
        opacity: 0;
    }
    40% {
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 600px) {
    .document-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .document-actions {
        margin-top: 10px;
        align-self: flex-end;
    }

    .kb-controls {
        flex-direction: column;
    }

    .chat-message .bubble pre {
        padding: 12px;
        font-size: 13px;
    }
}

/* 聊天容器布局 - 响应式更新 */
.chat-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - 200px); /* 与主样式保持一致 */
    max-height: 800px;
    min-height: 500px;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* 防止flex子项溢出 */
    height: 100%; /* 确保占满容器高度 */
}

/* 引文模块样式 */
.citations-panel {
    width: 350px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 600px;
    transition: all 0.3s ease;
}

.citations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px 12px 0 0;
}

.citations-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.citations-toggle {
    background: none;
    border: none;
    font-size: 18px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.citations-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.citations-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.citations-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.citations-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.citations-empty p {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 500;
}

.citations-empty small {
    font-size: 14px;
    opacity: 0.7;
    line-height: 1.4;
}

.citations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.citation-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.citation-item:hover {
    background: #e9ecef;
    border-color: #3f51b5;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(63, 81, 181, 0.15);
}

.citation-item.active {
    background: #e3f2fd;
    border-color: #3f51b5;
    box-shadow: 0 2px 8px rgba(63, 81, 181, 0.2);
}

.citation-number {
    display: inline-block;
    background: #3f51b5;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 8px;
}

.citation-text {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.citation-text.expanded {
    display: block;
    -webkit-line-clamp: unset;
}

.citation-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #666;
}

.citation-source {
    font-weight: 500;
}

.citation-score {
    color: #3f51b5;
}

.citation-expand {
    background: none;
    border: none;
    color: #3f51b5;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 0;
    text-decoration: underline;
}

.citation-expand:hover {
    color: #303f9f;
}

/* 收起状态 */
.citations-panel.collapsed {
    width: 60px;
}

.citations-panel.collapsed .citations-header h3 {
    display: none;
}

.citations-panel.collapsed .citations-content {
    display: none;
}

.citations-panel.collapsed .citations-toggle {
    transform: rotate(90deg);
}

/* 响应式设计更新 */
@media (max-width: 1200px) {
    .citations-panel {
        width: 300px;
    }
}

@media (max-width: 900px) {
    .chat-container {
        flex-direction: column;
        height: calc(100vh - 150px); /* 移动端调整高度 */
        min-height: 400px;
    }

    .citations-panel {
        width: 100%;
        max-height: 300px;
        order: 2;
    }

    .chat-main {
        order: 1;
        flex: 1;
        min-height: 300px; /* 确保聊天区域有最小高度 */
    }

    .citations-panel {
        max-height: 250px;
    }
}

/* 新增样式 - 引文面板增强 */
.citations-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.citations-header {
    padding: 1rem 1.5rem;
    background: rgba(102, 126, 234, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.citations-header h3 {
    color: #667eea;
    font-size: 1rem;
    margin: 0;
}

.citations-toggle {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.citations-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
}

.citations-content {
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.citations-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #666;
}

.citations-empty .empty-icon {
    font-size: 2rem;
    color: #ccc;
    margin-bottom: 1rem;
}

.citations-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.citation-item {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 1rem;
    border-left: 3px solid #667eea;
    transition: all 0.3s ease;
}

.citation-item:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(2px);
}

.citation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.citation-source {
    font-weight: 600;
    color: #333;
    font-size: 0.875rem;
}

.citation-score {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.citation-content {
    color: #666;
    font-size: 0.875rem;
    line-height: 1.4;
    border-left: 2px solid rgba(102, 126, 234, 0.2);
    padding-left: 0.75rem;
    margin-left: 0.5rem;
}

/* 历史记录增强样式 */
.history-filters {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin-right: 20px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
}

.search-box .clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
}

.search-box .clear-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.filter-group {
    display: flex;
    gap: 10px;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.batch-operations {
    display: flex;
    align-items: center;
    gap: 15px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-container input[type="checkbox"] {
    margin-right: 8px;
}

.batch-btn {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    color: #495057;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.batch-btn:not(:disabled):hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.sort-options label {
    color: #6c757d;
}

.sort-options select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
}

.history-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
    margin-top: 20px;
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: white;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s;
}

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

.page-btn:not(:disabled):hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.page-info {
    font-size: 14px;
    color: #6c757d;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.page-size-selector label {
    color: #6c757d;
}

.page-size-selector select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
}

.control-btn.danger {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.control-btn.danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

.history-item {
    position: relative;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 12px;
    background: white;
    transition: all 0.3s;
}

.history-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.history-item.selected {
    border-color: #667eea;
    background: #f8f9ff;
}

.history-item-checkbox {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
}

.history-content {
    padding: 15px 15px 15px 45px;
    cursor: pointer;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.history-title {
    font-weight: 600;
    color: #333;
    margin: 0;
    flex: 1;
    margin-right: 15px;
}

.history-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.history-time {
    font-size: 12px;
    color: #6c757d;
}

.history-mode {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    background: #e9ecef;
    color: #495057;
}

.history-preview {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #6c757d;
}

.history-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.history-item:hover .history-actions {
    opacity: 1;
}

.history-action-btn {
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    color: #6c757d;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.history-action-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.history-action-btn.danger:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* 文档设置样式 */
.settings-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.settings-stats {
    display: flex;
    gap: 30px;
}

.settings-controls {
    display: flex;
    gap: 10px;
}

.control-btn.primary {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.control-btn.primary:hover {
    background: #5a6fd8;
    border-color: #5a6fd8;
}

.settings-tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 30px;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: none;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-btn:hover {
    color: #495057;
    background: #f8f9fa;
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

.document-selection-panel {
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.selection-controls {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.search-filter-group {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
}

.search-filter-group .search-box {
    flex: 1;
    max-width: 400px;
}

.batch-selection-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.document-list-container {
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
}

.permissions-panel {
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 30px;
}

.permission-groups {
    display: grid;
    gap: 30px;
    margin-bottom: 30px;
}

.permission-group h4 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.permission-items {
    display: grid;
    gap: 15px;
}

.permission-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.permission-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.permission-item input[type="checkbox"] {
    margin-top: 2px;
}

.permission-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 4px;
}

.permission-desc {
    font-size: 13px;
    color: #6c757d;
    line-height: 1.4;
}

.permission-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.advanced-config-panel {
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 30px;
}

.config-sections {
    display: grid;
    gap: 30px;
    margin-bottom: 30px;
}

.config-section h4 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 600;
}

.config-items {
    display: grid;
    gap: 20px;
}

.config-item {
    display: grid;
    gap: 8px;
}

.config-item label {
    font-weight: 500;
    color: #495057;
}

.config-item select,
.config-item input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.config-item input[type="range"] {
    width: 100%;
}

.range-value {
    font-weight: 500;
    color: #667eea;
}

.config-desc {
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
}

.config-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.usage-analysis-panel {
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 30px;
}

.analysis-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.stat-card h4 {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

.stat-text {
    font-size: 16px;
    font-weight: 500;
    color: #495057;
}

/* 文档项样式 */
.document-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s;
}

.document-item:hover {
    background: #f8f9fa;
}

.document-item.selected {
    background: #f8f9ff;
    border-left: 3px solid #667eea;
}

.document-item .document-checkbox {
    margin-right: 15px;
}

.document-info {
    flex: 1;
    margin-right: 15px;
}

.document-name {
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
}

.document-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #6c757d;
}

.document-type {
    display: flex;
    align-items: center;
    gap: 5px;
}

.document-status {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.document-status.active {
    background: #d4edda;
    color: #155724;
}

.document-status.inactive {
    background: #f8d7da;
    color: #721c24;
}

.document-status.processing {
    background: #fff3cd;
    color: #856404;
}

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

.action-btn {
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    color: #6c757d;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.action-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.action-btn.danger:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* 权限项样式增强 */
.permission-item {
    flex-direction: column;
    align-items: flex-start;
}

.permission-item input[type="checkbox"] {
    margin-bottom: 8px;
}

.permission-label {
    display: block;
    width: 100%;
}

.permission-desc {
    display: block;
    width: 100%;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #666;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 加载指示器 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
}

.loading-spinner {
    text-align: center;
    color: #667eea;
}

.loading-spinner i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.loading-spinner p {
    font-size: 1rem;
    font-weight: 500;
}