/* GitHub AI Trending 首页样式 */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #161b22;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-green: #3fb950;
  --accent-orange: #d29922;
  --border: #30363d;
  --border-light: #21262d;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  padding: 24px 16px;
  font-size: 14px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* ========== 头部区域 ========== */
header {
  text-align: center;
  padding: 32px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 12px;
}

.last-update {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ========== 统计卡片区域 ========== */
.stats-section {
  margin-bottom: 40px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--bg-card);
  padding: 20px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center;
  transition: all 0.2s ease;
}

.stat-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-green);
  line-height: 1.2;
  margin-bottom: 8px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========== 系统状态卡片 ========== */
.system-status {
  margin-bottom: 40px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

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

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-green);
  line-height: 1.2;
  margin-bottom: 8px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========== 隐藏文本（无障碍） ========== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== 最新报告卡片 ========== */
.latest-reports {
  margin-bottom: 40px;
}

.latest-reports h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.report-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.report-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.report-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

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

.report-card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.report-card-header .icon {
  margin-right: 8px;
}

.report-card.daily .report-card-header h3 {
  color: var(--accent);
}

.report-card.weekly .report-card-header h3 {
  color: var(--accent-green);
}

.report-card.monthly .report-card-header h3 {
  color: var(--accent-orange);
}

.report-date {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.report-card-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.report-card-stats .stat {
  font-size: 0.875rem;
  color: var(--text-primary);
}

.report-card-stats .stat:last-child {
  color: var(--accent);
  font-weight: 600;
}

.report-card-theme {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.report-card-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  text-align: center;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.report-card-btn:hover {
  background: #4090e0;
  text-decoration: none;
}

/* ========== 报告导航区域（保留用于历史兼容） ========== */
.report-nav-section {
  margin-bottom: 40px;
}

.report-nav-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.report-nav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.report-nav-grid .report-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.report-nav-grid .report-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.report-nav-grid .report-card.daily .report-header h3 {
  color: var(--accent);
}

.report-nav-grid .report-card.weekly .report-header h3 {
  color: var(--accent-green);
}

.report-nav-grid .report-card.monthly .report-header h3 {
  color: var(--accent-orange);
}

.report-nav-grid .report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.report-nav-grid .report-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.report-nav-grid .report-date {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.report-nav-grid .report-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.report-nav-grid .report-stat {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.report-nav-grid .report-stat .label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.6875rem;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.report-nav-grid .report-stat .value {
  display: block;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
}

.report-nav-grid .report-theme {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.report-nav-grid .report-btn {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  text-align: center;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.report-nav-grid .report-btn:hover {
  background: #4090e0;
  text-decoration: none;
}

.report-nav-grid .report-history {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.report-nav-grid .report-history h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
}

.report-nav-grid .history-link {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: var(--bg-secondary);
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s;
  font-size: 0.8125rem;
}

.report-nav-grid .history-link:hover {
  background: var(--border-light);
  text-decoration: none;
}

.report-nav-grid .history-date {
  color: var(--accent);
  font-weight: 500;
}

.report-nav-grid .history-count {
  color: var(--text-secondary);
}

/* ========== AI 洞察区域 ========== */
.insights-section {
  margin-bottom: 40px;
}

.insights-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.insight-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.insight-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}

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

.stat-label {
  color: var(--text-secondary);
}

.stat-value {
  color: var(--accent);
  font-weight: 600;
}

.hot-project {
  text-align: center;
  padding: 20px 0;
}

.hot-project-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.hot-project-stars {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-orange);
  margin-bottom: 8px;
}

.hot-project-type {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

/* ========== 趋势图表 ========== */
.trends-chart {
  margin-bottom: 40px;
}

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

.chart-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.chart-tab {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.chart-tab:hover {
  background: var(--border-light);
}

.chart-tab.active {
  background: var(--accent);
  color: white;
}

.chart-container {
  height: 350px;
  position: relative;
}

/* ========== 趋势图表占位（保留用于兼容） ========== */
.trends-section {
  margin-bottom: 40px;
}

.trends-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.trends-placeholder {
  background: var(--bg-card);
  padding: 60px 40px;
  border-radius: 8px;
  border: 2px dashed var(--border);
  text-align: center;
}

.placeholder-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.placeholder-text {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.placeholder-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ========== Top 5 热榜 ========== */
.top-projects {
  margin-bottom: 40px;
}

.top-projects h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.top-projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.top-project-card {
  background: var(--bg-card);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.top-project-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.top-project-rank {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-orange);
  margin-bottom: 8px;
}

.top-project-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.4;
  display: block;
  margin-bottom: 8px;
}

.top-project-name:hover {
  text-decoration: underline;
}

.top-project-stars {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent);
  margin: 8px 0;
}

.top-project-desc {
  color: var(--text-secondary);
  font-size: 0.875rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.top-project-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.top-project-tags .tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border-light);
}

.view-all-btn {
  display: block;
  text-align: center;
  margin-top: 20px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.view-all-btn:hover {
  text-decoration: underline;
}

/* ========== 明星项目榜单（保留用于兼容） ========== */
.top-projects-section {
  margin-bottom: 40px;
}

.top-projects-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.search-container {
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

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

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.project-card {
  background: var(--bg-card);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.project-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

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

.project-rank {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-orange);
  min-width: 32px;
}

.project-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.4;
}

.project-name:hover {
  text-decoration: underline;
}

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

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

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--bg-secondary);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border-light);
}

.tag-type {
  color: var(--accent);
}

.tag-lang {
  color: var(--accent-green);
}

.tag-stars {
  color: var(--accent-orange);
}

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* ========== 底部信息 ========== */
footer {
  text-align: center;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

footer p {
  margin-bottom: 8px;
}

footer p:last-child {
  margin-bottom: 0;
}

/* ========== 报告存档 ========== */
.archive-section {
  margin-bottom: 40px;
}

.archive-section h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.toggle-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.toggle-btn:hover {
  text-decoration: underline;
}

.archive-content {
  margin-top: 20px;
}

.archive-tab {
  margin-bottom: 24px;
}

.archive-type {
  font-weight: 600;
  color: var(--accent);
  display: block;
  margin-bottom: 12px;
  font-size: 1rem;
}

.archive-tab ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.archive-tab li {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.archive-tab a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.archive-tab a:hover {
  text-decoration: underline;
}

.archive-count {
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

/* ========== 响应式设计 ========== */
@media (max-width: 1024px) {
  .status-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .report-cards {
    grid-template-columns: 1fr;
  }

  .trends-chart .chart-tabs {
    flex-wrap: wrap;
  }

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

  .archive-tab ul {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (max-width: 768px) {
  header h1 {
    font-size: 1.5rem;
  }

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

  .report-cards {
    grid-template-columns: 1fr;
  }

  .top-projects-grid {
    grid-template-columns: 1fr;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .archive-tab ul {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  body {
    padding: 16px 12px;
  }

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

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

  .stat-label {
    font-size: 0.6875rem;
  }

  .top-project-card {
    padding: 12px;
  }

  .top-project-rank {
    font-size: 1.25rem;
  }

  .view-all-btn {
    font-size: 0.875rem;
  }
}
