/* ==========================================
   RSS-AI 每日技术资讯 - 主样式表
   ========================================== */

/* CSS Variables */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #e8e8e8;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --accent: #0066cc;
  --accent-hover: #0052a3;
  --accent-light: rgba(0, 102, 204, 0.1);
  --border: #e0e0e0;
  --shadow: rgba(0, 0, 0, 0.1);
  --card-bg: #ffffff;
  --header-bg: #ffffff;
  --code-bg: #f6f8fa;
  --success: #28a745;
  --warning: #ffc107;
  --error: #dc3545;
  --transition: 0.3s ease;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #3d3d3d;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #808080;
  --accent: #4da6ff;
  --accent-hover: #66b3ff;
  --accent-light: rgba(77, 166, 255, 0.1);
  --border: #404040;
  --shadow: rgba(0, 0, 0, 0.3);
  --card-bg: #2d2d2d;
  --header-bg: #1a1a1a;
  --code-bg: #2d2d2d;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==========================================
   Header
   ========================================== */
.header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px var(--shadow);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
}

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: inline; }

/* Navigation */
.nav {
  display: flex;
  gap: 8px;
  padding-bottom: 12px;
}

.nav-link {
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  transition: all var(--transition);
}

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

.nav-link.active {
  background: var(--accent);
  color: #fff;
}

/* ==========================================
   Main Content
   ========================================== */
.main {
  padding: 24px 0 48px;
}

/* Section Headers */
section h2 {
  font-size: 1.25rem;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* ==========================================
   Date Picker Section
   ========================================== */
.date-picker-section {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px var(--shadow);
}

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

.date-input {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
}

.date-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Date Navigation Section */
.date-nav-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 16px 24px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px var(--shadow);
}

.current-date h2 {
  margin-bottom: 4px;
  text-align: center;
}

/* ==========================================
   Stats Section
   ========================================== */
.stats-section {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px var(--shadow);
}

.stats-section.compact {
  padding: 12px 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 10px;
  transition: transform var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 2rem;
}

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

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}

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

/* Inline Stats */
.stats-inline {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-arrow {
  color: var(--text-muted);
  font-size: 1.25rem;
}

/* ==========================================
   Charts Section
   ========================================== */
.charts-section {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px var(--shadow);
}

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

.charts-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.chart-container {
  height: 300px;
}

.chart-container h3 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ==========================================
   Word Cloud Section
   ========================================== */
.wordcloud-section {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px var(--shadow);
}

.wordcloud-container {
  height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wordCloud {
  width: 100%;
  height: 100%;
}

/* ==========================================
   Reports Section
   ========================================== */
.reports-section {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px var(--shadow);
}

.reports-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.report-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition);
}

.report-item:hover {
  background: var(--accent-light);
  transform: translateX(4px);
}

.report-date {
  font-weight: 600;
  font-size: 1.1rem;
}

.report-info {
  display: flex;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ==========================================
   Articles Section
   ========================================== */
.articles-section {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px var(--shadow);
}

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

.count-badge {
  background: var(--accent);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
}

/* Short News Grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.short-news-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* Articles List */
.articles-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================
   Article Cards
   ========================================== */
.article-card {
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.article-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px var(--shadow);
}

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

.article-number {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.article-source {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.article-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: auto;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.article-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  line-height: 1.4;
}

.article-summary {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
  line-height: 1.5;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.article-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

/* Article Content */
.article-content {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  max-height: none;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.article-content.collapsed {
  max-height: 0;
  padding: 0;
  margin: 0;
  border: none;
  overflow: hidden;
}

.content-body,
.content-translated {
  line-height: 1.8;
}

.content-body h1,
.content-body h2,
.content-body h3,
.content-body h4 {
  margin: 24px 0 12px;
  color: var(--text-primary);
}

.content-body h1 { font-size: 1.5rem; }
.content-body h2 { font-size: 1.25rem; }
.content-body h3 { font-size: 1.1rem; }

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

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

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

.content-body pre {
  background: var(--code-bg);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
}

.content-body code {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.9rem;
}

.content-body :not(pre) > code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

.content-body blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-secondary);
}

.content-body a {
  color: var(--accent);
  text-decoration: none;
}

.content-body a:hover {
  text-decoration: underline;
}

.content-body img {
  max-width: 100%;
  border-radius: 8px;
  margin: 16px 0;
}

/* ==========================================
   Daily Summary Section
   ========================================== */
.daily-summary-section {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px var(--shadow);
}

.daily-summary-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.daily-summary-item {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: 8px;
  border-left: 4px solid var(--accent);
}

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

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

.article-count {
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

.summary-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

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

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

.btn-secondary:hover {
  background: var(--bg-tertiary);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background: var(--accent-light);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* ==========================================
   States
   ========================================== */
.loading,
.no-data,
.error {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
}

.error {
  color: var(--error);
}

/* ==========================================
   Footer
   ========================================== */
.footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-secondary);
}

/* ==========================================
   Responsive Design
   ========================================== */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .charts-grid.three-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 12px;
  }

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

  .date-nav-section {
    flex-direction: column;
    gap: 16px;
  }

  .current-date {
    text-align: center;
  }

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

  .articles-grid,
  .short-news-grid {
    grid-template-columns: 1fr;
  }

  .report-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .report-info {
    flex-direction: column;
    gap: 4px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .card-footer {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .stats-inline {
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-arrow {
    transform: rotate(90deg);
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .container {
    padding: 0 12px;
  }

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

  .logo {
    font-size: 1.25rem;
  }

  .nav-link {
    padding: 6px 12px;
    font-size: 0.9rem;
  }
}

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

.article-card {
  animation: fadeIn 0.3s ease;
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
  .header,
  .footer,
  .theme-toggle,
  .btn {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .article-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* ==========================================
   Highlight Card
   ========================================== */
.highlight-card {
  border-left: 4px solid var(--warning);
}

/* ==========================================
   Scrollbar Styles
   ========================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

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

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

/* ==========================================
   Selection Styles
   ========================================== */
::selection {
  background: var(--accent);
  color: #fff;
}
