/* PDF知识点提取器 - 蓝白配色样式（美化版） */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-lighter: #dbeafe;
    --primary-lightest: #eff6ff;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

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

html, body {
    width: 100%;
    height: 100%;
}

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

/* 登录按钮样式 - 仅用于页面内部的登录按钮，不影响导航栏 */
.login-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-login {
    background: linear-gradient(135deg, #4361ee, #3f37c9);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.btn-login i {
    font-size: 14px;
}

/* 未登录提示样式 */
.login-prompt {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px dashed #0ea5e9;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.login-prompt:hover {
    border-color: #0284c7;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
}

.login-prompt-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.login-prompt-content i {
    font-size: 32px;
    color: #0ea5e9;
    margin-bottom: 8px;
}

.login-prompt-content p {
    color: #0369a1;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
}

.btn-login-prompt {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
    padding: 10px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    margin-top: 8px;
}

.btn-login-prompt:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-login-prompt i {
    font-size: 14px;
}

/* ===== 主容器 - flex 布局 ===== */
.main-container {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-height: calc(100vh - 60px);
}

/* 未登录状态下，减去提示条的高度 */
body.has-login-notice .main-container {
    min-height: calc(100vh - 108px);
}

/* ===== 侧边栏美化（相对定位，与页脚同层） ===== */
.sidebar {
    width: 320px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 60px);
    position: relative;
    transition: width 0.3s ease;
    overflow-y: auto;
}

/* 未登录状态下，减去提示条的高度 */
body.has-login-notice .sidebar {
    min-height: calc(100vh - 108px);
}

.sidebar.collapsed {
    width: 4px;
    min-width: 4px;
    overflow: hidden;
    border-right: none;
    background: var(--border);
    transition: all 0.3s ease;
}

/* 侧边栏收起时，主内容区自动调整 */
.sidebar.collapsed ~ .content,
#mainContent.sidebar-collapsed {
    flex: 1;
}

/* 侧边栏收起时按钮始终可见 */
.sidebar.collapsed .sidebar-toggle {
    display: flex;
    position: absolute;
    right: -44px;
    top: 16px;
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    z-index: 10;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 0 24px 24px 0;
    border: 1px solid var(--primary);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    font-size: 1.25rem;
}

/* 确保侧边栏展开时按钮也正确显示 */
.sidebar:not(.collapsed) .sidebar-toggle {
    display: flex;
}

/* 侧边栏内部滚动容器 */
.sidebar > .chat-actions,
.sidebar > .chat-tabs {
    overflow-y: auto;
}

.sidebar > .chat-tabs {
    flex: 1;
    min-height: 0;
}

/* 侧边栏收起时，主内容区自动调整 */
.sidebar.collapsed ~ .content,
.sidebar.collapsed + .content,
#mainContent.sidebar-collapsed {
    left: 4px;
    width: calc(100% - 4px);
}

/* 侧边栏切换按钮（相对定位，跟随侧边栏） */
.sidebar-toggle {
    position: absolute;
    right: -24px;
    top: 16px;
    width: 48px;
    height: 48px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.sidebar-toggle:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

.sidebar.collapsed .sidebar-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

/* 侧边栏隐藏时的操作按钮 - 极简浮动工具栏设计 */
.sidebar-collapsed-actions {
    display: none;
    position: fixed;
    top: 80px;
    left: 8px;
    z-index: 1000;
    flex-direction: row;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: 50px;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px) saturate(180%);
    animation: scaleInFromLeft 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 工具栏光环效果 */
.sidebar-collapsed-actions::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: 50px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), transparent 50%, rgba(37, 99, 235, 0.05));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-collapsed-actions:hover::before {
    opacity: 1;
}

@keyframes scaleInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-8px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.sidebar.collapsed ~ .sidebar-collapsed-actions {
    display: flex;
}

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

.sidebar.collapsed ~ .sidebar-collapsed-actions {
    display: flex;
}

/* 侧边栏收起时的操作按钮样式 - 极简圆形图标按钮 */
.sidebar-collapsed-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
    cursor: pointer;
    border: none;
    font-family: inherit;
    background: transparent;
}

/* 主按钮 - 新建会话 */
.sidebar-collapsed-actions .btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.sidebar-collapsed-actions .btn-primary:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.sidebar-collapsed-actions .btn-primary:active {
    transform: scale(0.95);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

/* 次按钮 - 打开边栏 */
.sidebar-collapsed-actions .btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sidebar-collapsed-actions .btn-secondary:hover {
    background: var(--primary-lightest);
    border-color: var(--primary-lighter);
    color: var(--primary);
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.sidebar-collapsed-actions .btn-secondary:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.1);
}

/* 按钮图标样式 */
.sidebar-collapsed-actions .btn i {
    font-size: 1rem;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed-actions .btn:hover i {
    transform: scale(1.15) rotate(5deg);
}

.sidebar-collapsed-actions .btn-secondary:hover i {
    transform: scale(1.15);
}

/* 按钮文字提示 - 默认隐藏，hover 时显示 */
.sidebar-collapsed-actions .btn span {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px) scale(0.8);
    background: var(--text-primary);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 8px;
}

.sidebar-collapsed-actions .btn span::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: var(--text-primary);
}

.sidebar-collapsed-actions .btn:hover span {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

/* 焦点状态 - 可访问性 */
.sidebar-collapsed-actions .btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.sidebar-collapsed-actions .btn-primary:focus-visible {
    outline-color: var(--primary-dark);
}

/* 按钮禁用状态 */
.sidebar-collapsed-actions .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.sidebar-collapsed-actions .btn:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* 点击波纹效果 */
.sidebar-collapsed-actions .btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 70%);
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.sidebar-collapsed-actions .btn:active::after {
    animation: ripple 0.4s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* 响应式设计 - 移动端适配 */
@media (max-width: 768px) {
    .sidebar-toggle {
        width: 40px;
        height: 40px;
        right: -20px;
        top: 16px;
        font-size: 1rem;
    }
    
    .sidebar.collapsed .sidebar-toggle {
        right: -1px;
        width: 40px;
        height: 40px;
        top: 16px;
        border-radius: 0 20px 20px 0;
    }
    
    /* 移动端工具栏位置调整 */
    .sidebar-collapsed-actions {
        top: 72px;
        left: 6px;
        padding: 6px;
        gap: 6px;
    }
    
    .sidebar-collapsed-actions .btn {
        width: 40px;
        height: 40px;
    }
    
    .sidebar-collapsed-actions .btn i {
        font-size: 0.875rem;
    }
}

/* 小屏幕适配 */
@media (max-width: 480px) {
    .sidebar-collapsed-actions {
        top: 68px;
        left: 4px;
        padding: 6px;
        gap: 6px;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar-collapsed-actions .btn {
        width: 38px;
        height: 38px;
    }
    
    .sidebar-collapsed-actions .btn i {
        font-size: 0.8125rem;
    }
}

/* 超小屏幕适配 */
@media (max-width: 360px) {
    .sidebar-collapsed-actions {
        top: 64px;
        left: 4px;
        padding: 4px;
        gap: 4px;
    }
    
    .sidebar-collapsed-actions .btn {
        width: 36px;
        height: 36px;
    }
    
    .sidebar-collapsed-actions .btn i {
        font-size: 0.75rem;
    }
}

/* 会话操作按钮区域 */
.chat-actions {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--background);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.chat-action-feedback {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    min-height: 16px;
}

/* 会话标签容器 */
.chat-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: var(--background);
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.chat-tabs::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.chat-tabs::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    border: 2px solid var(--background);
}

.chat-tabs::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 会话标签美化 */
.chat-tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    background: var(--surface);
}

.chat-tab:hover {
    background: var(--primary-lightest);
    border-color: var(--primary-lighter);
}

.chat-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.chat-tab-title {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    word-break: break-all;
    line-height: 1.4;
}

.chat-tab-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    margin-left: 8px;
    opacity: 0.7;
}

.chat-tab-menu {
    position: relative;
}

.chat-tab-menu-btn {
    background: none;
    border: none;
    color: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    margin-left: 8px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-tab-menu-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.chat-tab:not(.active) .chat-tab-menu-btn:hover {
    background: var(--border);
}

.chat-tab-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 120px;
    z-index: 1000;
    border: 2px solid #ff4d4f;
}

.chat-tab-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.chat-tab-menu-item:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.chat-tab-menu-item i {
    font-size: 0.75rem;
}

/* ===== 主内容区美化（相对定位，与页脚同层） ===== */
.content {
    padding: 16px;
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    flex: 1;
    min-height: calc(100vh - 60px);
    overflow: visible;
    z-index: 100;
}

/* 未登录状态下，减去提示条的高度 */
body.has-login-notice .content {
    min-height: calc(100vh - 108px);
}

/* 主内容区内部滚动容器 */
.content > .action-area,
.content > .empty-state {
    overflow-y: auto;
}

.content > .editor-container {
    overflow: hidden;
}

.content > .action-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 40px;
}

.content > .editor-container {
    flex: 1;
    min-height: 0;
}

/* ===== 右侧操作区样式 ===== */
.upload-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    padding: 32px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

/* 上传区域美化 */
.upload-area {
    width: 100%;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--background);
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-lightest);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-lightest);
    transform: scale(1.02);
}

.upload-content i {
    font-size: 3.5rem;
    color: var(--primary);
    margin-bottom: 16px;
    transition: var(--transition);
}

.upload-area:hover .upload-content i {
    transform: scale(1.1);
}

.upload-content p {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-content span {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* 已上传文件信息显示 */
.uploaded-file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--primary-lightest);
    border: 1px solid var(--primary-lighter);
    border-radius: var(--radius-sm);
    width: 100%;
    margin-bottom: 8px;
}

.uploaded-file-info i.fa-file-pdf {
    color: var(--primary);
    font-size: 1.25rem;
}

.uploaded-file-info span {
    flex: 1;
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-file:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* ===== 按钮美化 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 12px -2px rgba(37, 99, 235, 0.3);
}

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

.btn-secondary:hover {
    background: var(--border-light);
    border-color: var(--text-muted);
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-info {
    background: #0ea5e9;
    color: white;
}

.btn-info:hover {
    background: #0284c7;
}

.btn-block {
    width: 100%;
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

#newSessionBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#newSessionBtn:disabled:hover {
    background: var(--primary);
    transform: none;
}

/* ===== 进度条美化 ===== */
.progress-container {
    background: var(--surface);
    padding: 20px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.9375rem;
}

.progress-header span:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

.progress-header span:last-child {
    color: var(--primary);
    font-weight: 600;
}

.progress-bar {
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 50%, var(--primary) 100%);
    background-size: 200% 100%;
    border-radius: 5px;
    transition: width 0.4s ease, background 0.3s ease, animation 0.3s ease;
    animation: shimmer 2s infinite;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: slide 2s infinite;
}

@keyframes slide {
    0% { left: -100%; }
    100% { left: 100%; }
}

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

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

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

/* ===== 编辑器容器美化（flex 布局，内部滚动） ===== */
.editor-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: calc(100vh - 200px);
    min-height: 500px;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--background);
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
}

.editor-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-header h2 i {
    color: var(--primary);
}

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

/* 自动保存状态提示 */
.auto-save-status {
    font-size: 0.875rem;
    color: var(--success);
    margin-left: 12px;
    padding: 4px 12px;
    background: var(--success-light);
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-5px);
}

.auto-save-status.success {
    color: var(--success);
    opacity: 1;
    transform: translateY(0);
}

.auto-save-status.error {
    color: var(--danger);
    background: var(--danger-light);
    opacity: 1;
    transform: translateY(0);
}

/* 删除确认弹窗样式 */
.delete-warning-content {
    padding: 20px 0;
    text-align: center;
}

.delete-warning-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.delete-warning-subtext {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.modal-icon-warning {
    color: #f59e0b !important;
}

.btn-modal-cancel {
    background: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-modal-cancel:hover {
    background: var(--border);
    border-color: var(--text-muted);
}

.btn-modal-danger {
    background: var(--danger);
    color: white;
    border: 1px solid var(--danger);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-modal-danger:hover {
    background: #d63d5f;
    border-color: #d63d5f;
    box-shadow: 0 4px 12px rgba(239, 71, 111, 0.3);
}

/* 统计栏美化 */
.stats-bar {
    display: flex;
    gap: 24px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary-lightest) 0%, var(--surface) 100%);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== 知识点树美化（内部滚动） ===== */
.knowledge-tree {
    padding: 20px 24px 140px 24px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    scroll-padding-bottom: 80px;
}

.knowledge-tree::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.knowledge-tree::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
    border: 2px solid var(--background);
}

.knowledge-tree::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.tree-item {
    margin-bottom: 8px;
}

.tree-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.tree-header:hover {
    background: var(--background);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.tree-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: var(--transition);
    flex-shrink: 0;
    margin-top: 2px;
    border-radius: 4px;
}

.tree-toggle:hover {
    background: var(--border-light);
}

.tree-toggle.expanded {
    transform: rotate(90deg);
    color: var(--primary);
}

.tree-toggle.leaf {
    visibility: hidden;
}

.tree-content {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

.tree-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.tree-id {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-lightest);
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.tree-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.tree-page {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tree-content-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 8px;
    padding-left: 38px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.tree-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.tree-header:hover .tree-actions {
    opacity: 1;
}

.tree-actions button {
    padding: 4px 10px;
    font-size: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition);
}

.tree-actions button:hover {
    background: var(--primary-lighter);
    color: var(--primary);
}

.tree-children {
    margin-left: 24px;
    margin-top: 8px;
    padding-left: 16px;
    border-left: 2px solid var(--border);
    display: none;
}

.tree-children.expanded {
    display: block;
}

/* 层级样式 */
.tree-item.level-1 > .tree-header {
    background: linear-gradient(135deg, var(--primary-lightest) 0%, var(--surface) 100%);
    border: 1px solid var(--primary-lighter);
}

.tree-item.level-1 > .tree-header .tree-title {
    font-weight: 600;
}

.tree-item.level-2 > .tree-header {
    padding-left: 24px;
}

.tree-item.level-3 > .tree-header {
    padding-left: 32px;
}

/* ===== 空状态美化 ===== */
.empty-state {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-muted);
    animation: fadeIn 0.5s ease;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

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

.empty-state i {
    font-size: 5rem;
    color: var(--border);
    margin-bottom: 24px;
    display: block;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 600;
}

.empty-state p {
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ===== 弹窗美化 ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

.modal-content.modal-lg {
    max-width: 720px;
}

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

/* ===== 内容区域模态框 ===== */
.content-modal {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 900;
    align-items: center;
    justify-content: center;
}

.content-modal.active {
    display: flex;
}

.content-modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 80%;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: contentModalSlideIn 0.3s ease;
}

@keyframes contentModalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--primary);
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: var(--transition);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: var(--text-primary);
    background: var(--border);
}

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

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--background);
}

/* ===== 表单美化 ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    transition: var(--transition);
    font-family: inherit;
    background: var(--surface);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-lighter);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

/* ===== 帮助内容美化 ===== */
.help-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.help-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.help-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.help-section h4 i {
    color: var(--primary);
}

.help-section p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.help-section ul {
    margin-left: 24px;
    color: var(--text-secondary);
}

.help-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.help-section strong {
    color: var(--text-primary);
}

/* ===== Toast 提示美化 ===== */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.3s ease;
    min-width: 280px;
    max-width: 400px;
    font-weight: 500;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    background: var(--success);
    color: white;
}

.toast.error {
    background: var(--danger);
    color: white;
}

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

.toast.warning {
    background: var(--warning);
    color: var(--text-primary);
}

.toast i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Firefox 滚动条 */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* ===== 响应式保持原样 ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .sidebar-toggle {
        right: -24px;
    }
    
    .sidebar.collapsed ~ .content,
    .sidebar.collapsed + .content,
    #mainContent.sidebar-collapsed {
        flex: 1;
    }
    
    .sidebar.collapsed .sidebar-toggle {
        right: -44px;
    }
}

@media (max-width: 768px) {
    .main-container {
        display: block;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 40vh;
        position: relative;
        top: 0;
        height: auto;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .content {
        position: relative;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow-y: visible;
        min-height: auto;
    }
    
    .editor-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .editor-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .stats-bar {
        flex-wrap: wrap;
        gap: 16px;
    }
}

/* ===== 辅助类 ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.hidden {
    display: none !important;
}

/* 焦点样式 */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* 选择文本样式 */
::selection {
    background: var(--primary-lighter);
    color: var(--primary-dark);
}
