/* ========== 基础重置与变量 ========== */
:root {
  --bg-primary: #0f1419;
  --bg-secondary: #1a2332;
  --bg-card: #1e2d3d;
  --bg-card-hover: #243447;
  --text-primary: #e7e9ea;
  --text-secondary: #8b98a5;
  --text-muted: #6e7b8a;
  --accent: #1d9bf0;
  --accent-hover: #1a8cd8;
  --accent-light: rgba(29, 155, 240, 0.12);
  --border: #2f3336;
  --success: #00ba7c;
  --warning: #ffad1f;
  --danger: #f4212e;
  --tag-bg: rgba(29, 155, 240, 0.08);
  --tag-active-bg: var(--accent);
  --tag-active-text: #fff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 900px;
}

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

html {
  scroll-behavior: smooth;
}

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

/* ========== 导航栏 ========== */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(26, 35, 50, 0.92);
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  font-size: 28px;
  line-height: 1;
}

.logo h1 {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.update-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(29, 155, 240, 0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}

.btn-refresh:hover {
  background: rgba(29, 155, 240, 0.2);
  border-color: var(--accent);
}

.btn-refresh:active {
  transform: scale(0.96);
}

.btn-refresh.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ========== 主内容 ========== */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px;
  min-height: calc(100vh - 180px);
}

/* ========== 筛选区域 ========== */
.filter-section {
  margin-bottom: 20px;
}

.sector-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.sector-tag {
  padding: 7px 18px;
  background: var(--tag-bg);
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.sector-tag:hover {
  background: rgba(29, 155, 240, 0.15);
  color: var(--accent);
  border-color: rgba(29, 155, 240, 0.2);
}

.sector-tag.active {
  background: var(--tag-active-bg);
  color: var(--tag-active-text);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(29, 155, 240, 0.25);
}

.search-box {
  display: flex;
  gap: 8px;
}

.search-box input {
  flex: 1;
  padding: 10px 16px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

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

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 155, 240, 0.12);
}

.btn-search {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

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

.btn-search:active {
  transform: scale(0.95);
}

/* ========== 状态栏 ========== */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.news-count {
  font-size: 13px;
  color: var(--text-muted);
}

.current-filter {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

/* ========== 新闻列表 ========== */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 新闻卡片 */
.news-card {
  display: block;
  padding: 18px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  border: 1px solid transparent;
  cursor: pointer;
  animation: fadeInUp 0.4s ease-out both;
}

.news-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.news-card .news-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card:hover .news-title {
  color: var(--accent);
}

.news-card .news-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.news-source {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-weight: 500;
}

.news-source .source-icon {
  font-size: 14px;
}

.news-time {
  color: var(--text-muted);
}

.news-card .news-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 每个卡片依次延迟出现 */
.news-card:nth-child(1) { animation-delay: 0s; }
.news-card:nth-child(2) { animation-delay: 0.03s; }
.news-card:nth-child(3) { animation-delay: 0.06s; }
.news-card:nth-child(4) { animation-delay: 0.09s; }
.news-card:nth-child(5) { animation-delay: 0.12s; }
.news-card:nth-child(6) { animation-delay: 0.15s; }
.news-card:nth-child(7) { animation-delay: 0.18s; }
.news-card:nth-child(8) { animation-delay: 0.21s; }
.news-card:nth-child(9) { animation-delay: 0.24s; }
.news-card:nth-child(10) { animation-delay: 0.27s; }

/* ========== 骨架屏 ========== */
.skeleton-card {
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: 2px;
}

.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, var(--bg-card-hover) 25%, rgba(255,255,255,0.05) 50%, var(--bg-card-hover) 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-title {
  width: 75%;
  height: 18px;
  margin-bottom: 12px;
}

.skeleton-meta {
  width: 40%;
  height: 12px;
  margin-bottom: 12px;
}

.skeleton-summary {
  width: 100%;
  margin-bottom: 8px;
}

.skeleton-summary.short {
  width: 60%;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ========== 空状态 ========== */
.empty-state,
.error-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon,
.error-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.empty-text,
.error-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-hint,
.error-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.btn-retry {
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

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

/* ========== 底部 ========== */
.footer {
  max-width: var(--max-width);
  margin: 30px auto 0;
  padding: 20px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}

/* ========== 高亮匹配关键词 ========== */
.highlight {
  color: var(--warning);
  font-weight: 600;
  background: rgba(255, 173, 31, 0.1);
  padding: 0 2px;
  border-radius: 2px;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
  .navbar-inner {
    padding: 12px 16px;
  }

  .logo h1 {
    font-size: 17px;
  }

  .logo-icon {
    font-size: 24px;
  }

  .update-time {
    display: none;
  }

  .btn-refresh span {
    display: none;
  }

  .btn-refresh {
    padding: 8px 10px;
  }

  .main-content {
    padding: 14px;
  }

  .sector-tags {
    gap: 6px;
  }

  .sector-tag {
    padding: 6px 14px;
    font-size: 12px;
  }

  .news-card {
    padding: 14px 16px;
  }

  .news-card .news-title {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .sector-tags {
    gap: 5px;
  }

  .sector-tag {
    padding: 5px 12px;
    font-size: 12px;
  }

  .search-box input {
    font-size: 13px;
    padding: 9px 12px;
  }

  .news-card .news-summary {
    -webkit-line-clamp: 1;
  }
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
  width: 6px;
}

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

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

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