/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --accent: #e74c3c;
    --bg: #f8f9fa;
    --card-bg: #fff;
    --text: #333;
    --text-light: #666;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --sidebar-width: 260px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: #fff;
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.logo h1 {
    font-size: 1.3rem;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    padding: 12px 15px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.tags-cloud {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.tags-cloud h3 {
    font-size: 0.9rem;
    margin-bottom: 15px;
    color: rgba(255,255,255,0.9);
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    font-size: 0.8rem;
    padding: 4px 10px;
    background: rgba(255,255,255,0.15);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.tag:hover {
    background: rgba(255,255,255,0.3);
}

/* 概念标签 */
.concept-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 20px;
    text-decoration: none;
    margin: 5px;
    transition: all 0.2s;
}

.concept-tag:hover {
    background: #1976d2;
    color: #fff;
}

.concept-tag .count {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75em;
}

/* 主内容区 */
.main {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 20px 30px;
}

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

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 500px;
}

#search-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--border);
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
}

#search-input:focus {
    border-color: var(--secondary);
}

#semantic-search-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: var(--secondary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

#semantic-search-btn:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.view-toggle {
    display: flex;
    gap: 5px;
}

.view-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.view-btn.active {
    background: var(--secondary);
    color: #fff;
    border-color: var(--secondary);
}

/* 内容卡片 */
.content {
    display: grid;
    gap: 20px;
}

.content.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.content.list-view {
    grid-template-columns: 1fr;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

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

.card-type {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--bg);
    color: var(--text-light);
}

.card-type.paper { background: #e3f2fd; color: #1976d2; }
.card-type.book { background: #f3e5f5; color: #7b1fa2; }
.card-type.concept { background: #e8f5e9; color: #388e3c; }

.card h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.card-summary {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.card-tag {
    font-size: 0.75rem;
    padding: 3px 10px;
    background: var(--bg);
    border-radius: 10px;
    color: var(--text-light);
}

/* 文章详情模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background: #fff;
    max-width: 800px;
    margin: 50px auto;
    padding: 40px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
}

.close-btn:hover {
    color: var(--accent);
}

/* 脑图视图 */
.graph-view {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    background: #1a1a2e;
    z-index: 200;
}

.graph-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    gap: 15px;
    align-items: center;
}

.graph-controls input {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.9);
    width: 200px;
}

.graph-controls button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    background: var(--secondary);
    color: #fff;
    cursor: pointer;
}

.legend {
    display: flex;
    gap: 15px;
    color: #fff;
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.paper { background: #3498db; }
.dot.book { background: #9b59b6; }
.dot.concept { background: #2ecc71; }
.dot.author { background: #f39c12; }

#graph-container {
    width: 100%;
    height: 100%;
}

/* 关联链接样式 */
.mention-link {
    color: var(--secondary);
    text-decoration: none;
    border-bottom: 1px dashed var(--secondary);
    cursor: pointer;
}

.mention-link:hover {
    background: rgba(52, 152, 219, 0.1);
}

/* 语义搜索提示 */
.semantic-hint {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main {
        margin-left: 0;
    }
    
    .container {
        flex-direction: column;
    }
    
    .graph-view {
        left: 0;
    }
}


/* ========================================
   概念梳理页面样式
   ======================================== */

.concepts-cloud {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    text-align: center;
}

.concepts-list {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.concept-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px 20px;
    transition: all 0.2s;
}

.concept-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #3498db;
}

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

.concept-name a {
    color: #1976d2;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
}

.concept-name a:hover {
    text-decoration: underline;
}

.concept-meta {
    font-size: 0.85rem;
    color: #666;
}

.concept-articles {
    font-size: 0.9rem;
    color: #555;
}

.concept-articles a {
    color: #3498db;
    text-decoration: none;
}

.concept-articles a:hover {
    text-decoration: underline;
}

.concept-article-link {
    color: #3498db;
    text-decoration: none;
}

.concept-article-link:hover {
    text-decoration: underline;
}

/* 卡片中的概念 */
.card-concepts {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.concept-mini {
    font-size: 0.75rem;
    padding: 3px 10px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    text-decoration: none;
}

.concept-mini:hover {
    background: #1976d2;
    color: #fff;
}

/* 筛选信息 */
.filter-info {
    margin: 15px 0;
    padding: 10px 15px;
    background: #e8f5e9;
    border-radius: 8px;
    color: #2e7d32;
}

/* ========================================
   文章页面样式
   ======================================== */

.article-page {
    background: #f8f9fa;
    min-height: 100vh;
}

.article-header {
    background: #2c3e50;
    color: #fff;
    padding: 15px 30px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #fff;
}

.breadcrumb .current {
    color: rgba(255,255,255,0.6);
}

.article-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px 20px;
}

.article-content {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.article-title-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.article-title-header h1 {
    font-size: 1.8rem;
    margin: 15px 0;
    color: #2c3e50;
    line-height: 1.4;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 15px 0;
    font-size: 0.9rem;
    color: #666;
}

.article-meta .authors {
    color: #333;
}

.article-meta a.author-link {
    color: #3498db;
    text-decoration: none;
}

.article-meta a.author-link:hover {
    text-decoration: underline;
}

.article-tags, .article-concepts {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #e0e0e0;
}

.tag-link, .concept-link {
    display: inline-block;
    padding: 4px 12px;
    margin: 3px;
    background: #f0f0f0;
    color: #555;
    border-radius: 15px;
    text-decoration: none;
    font-size: 0.85rem;
}

.tag-link:hover, .concept-link:hover {
    background: #3498db;
    color: #fff;
}

.article-body {
    line-height: 1.8;
    color: #333;
}

.article-body h2 {
    font-size: 1.5rem;
    margin: 30px 0 15px;
    color: #2c3e50;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.article-body h3 {
    font-size: 1.25rem;
    margin: 25px 0 12px;
    color: #34495e;
}

.article-body p {
    margin: 15px 0;
}

.article-body ul, .article-body ol {
    margin: 15px 0;
    padding-left: 25px;
}

.article-body li {
    margin: 8px 0;
}

.article-body blockquote {
    margin: 20px 0;
    padding: 15px 20px;
    background: #f8f9fa;
    border-left: 4px solid #3498db;
    color: #555;
    font-style: italic;
}

.article-body code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.article-body pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
}

.article-body pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.article-body th, .article-body td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.article-body th {
    background: #f8f9fa;
    font-weight: 600;
}

.article-body tr:nth-child(even) {
    background: #f8f9fa;
}

.mention-link {
    color: #1976d2;
    text-decoration: none;
    border-bottom: 1px dashed #1976d2;
}

.mention-link:hover {
    background: rgba(25, 118, 210, 0.1);
}

.article-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.btn-back {
    display: inline-block;
    padding: 10px 20px;
    background: #3498db;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-back:hover {
    background: #2980b9;
}

/* 统计卡片增强 */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: #3498db;
}

.stat-label {
    font-size: 0.85rem;
    color: #666;
}

/* 脑图图例增强 */
.legend-item .dot.concept {
    background: #1abc9c;
}
