/* ===== 基础变量 ===== */
:root {
  --primary-color: #2196f3;
  --primary-dark: #1976d2;
  --secondary-color: #4caf50;
  --text-primary: #333;
  --text-secondary: #666;
  --text-light: #999;
  --bg-primary: #fff;
  --bg-secondary: #f5f5f5;
  --bg-card: #fafafa;
  --border-color: #e0e0e0;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
}

/* ===== 重置样式 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
}

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

a:hover {
  color: var(--primary-dark);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

/* ===== 布局容器 ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== 页头 ===== */
.header {
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-color);
}

.logo span {
  color: var(--secondary-color);
}

.nav {
  display: flex;
  gap: 30px;
}

.nav a {
  color: var(--text-primary);
  font-weight: 500;
}

.nav a:hover,
.nav a.active {
  color: var(--primary-color);
}

/* ===== 搜索框 ===== */
.search-box {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-box input {
  width: 100%;
  padding: 14px 50px 14px 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-size: 16px;
  transition: border-color 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.search-box button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 500;
}

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

/* ===== Hero区域 ===== */
.hero {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 60px 0;
  text-align: center;
}

.hero h1 {
  font-size: 36px;
  margin-bottom: 16px;
}

.hero p {
  font-size: 18px;
  opacity: 0.9;
  margin-bottom: 30px;
}

/* ===== 分类筛选 ===== */
.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 30px;
}

.category-filter a {
  padding: 10px 24px;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-radius: var(--radius-lg);
  font-weight: 500;
}

.category-filter a:hover,
.category-filter a.active {
  background: #fff;
  color: var(--primary-color);
}

/* ===== 内容区域 ===== */
.main {
  padding: 40px 0;
}

.section-title {
  font-size: 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--primary-color);
  border-radius: 2px;
}

/* ===== 卡片网格 ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.card-icon {
  width: 48px;
  height: 48px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.card-meta {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-light);
}

/* ===== 链接列表 ===== */
.link-list {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.link-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.link-item:last-child {
  border-bottom: none;
}

.link-icon {
  width: 40px;
  height: 40px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.link-content {
  flex: 1;
}

.link-content h4 {
  font-size: 16px;
  margin-bottom: 4px;
}

.link-content .url {
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 6px;
}

.link-content p {
  color: var(--text-secondary);
  font-size: 14px;
}

.link-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #e8f5e9;
  color: var(--secondary-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

/* ===== 面包屑 ===== */
.breadcrumb {
  background: var(--bg-primary);
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb li:not(:last-child)::after {
  content: '>';
  margin-left: 8px;
  color: var(--text-light);
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb li:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== 分类标签 ===== */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.tag:hover {
  background: var(--primary-color);
  color: #fff;
}

/* ===== 文章列表 ===== */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-item {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.article-thumb {
  width: 120px;
  height: 80px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 12px;
}

.article-content {
  flex: 1;
}

.article-content h4 {
  font-size: 16px;
  margin-bottom: 8px;
}

.article-content p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-meta {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-light);
}

/* ===== 文章详情 ===== */
.article-detail {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 40px;
  box-shadow: var(--shadow-sm);
}

.article-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.article-header h1 {
  font-size: 28px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.article-info {
  display: flex;
  gap: 20px;
  color: var(--text-light);
  font-size: 14px;
}

.article-body {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-primary);
}

.article-body h2 {
  font-size: 22px;
  margin: 32px 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.article-body h3 {
  font-size: 18px;
  margin: 24px 0 12px;
}

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

.article-body ul,
.article-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

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

.article-body ul li {
  list-style: disc;
}

.article-body ol li {
  list-style: decimal;
}

/* ===== 分页 ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
}

.pagination a,
.pagination span {
  padding: 10px 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-weight: 500;
}

.pagination a:hover {
  background: var(--primary-color);
  color: #fff;
}

.pagination .current {
  background: var(--primary-color);
  color: #fff;
}

/* ===== 三栏布局 ===== */
.three-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 40px;
}

.col-section {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.col-section h3 {
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-color);
}

.col-section ul {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.col-section li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.col-section li::before {
  content: '•';
  color: var(--primary-color);
}

.col-section a {
  color: var(--text-primary);
}

.col-section a:hover {
  color: var(--primary-color);
}

/* ===== 统计信息 ===== */
.stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid rgba(255,255,255,0.2);
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
}

.stat-label {
  font-size: 14px;
  opacity: 0.8;
  margin-top: 4px;
}

/* ===== 页脚 ===== */
.footer {
  background: var(--text-primary);
  color: #fff;
  padding: 40px 0;
  margin-top: 60px;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}

.footer-brand h3 {
  font-size: 20px;
  margin-bottom: 16px;
}

.footer-brand p {
  color: #aaa;
  line-height: 1.8;
}

.footer-links h4 {
  font-size: 14px;
  margin-bottom: 16px;
  color: #fff;
}

.footer-links ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  color: #aaa;
}

.footer-links a:hover {
  color: #fff;
}

.footer-bottom {
  text-align: center;
  padding-top: 30px;
  margin-top: 30px;
  border-top: 1px solid #444;
  color: #888;
  font-size: 13px;
}

/* ===== 404页面 ===== */
.error-page {
  text-align: center;
  padding: 80px 20px;
}

.error-code {
  font-size: 120px;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1;
}

.error-title {
  font-size: 24px;
  margin: 20px 0 16px;
}

.error-desc {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--primary-color);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 500;
}

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

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

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

@media (max-width: 768px) {
  .header .container {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 20px;
  }

  .nav {
    order: 3;
    width: 100%;
    margin-top: 12px;
    gap: 20px;
    justify-content: center;
  }

  .hero h1 {
    font-size: 28px;
  }

  .hero p {
    font-size: 16px;
  }

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

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

  .article-item {
    flex-direction: column;
  }

  .article-thumb {
    width: 100%;
    height: 160px;
  }

  .article-detail {
    padding: 24px;
  }

  .article-header h1 {
    font-size: 22px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .stats {
    flex-direction: column;
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .category-filter {
    gap: 8px;
  }

  .category-filter a {
    padding: 8px 16px;
    font-size: 13px;
  }

  .link-item {
    flex-direction: column;
    gap: 12px;
  }

  .pagination {
    flex-wrap: wrap;
  }
}
