/* ==================== 全局样式 ==================== */
:root {
  --primary: #4361ee;
  --primary-dark: #3a56d4;
  --secondary: #7209b7;
  --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  --bg-light: #f8f9fa;
  --text-dark: #1a1a2e;
  --text-gray: #6c757d;
  --border-color: #e9ecef;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.7;
  color: var(--text-dark);
  background: #fff;
}

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

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

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

.main-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  padding: 40px 0;
}

@media (max-width: 968px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

/* ==================== 导航栏 ==================== */
.header {
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 30px;
  list-style: none;
}

.nav-links a {
  color: var(--text-gray);
  font-weight: 500;
  padding: 8px 0;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient);
  transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-dark);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-dark);
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 20px;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
  }
  
  .nav-links.active {
    display: flex;
  }
  
  .mobile-menu-btn {
    display: block;
  }
}

/* ==================== Hero 区域 ==================== */
.hero {
  background: var(--gradient);
  color: #fff;
  padding: 80px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 2.8rem;
  margin-bottom: 16px;
  font-weight: 800;
}

.hero p {
  font-size: 1.2rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 30px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 50px;
  margin-top: 40px;
}

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

.stat-number {
  font-size: 2rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.8;
}

@media (max-width: 768px) {
  .hero {
    padding: 50px 0;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero-stats {
    gap: 30px;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
}

/* ==================== 筛选标签 ==================== */
.filter-section {
  padding: 30px 0;
  border-bottom: 1px solid var(--border-color);
}

.filter-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-tab {
  padding: 10px 20px;
  border: 2px solid var(--border-color);
  border-radius: 50px;
  background: #fff;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-gray);
  transition: all 0.3s ease;
}

.filter-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-tab.active {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
}

/* ==================== 文章卡片网格 ==================== */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

.article-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card-cover {
  height: 160px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.card-content {
  padding: 20px;
}

.card-meta {
  display: flex;
  gap: 15px;
  font-size: 0.85rem;
  color: var(--text-gray);
  margin-bottom: 12px;
}

.card-category {
  background: var(--bg-light);
  padding: 4px 12px;
  border-radius: 20px;
  color: var(--primary);
  font-weight: 500;
}

.card-title {
  font-size: 1.2rem;
  margin-bottom: 10px;
  line-height: 1.4;
}

.card-title a {
  color: var(--text-dark);
}

.card-title a:hover {
  color: var(--primary);
}

.card-desc {
  color: var(--text-gray);
  font-size: 0.95rem;
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.card-tag {
  font-size: 0.8rem;
  color: var(--text-gray);
  background: var(--bg-light);
  padding: 4px 10px;
  border-radius: 4px;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.sidebar-widget {
  background: #fff;
  border-radius: var(--radius);
  padding: 25px;
  border: 1px solid var(--border-color);
}

.widget-title {
  font-size: 1.1rem;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}

/* CTA 组件 */
.cta-box {
  background: var(--gradient);
  color: #fff;
  padding: 25px;
  border-radius: var(--radius);
  text-align: center;
}

.cta-box h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.cta-box p {
  font-size: 0.95rem;
  opacity: 0.9;
  margin-bottom: 20px;
}

.cta-btn {
  display: inline-block;
  background: #fff;
  color: var(--primary);
  padding: 12px 25px;
  border-radius: 50px;
  font-weight: 600;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  color: var(--primary-dark);
}

/* 分类导航 */
.category-nav {
  list-style: none;
}

.category-nav li {
  margin-bottom: 12px;
}

.category-nav a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  transition: all 0.3s ease;
}

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

.category-count {
  background: rgba(0,0,0,0.1);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
}

/* 热门文章列表 */
.popular-list {
  list-style: none;
}

.popular-list li {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.popular-list li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.popular-list a {
  display: flex;
  gap: 12px;
  color: var(--text-dark);
}

.popular-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  opacity: 0.5;
  min-width: 25px;
}

.popular-title {
  font-size: 0.95rem;
  line-height: 1.4;
}

.popular-list a:hover .popular-title {
  color: var(--primary);
}

/* ==================== 文章页样式 ==================== */
.article-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.breadcrumb {
  display: flex;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-gray);
  margin-bottom: 30px;
}

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

.breadcrumb span {
  color: var(--primary);
}

.article-header {
  margin-bottom: 40px;
}

.article-header h1 {
  font-size: 2.2rem;
  line-height: 1.3;
  margin-bottom: 20px;
}

.article-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.95rem;
  color: var(--text-gray);
}

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

.article-cover {
  margin-bottom: 40px;
  border-radius: var(--radius);
  overflow: hidden;
}

.article-cover-inner {
  height: 300px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
}

/* 文章正文 */
.article-content {
  font-size: 1.05rem;
  line-height: 1.8;
}

.article-content h2 {
  font-size: 1.6rem;
  margin: 40px 0 20px;
  color: var(--text-dark);
}

.article-content h3 {
  font-size: 1.3rem;
  margin: 30px 0 15px;
  color: var(--text-dark);
}

.article-content p {
  margin-bottom: 20px;
}

.article-content ul,
.article-content ol {
  margin: 20px 0;
  padding-left: 25px;
}

.article-content li {
  margin-bottom: 10px;
}

.article-content strong {
  color: var(--text-dark);
}

.article-content .highlight-box {
  background: var(--bg-light);
  border-left: 4px solid var(--primary);
  padding: 20px;
  margin: 25px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article-content .tip-box {
  background: linear-gradient(135deg, rgba(67, 97, 238, 0.1) 0%, rgba(114, 9, 183, 0.1) 100%);
  padding: 20px;
  margin: 25px 0;
  border-radius: var(--radius);
}

.article-content .cta-inline {
  background: var(--gradient);
  color: #fff;
  padding: 20px;
  border-radius: var(--radius);
  text-align: center;
  margin: 30px 0;
}

.article-content .cta-inline a {
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
}

/* ==================== 相关推荐 ==================== */
.related-articles {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--border-color);
}

.related-articles h2 {
  font-size: 1.5rem;
  margin-bottom: 25px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.related-card {
  background: var(--bg-light);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform 0.3s ease;
}

.related-card:hover {
  transform: translateY(-3px);
}

.related-card h3 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.related-card h3 a {
  color: var(--text-dark);
}

.related-card p {
  font-size: 0.9rem;
  color: var(--text-gray);
}

/* ==================== 文章底部 CTA ==================== */
.article-cta {
  background: var(--gradient);
  color: #fff;
  padding: 40px;
  border-radius: var(--radius);
  text-align: center;
  margin-top: 50px;
}

.article-cta h2 {
  font-size: 1.8rem;
  margin-bottom: 15px;
}

.article-cta p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 25px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.article-cta .cta-btn {
  background: #fff;
  color: var(--primary);
  padding: 15px 35px;
  font-size: 1.1rem;
}

.article-cta .cta-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* ==================== 页脚 ==================== */
.footer {
  background: var(--text-dark);
  color: #fff;
  padding: 50px 0 30px;
  margin-top: 80px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}

.footer-section h4 {
  font-size: 1.1rem;
  margin-bottom: 20px;
  color: #fff;
}

.footer-section ul {
  list-style: none;
}

.footer-section li {
  margin-bottom: 10px;
}

.footer-section a {
  color: rgba(255,255,255,0.7);
}

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

.footer-bottom {
  text-align: center;
  padding-top: 30px;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
}

/* ==================== 工具类 ==================== */
.text-center {
  text-align: center;
}

.mt-4 {
  margin-top: 40px;
}

.hidden {
  display: none;
}

/* ==================== 加载动画 ==================== */
.loading {
  text-align: center;
  padding: 50px;
  color: var(--text-gray);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

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

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

.empty-state .icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
  color: var(--text-dark);
}

/* ==================== 响应式调整 ==================== */
@media (max-width: 768px) {
  .article-header h1 {
    font-size: 1.8rem;
  }
  
  .article-cover-inner {
    height: 200px;
    font-size: 4rem;
  }
  
  .article-content {
    font-size: 1rem;
  }
  
  .article-cta {
    padding: 30px 20px;
  }
  
  .article-cta h2 {
    font-size: 1.4rem;
  }
}
