/* ==================== 全局样式 ==================== */
:root {
  --primary: #1a73e8;
  --primary-light: #e8f0fe;
  --primary-dark: #1557b0;
  --success: #34a853;
  --warning: #fbbc04;
  --danger: #ea4335;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-light: #80868b;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f4;
  --border-color: #dadce0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.1);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.12);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: all 0.2s ease;
}

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

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

/* ==================== 顶部导航 ==================== */
.top-header {
  background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #1565c0 100%);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

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

.logo-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.logo-text p {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 1px;
}

/* 标签导航 */
.tab-nav {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 4px;
}

.tab-btn {
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

.tab-btn.active {
  background: white;
  color: var(--primary);
  font-weight: 600;
}

/* ==================== 主内容区 ==================== */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ==================== 卡片通用 ==================== */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 20px;
}

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

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

/* ==================== 筛选栏 ==================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  background: white;
  min-width: 140px;
  transition: var(--transition);
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

/* ==================== 宏观对比看板 ==================== */

/* 试卷选择卡片 */
.exam-selector {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.exam-select-card {
  flex: 1;
  min-width: 200px;
  max-width: 280px;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

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

.exam-select-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.exam-select-card .exam-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
}

.exam-select-card .exam-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.exam-select-card .exam-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 对比表格 */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.comparison-table th,
.comparison-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 1;
}

.comparison-table th:first-child {
  min-width: 160px;
  border-right: 2px solid var(--border-color);
}

.comparison-table td:first-child {
  font-weight: 500;
  background: var(--bg-secondary);
  border-right: 2px solid var(--border-color);
  min-width: 160px;
}

.comparison-table .row-category {
  background: var(--bg-tertiary);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
}

.comparison-table .row-category td {
  padding: 8px 14px;
}

/* 难度星级 */
.difficulty-stars {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stars {
  color: #fbbc04;
  letter-spacing: 2px;
}

.difficulty-value {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 标签 */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  margin: 2px 3px;
}

.tag-green {
  background: #e6f4ea;
  color: #137333;
}

.tag-red {
  background: #fce8e6;
  color: #c5221f;
}

.tag-yellow {
  background: #fef7e0;
  color: #b06000;
}

.tag-blue {
  background: #e8f0fe;
  color: #174ea6;
}

.tag-purple {
  background: #f3e8fd;
  color: #7627bb;
}

/* 知识模块占比条 */
.dist-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dist-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.dist-value {
  font-size: 13px;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

/* 能力画像雷达区域 */
.ability-section {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.ability-card {
  flex: 1;
  min-width: 250px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.ability-card h4 {
  font-size: 14px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

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

.ability-list li {
  padding: 6px 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ability-list li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

/* 试卷详情卡片网格 */
.exam-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.exam-detail-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.exam-detail-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.exam-detail-header {
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.exam-detail-header h4 {
  font-size: 15px;
  font-weight: 600;
}

.exam-detail-body {
  padding: 14px 16px;
}

.exam-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}

.exam-detail-row:last-child {
  border-bottom: none;
}

.exam-detail-row .label {
  color: var(--text-secondary);
}

.exam-detail-row .value {
  font-weight: 500;
}

/* ==================== 微观热力图 ==================== */

.heatmap-controls {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* 热力图矩阵 */
.heatmap-matrix {
  overflow-x: auto;
}

.heatmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 800px;
}

.heatmap-table th {
  padding: 10px 12px;
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: center;
  border: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1;
}

.heatmap-table td {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  vertical-align: top;
}

.heatmap-table .q-number {
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  min-width: 50px;
}

.heatmap-table .q-cell {
  min-width: 140px;
  position: relative;
  transition: var(--transition);
}

.heatmap-table .q-cell:hover {
  background: var(--primary-light);
}

.q-knowledge {
  font-weight: 500;
  margin-bottom: 2px;
}

.q-id {
  font-size: 11px;
  color: var(--text-light);
  font-family: 'Consolas', 'Monaco', monospace;
}

.q-new-tag {
  display: inline-block;
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  font-weight: 600;
}

/* 热度追踪列 */
.heatmap-table .tracking-cell {
  min-width: 200px;
  background: #fafbfc;
}

.frequency-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  margin: 2px 2px;
}

.freq-high {
  background: #e6f4ea;
  color: #137333;
  border: 1px solid #ceead6;
}

.freq-medium {
  background: #fef7e0;
  color: #b06000;
  border: 1px solid #fde293;
}

.freq-low {
  background: #fce8e6;
  color: #c5221f;
  border: 1px solid #f9d0cb;
}

.teaching-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
  line-height: 1.5;
}

.teaching-note strong {
  color: var(--text-primary);
}

/* 热力颜色背景 */
.heat-high { background-color: rgba(52, 168, 83, 0.08); }
.heat-medium { background-color: rgba(251, 188, 4, 0.08); }
.heat-low { background-color: rgba(234, 67, 53, 0.05); }

/* ==================== 搜索导出系统 ==================== */
.search-container {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
}

.search-input-wrapper input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 15px;
  transition: var(--transition);
}

.search-input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26,115,232,0.12);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--text-light);
}

.search-btn {
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.search-btn:hover {
  background: var(--primary-dark);
}

/* 搜索结果 */
.search-results {
  margin-top: 16px;
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: var(--transition);
  gap: 12px;
}

.search-result-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.search-result-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.result-info {
  flex: 1;
}

.result-label {
  font-size: 14px;
  font-weight: 500;
}

.result-id {
  font-size: 12px;
  color: var(--text-light);
  font-family: 'Consolas', 'Monaco', monospace;
  margin-top: 2px;
}

.result-category {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* 导出栏 */
.export-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 2px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 200;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.export-bar.visible {
  transform: translateY(0);
}

.export-bar .selected-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.export-bar .export-ids {
  flex: 1;
  margin: 0 20px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: var(--text-primary);
  overflow-x: auto;
  white-space: nowrap;
}

.export-btn {
  padding: 10px 24px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.export-btn:hover {
  background: #2d9249;
}

.copy-btn {
  padding: 10px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-left: 8px;
  transition: var(--transition);
}

.copy-btn:hover {
  background: var(--primary-dark);
}

/* 知识点统计面板 */
.kp-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.kp-stat-card {
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

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

.kp-stat-card .kp-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.kp-stat-card .kp-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.kp-stat-card .kp-count span {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* ==================== 知识点分布堆叠条 ==================== */
.stacked-bar {
  display: flex;
  height: 24px;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0;
}

.stacked-bar .segment {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  transition: flex 0.5s ease;
  min-width: 0;
}

.stacked-bar .segment:hover {
  filter: brightness(1.1);
}

.stacked-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.stacked-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.stacked-legend .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* ==================== 统计概览卡片 ==================== */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-color);
  text-align: center;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==================== 空状态 ==================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 14px;
}

/* ==================== Toast 提示 ==================== */
.toast {
  position: fixed;
  top: 80px;
  right: 24px;
  padding: 12px 20px;
  background: #323232;
  color: white;
  border-radius: var(--radius-md);
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

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

/* ==================== 分隔线与标题 ==================== */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
  margin-left: 8px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 20px 0;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: 12px;
  }

  .tab-nav {
    width: 100%;
    justify-content: center;
  }

  .main-content {
    padding: 16px;
  }

  .filter-bar {
    flex-direction: column;
  }

  .exam-selector {
    flex-direction: column;
  }

  .exam-select-card {
    max-width: 100%;
  }

  .search-container {
    flex-direction: column;
  }

  .export-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .export-bar .export-ids {
    order: 3;
    margin: 0;
    width: 100%;
  }
}

/* ==================== 动画 ==================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

/* 预测标记 */
.predicted-tag {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 4px;
  font-weight: 600;
}

/* 知识点分布可视化 */
.dist-visual {
  margin-top: 16px;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.dist-row .dist-label {
  min-width: 80px;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}

.dist-row .dist-bar-track {
  flex: 1;
  height: 20px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.dist-row .dist-bar-inner {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.dist-row .dist-percent {
  min-width: 45px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

/* 选中高亮 */
.highlight-row {
  background: var(--primary-light) !important;
}

/* 知识点标签云 */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
}

.tag-cloud .cloud-tag {
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  background: white;
}

.tag-cloud .cloud-tag:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.tag-cloud .cloud-tag.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.tag-cloud .cloud-tag .tag-count {
  font-size: 11px;
  opacity: 0.7;
  margin-left: 4px;
}
