/* ================== 全局变量 ================== */
:root {
  --primary: #6366f1;
  --primary-dark: #4338ca;
  --secondary: #8b5cf6;
  --accent: #ec4899;
  --bg: #f0f2f7;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --tier1: #10b981;
  --tier2: #3b82f6;
  --tier3: #f59e0b;
  --tier4: #ef4444;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.08);
  --radius: 12px;
}

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

html {
  scroll-behavior: smooth;
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a5b4fc; }

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); text-decoration: none; }

/* ================== 顶栏 ================== */
.topbar {
  background: linear-gradient(135deg, #0369a1 0%, #6366f1 100%);
  color: #fff;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar .brand { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.topbar .brand .sub { font-weight: 400; font-size: 13px; opacity: 0.85; margin-left: 10px; }
.topbar .actions { display: flex; gap: 16px; align-items: center; }
.topbar input.search {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 7px 14px;
  border-radius: 20px;
  width: 240px;
  font-size: 13px;
}
.topbar input.search::placeholder { color: rgba(255,255,255,0.7); }

/* ================== 布局 ================== */
.layout { display: flex; min-height: calc(100vh - 56px); }

.sidebar {
  width: 240px;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}
.sidebar .group { margin-bottom: 18px; }
.sidebar .group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  padding: 0 22px 8px;
  text-transform: uppercase;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 22px;
  color: var(--text);
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.sidebar a:hover { background: #f1f5f9; text-decoration: none; }
.sidebar a.active {
  background: #eff6ff;
  color: var(--primary-dark);
  border-left-color: var(--primary);
  font-weight: 600;
}
.sidebar .icon { width: 16px; text-align: center; }

.main { flex: 1; padding: 28px 36px; max-width: 1400px; }

/* ================== 通用卡片 ================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--text);
  border-left: 4px solid var(--primary);
  padding-left: 10px;
}
.card h3 { font-size: 14px; margin: 14px 0 8px; color: var(--primary-dark); }

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.page-sub { color: var(--text-muted); margin-bottom: 22px; font-size: 13.5px; }

.section-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 26px 0 14px;
}
.section-divider .line { flex: 1; height: 1px; background: var(--border); }
.section-divider .label {
  font-size: 12px; color: var(--text-muted); letter-spacing: 1.5px;
}

/* ================== 流程条 ================== */
.pipeline {
  display: flex; gap: 0; margin: 14px 0 28px;
  background: #fff; border-radius: 10px; padding: 18px;
  border: 1px solid var(--border);
}
.pipeline .step {
  flex: 1; text-align: center; padding: 12px 8px;
  position: relative;
}
.pipeline .step:not(:last-child)::after {
  content: "→"; position: absolute; right: -10px; top: 50%;
  transform: translateY(-50%); color: var(--primary); font-size: 22px; font-weight: bold;
}
.pipeline .step .num {
  display: inline-block; width: 30px; height: 30px;
  background: var(--primary); color: #fff; border-radius: 50%;
  line-height: 30px; font-weight: 700; margin-bottom: 8px;
}
.pipeline .step .title { font-size: 14px; font-weight: 600; }
.pipeline .step .desc { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ================== 关键指标 ================== */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.metric {
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.metric .v { font-size: 26px; font-weight: 700; color: var(--primary-dark); }
.metric .l { color: var(--text-muted); font-size: 12.5px; }
.metric.accent .v { color: var(--accent); }
.metric.success .v { color: var(--tier1); }
.metric.warning .v { color: var(--tier3); }

/* ================== 表格 ================== */
table.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: #fff;
}
table.data-table th {
  background: #f1f5f9; text-align: left; padding: 10px 12px;
  font-weight: 600; color: var(--text); font-size: 12.5px;
  border-bottom: 2px solid var(--border);
}
table.data-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data-table tr:hover { background: #f8fafc; }
table.data-table .gene { font-family: "Consolas", "Monaco", monospace; font-weight: 600; color: var(--primary-dark); }
table.data-table .num { font-family: "Consolas", "Monaco", monospace; text-align: right; }

/* ================== 标签 ================== */
.tag {
  display: inline-block; padding: 2px 8px;
  font-size: 11px; border-radius: 10px; font-weight: 600;
  background: #eff6ff; color: var(--primary-dark); margin-right: 4px;
}
.tag.tier1 { background: #d1fae5; color: #065f46; }
.tag.tier2 { background: #dbeafe; color: #1e40af; }
.tag.tier3 { background: #fef3c7; color: #92400e; }
.tag.tier4 { background: #fee2e2; color: #991b1b; }
.tag.success { background: #d1fae5; color: #065f46; }
.tag.warning { background: #fef3c7; color: #92400e; }
.tag.danger  { background: #fee2e2; color: #991b1b; }
.tag.novel   { background: #ede9fe; color: #6d28d9; }

/* ================== 进度条 / 评分条 ================== */
.score-bar {
  background: #e2e8f0; border-radius: 6px; height: 8px;
  overflow: hidden; min-width: 120px; display: inline-block; vertical-align: middle;
}
.score-bar .fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.5s;
}
.score-num { font-weight: 700; color: var(--primary-dark); margin-left: 8px; }

/* ================== 数据集卡 ================== */
.dataset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.dataset-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 18px; transition: all 0.2s;
  border-top: 4px solid var(--primary);
}
.dataset-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.dataset-card h3 { color: var(--primary-dark); font-size: 16px; margin-bottom: 4px; }
.dataset-card .gse-id { font-family: monospace; color: var(--accent); font-weight: 700; }
.dataset-card .meta { font-size: 12.5px; color: var(--text-muted); margin: 8px 0; }
.dataset-card ul { margin: 8px 0 0 18px; font-size: 12.5px; }
.dataset-card .best-use {
  margin-top: 10px; padding: 8px 10px;
  background: #f0fdf4; border-left: 3px solid var(--tier1);
  font-size: 12px; color: #166534; border-radius: 4px;
}

/* ================== 细胞类型 ================== */
.cell-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cell-item {
  padding: 12px 14px; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; border-left: 3px solid var(--secondary);
}
.cell-item.fibrosis { border-left-color: var(--accent); background: #fdf2f8; }
.cell-item .name { font-weight: 700; font-size: 13px; }
.cell-item .role { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ================== 通讯网络 ================== */
.lr-row {
  display: grid; grid-template-columns: 1fr auto 1fr 80px;
  gap: 10px; align-items: center;
  padding: 10px; border-bottom: 1px solid var(--border);
}
.lr-row .arrow { color: var(--accent); font-weight: bold; }
.lr-row .from, .lr-row .to {
  background: #f1f5f9; padding: 4px 8px; border-radius: 4px;
  font-size: 12px; text-align: center;
}

/* ================== 按钮 ================== */
.btn {
  display: inline-block; padding: 8px 16px;
  background: var(--primary); color: #fff; border: none;
  border-radius: 6px; cursor: pointer; font-size: 13px;
  font-weight: 500; transition: all 0.15s; text-decoration: none;
}
.btn:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ================== 二级标签 ================== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tabs .tab {
  padding: 8px 16px; cursor: pointer; font-size: 13px;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  color: var(--text-muted);
}
.tabs .tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ================== 搜索结果 ================== */
.search-result {
  padding: 12px 16px; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 8px; background: #fff;
}
.search-result .title { font-weight: 600; color: var(--primary-dark); }
.search-result .snippet { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

/* ================== 下载列表 ================== */
.download-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.download-item:hover { background: #f8fafc; }
.download-item .file { font-family: monospace; font-size: 12.5px; }
.download-item .meta { font-size: 11.5px; color: var(--text-muted); }

/* ================== 图表容器 ================== */
.chart-box { position: relative; height: 280px; margin-top: 8px; }
.chart-box.tall { height: 360px; }

/* ================== 工具条 ================== */
.toolbar {
  display: flex; gap: 8px; align-items: center; margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar input, .toolbar select {
  padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px;
}

/* ================== 空状态 ================== */
.empty {
  text-align: center; padding: 40px 20px; color: var(--text-muted);
  font-size: 13px;
}

/* 响应式 */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; top: 0; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dataset-grid, .cell-grid { grid-template-columns: 1fr; }
}

footer.site-footer {
  text-align: center; padding: 22px; color: var(--text-muted);
  font-size: 12px; border-top: 1px solid var(--border); margin-top: 30px;
}
