/* ============================================
   EduAI 智能教学助手 - 样式表
   ============================================ */

/* CSS 变量 */
:root {
    /* 主色调 */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;

    /* 渐变色 */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-card: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);

    /* 背景色 */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;

    /* 文字颜色 */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;

    /* 边框颜色 */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;

    /* 阴影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --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: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* 侧边栏宽度 */
    --sidebar-width: 280px;

    /* 顶部栏高度 */
    --topbar-height: 64px;

    /* 过渡 */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* 暗色主题 */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --border-color: #334155;
    --border-light: #1e293b;
}

/* 重置样式 */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ============================================
   应用容器布局
   ============================================ */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   侧边栏
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-normal), transform var(--transition-normal);
    flex-shrink: 0;
    z-index: 100;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

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

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

.logo-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--primary-100);
    color: var(--primary-600);
}

.sidebar-toggle svg {
    width: 18px;
    height: 18px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    padding: 0 20px;
    margin-bottom: 8px;
}

.nav-list {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

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

.nav-item.active {
    background: var(--primary-50);
    color: var(--primary-600);
    border-left-color: var(--primary-500);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item span {
    font-weight: 500;
}

/* 快捷问题 */
.quick-questions {
    list-style: none;
    padding: 0 12px;
}

.quick-question {
    padding: 10px 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    margin-bottom: 4px;
}

.quick-question:hover {
    background: var(--bg-tertiary);
    color: var(--primary-600);
}

.quick-question::before {
    content: '>';
    margin-right: 8px;
    color: var(--primary-500);
    font-weight: bold;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* ============================================
   主内容区
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* 顶部栏 */
.top-bar {
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.mobile-menu-btn svg {
    width: 24px;
    height: 24px;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-tertiary);
}

.search-box input {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.search-box input::placeholder {
    color: var(--text-tertiary);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--primary-100);
    color: var(--primary-600);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* 内容面板 */
.content-panel {
    display: none;
    flex: 1;
    overflow: hidden;
}

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

/* ============================================
   聊天面板
   ============================================ */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

/* 消息样式 */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    animation: messageIn 0.3s ease;
}

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

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

.message-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
}

.message-avatar svg {
    width: 100%;
    height: 100%;
}

.message-content {
    max-width: 75%;
}

.message-bot .message-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    border-top-left-radius: var(--radius-sm);
    padding: 16px 20px;
}

.message-user .message-content {
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-sm);
    padding: 12px 16px;
}

.message-text {
    font-size: 0.95rem;
    line-height: 1.7;
}

.message-text p {
    margin-bottom: 12px;
}

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

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

.message-text li {
    margin-bottom: 6px;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 8px;
}

.message-user .message-time {
    color: rgba(255, 255, 255, 0.7);
    text-align: right;
}

/* 聊天输入区 */
.chat-input-container {
    flex-shrink: 0;
    padding-top: 16px;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px;
    transition: all var(--transition-fast);
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.chat-input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 8px 12px;
    max-height: 120px;
    color: var(--text-primary);
    font-family: inherit;
}

.chat-input-wrapper textarea:focus {
    outline: none;
}

.chat-input-wrapper textarea::placeholder {
    color: var(--text-tertiary);
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

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

.send-btn svg {
    width: 20px;
    height: 20px;
}

.chat-hints {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 0 4px;
}

.hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.hint-divider {
    color: var(--border-color);
}

/* ============================================
   知识库面板
   ============================================ */
.knowledge-container {
    height: 100%;
    overflow-y: auto;
    padding: 32px;
}

.knowledge-header {
    text-align: center;
    margin-bottom: 32px;
}

.knowledge-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.knowledge-header p {
    color: var(--text-secondary);
}

.knowledge-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.filter-tab:hover {
    border-color: var(--primary-300);
    color: var(--primary-600);
}

.filter-tab.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

.filter-search {
    position: relative;
}

.filter-search input {
    width: 240px;
    height: 38px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    font-size: 0.875rem;
    color: var(--text-primary);
}

.filter-search input:focus {
    outline: none;
    border-color: var(--primary-500);
}

.filter-search::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat center;
}

/* 知识卡片网格 */
.knowledge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.knowledge-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.knowledge-card:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.knowledge-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.knowledge-card-category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
}

.category-theory {
    background: #dbeafe;
    color: #1d4ed8;
}

.category-method {
    background: #dcfce7;
    color: #15803d;
}

.category-tech {
    background: #fef3c7;
    color: #b45309;
}

.category-practice {
    background: #f3e8ff;
    color: #7c3aed;
}

[data-theme="dark"] .category-theory {
    background: #1e3a5f;
    color: #60a5fa;
}

[data-theme="dark"] .category-method {
    background: #14532d;
    color: #4ade80;
}

[data-theme="dark"] .category-tech {
    background: #451a03;
    color: #fbbf24;
}

[data-theme="dark"] .category-practice {
    background: #3b0764;
    color: #c084fc;
}

.knowledge-card-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.knowledge-card-icon svg {
    width: 20px;
    height: 20px;
}

.knowledge-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.knowledge-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.knowledge-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.knowledge-card-meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.knowledge-card-arrow {
    color: var(--primary-500);
    transition: transform var(--transition-fast);
}

.knowledge-card:hover .knowledge-card-arrow {
    transform: translateX(4px);
}

/* 知识详情视图 */
.knowledge-detail {
    display: none;
    max-width: 800px;
    margin: 0 auto;
}

.knowledge-detail.active {
    display: block;
}

.knowledge-grid.hidden {
    display: none;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.back-btn:hover {
    border-color: var(--primary-300);
    color: var(--primary-600);
}

.back-btn svg {
    width: 16px;
    height: 16px;
}

.detail-category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--primary-50);
    color: var(--primary-600);
}

.detail-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
}

.detail-content h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.detail-meta {
    display: flex;
    gap: 24px;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.detail-body {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.detail-body h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.detail-body p {
    margin-bottom: 16px;
}

.detail-body ul, .detail-body ol {
    margin: 16px 0;
    padding-left: 24px;
}

.detail-body li {
    margin-bottom: 8px;
}

.detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.action-btn svg {
    width: 18px;
    height: 18px;
}

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

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

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

.action-btn.secondary:hover {
    border-color: var(--primary-300);
    color: var(--primary-600);
}

/* ============================================
   学习资源面板
   ============================================ */
.study-container {
    height: 100%;
    overflow-y: auto;
    padding: 32px;
}

.study-header {
    text-align: center;
    margin-bottom: 32px;
}

.study-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.study-header p {
    color: var(--text-secondary);
}

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

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-icon.blue {
    background: #dbeafe;
    color: #2563eb;
}

.stat-icon.purple {
    background: #f3e8ff;
    color: #9333ea;
}

.stat-icon.green {
    background: #dcfce7;
    color: #16a34a;
}

.stat-icon.orange {
    background: #ffedd5;
    color: #ea580c;
}

[data-theme="dark"] .stat-icon.blue {
    background: #1e3a5f;
    color: #60a5fa;
}

[data-theme="dark"] .stat-icon.purple {
    background: #3b0764;
    color: #c084fc;
}

[data-theme="dark"] .stat-icon.green {
    background: #14532d;
    color: #4ade80;
}

[data-theme="dark"] .stat-icon.orange {
    background: #431407;
    color: #fb923c;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* 学习板块 */
.study-sections {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.study-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
}

/* 学习路径卡片 */
.learning-paths {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.path-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-fast);
}

.path-card:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-md);
}

.path-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.path-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
}

.path-badge.beginner {
    background: #dcfce7;
    color: #15803d;
}

.path-badge.intermediate {
    background: #fef3c7;
    color: #b45309;
}

.path-badge.advanced {
    background: #f3e8ff;
    color: #7c3aed;
}

[data-theme="dark"] .path-badge.beginner {
    background: #14532d;
    color: #4ade80;
}

[data-theme="dark"] .path-badge.intermediate {
    background: #451a03;
    color: #fbbf24;
}

[data-theme="dark"] .path-badge.advanced {
    background: #3b0764;
    color: #c084fc;
}

.path-header h4 {
    font-size: 1rem;
    font-weight: 600;
}

.path-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.path-progress {
    margin-bottom: 16px;
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.path-btn {
    width: 100%;
    padding: 10px;
    border: none;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.path-btn:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* 资源列表 */
.resource-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: all var(--transition-fast);
}

.resource-item:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-sm);
}

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

.resource-icon svg {
    width: 24px;
    height: 24px;
}

.resource-icon.pdf {
    background: #fef2f2;
    color: #dc2626;
}

.resource-icon.video {
    background: #fef3c7;
    color: #d97706;
}

.resource-icon.link {
    background: #dbeafe;
    color: #2563eb;
}

[data-theme="dark"] .resource-icon.pdf {
    background: #450a0a;
    color: #f87171;
}

[data-theme="dark"] .resource-icon.video {
    background: #451a03;
    color: #fbbf24;
}

[data-theme="dark"] .resource-icon.link {
    background: #1e3a5f;
    color: #60a5fa;
}

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

.resource-info h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.resource-meta {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.resource-download {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.resource-download:hover {
    border-color: var(--primary-500);
    color: var(--primary-600);
    background: var(--primary-50);
}

.resource-download svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   移动端遮罩
   ============================================ */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

/* ============================================
   加载动画
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

[data-theme="dark"] .loading-overlay {
    background: rgba(15, 23, 42, 0.9);
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   提示消息
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.3s ease;
    min-width: 280px;
}

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

.toast.success {
    border-left: 4px solid #22c55e;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #22c55e;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.info .toast-icon {
    color: #3b82f6;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: var(--sidebar-width);
        transform: translateX(-100%);
    }

    .mobile-menu-btn {
        display: flex;
    }

    .mobile-overlay.active {
        display: block;
    }

    .search-box {
        width: 200px;
    }

    .knowledge-container,
    .study-container {
        padding: 24px 16px;
    }
}

@media (max-width: 768px) {
    :root {
        --topbar-height: 56px;
    }

    .top-bar {
        padding: 0 16px;
    }

    .search-box {
        display: none;
    }

    .page-title {
        font-size: 1.1rem;
    }

    .chat-container {
        padding: 16px;
    }

    .message-content {
        max-width: 85%;
    }

    .message-bot .message-content,
    .message-user .message-content {
        padding: 12px 14px;
    }

    .message-text {
        font-size: 0.9rem;
    }

    .knowledge-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-tabs {
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .filter-search input {
        width: 100%;
    }

    .knowledge-grid {
        grid-template-columns: 1fr;
    }

    .study-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .detail-content {
        padding: 20px;
    }

    .detail-actions {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .study-stats {
        grid-template-columns: 1fr;
    }

    .learning-paths {
        grid-template-columns: 1fr;
    }

    .resource-item {
        flex-wrap: wrap;
    }

    .resource-download {
        width: 100%;
        margin-top: 8px;
    }

    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

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

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

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* ============================================
   选中样式
   ============================================ */
::selection {
    background: var(--primary-200);
    color: var(--primary-700);
}

[data-theme="dark"] ::selection {
    background: var(--primary-700);
    color: var(--primary-100);
}
