/* 昆虫饲养网站 - 食谱风格样式 */
/* 主色调: #ff9800 (橙色) */

/* ==================== CSS 变量 ==================== */
:root {
  --accent-color: #ff9800;
  --accent-dark: #e65100;
  --accent-light: #fff3e0;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg-primary: #fff;
  --bg-secondary: #f5f5f5;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1200px;
  --header-height: 64px;
}

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

html {
  scroll-behavior: smooth;
}

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

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

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

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

ul, ol {
  list-style: none;
}

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

.main-content {
  background: var(--bg-primary);
  min-height: calc(100vh - var(--header-height) - 200px);
}

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

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-color);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
}

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

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

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

.nav a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-color);
  border-radius: 2px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-radius: 20px;
  padding: 8px 16px;
  gap: 8px;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  width: 180px;
  font-size: 0.9rem;
}

.search-box button {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

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

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px;
  margin-bottom: 30px;
}

.footer-section h4 {
  font-size: 1rem;
  margin-bottom: 15px;
  color: var(--accent-color);
}

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

.footer-section a {
  color: #ccc;
  font-size: 0.9rem;
}

.footer-section a:hover {
  color: var(--accent-color);
}

.footer-bottom {
  border-top: 1px solid #444;
  padding-top: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.hero-title span {
  color: var(--accent-color);
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 30px;
}

.hero-cta {
  display: inline-flex;
  gap: 15px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 25px;
  font-weight: 500;
  transition: all 0.3s;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

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

.btn-primary:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn-secondary {
  background: #fff;
  color: var(--accent-color);
  border: 2px solid var(--accent-color);
}

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

/* ==================== 特色区块 ==================== */
.section {
  padding: 50px 0;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

/* ==================== 卡片组件 ==================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
}

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

.card-image {
  aspect-ratio: 16/10;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 3rem;
}

.card-body {
  padding: 20px;
}

.card-category {
  font-size: 0.75rem;
  color: var(--accent-color);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
}

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

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

.card-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ==================== 内容列表 ==================== */
.content-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.content-item {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s;
}

.content-item:hover {
  box-shadow: var(--shadow-hover);
}

.content-thumb {
  width: 200px;
  height: 130px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2.5rem;
}

.content-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.content-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

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

.content-meta {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==================== 侧边栏列表 ==================== */
.sidebar-section {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-light);
}

.sidebar-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-list li:last-child {
  border-bottom: none;
}

.sidebar-list a {
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-list a::before {
  content: '•';
  color: var(--accent-color);
}

.sidebar-list a:hover {
  color: var(--accent-color);
}

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

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

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

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

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

.breadcrumb li:last-child {
  color: var(--text-muted);
}

/* ==================== 分类头部 ==================== */
.category-header {
  background: var(--bg-primary);
  padding: 40px 0;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.category-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.category-stats {
  color: var(--text-muted);
  font-size: 0.95rem;
}

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

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.3s;
}

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

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

.pagination .prev,
.pagination .next {
  width: auto;
  padding: 0 16px;
}

/* ==================== 文章页 ==================== */
.article-header {
  background: var(--bg-primary);
  padding: 40px 0;
  text-align: center;
}

.article-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 20px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.article-meta {
  display: flex;
  justify-content: center;
  gap: 25px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

.article-featured-image {
  width: 100%;
  max-width: 800px;
  height: 400px;
  background: var(--bg-secondary);
  margin: 0 auto 40px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 4rem;
}

.article-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 50px;
}

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 35px 0 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-light);
}

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 25px 0 12px;
  color: var(--accent-dark);
}

.article-content p {
  margin-bottom: 16px;
  line-height: 1.8;
  color: var(--text-secondary);
}

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

.article-content ul {
  list-style: disc;
}

.article-content ol {
  list-style: decimal;
}

.article-content li {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* 步骤说明样式 */
.step-list {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.step-list li {
  position: relative;
  padding-left: 50px;
  margin-bottom: 20px;
  min-height: 40px;
}

.step-list li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  background: var(--accent-color);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

/* 食材清单样式 */
.ingredient-list {
  background: var(--accent-light);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.ingredient-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-color);
}

.ingredient-list li:last-child {
  border-bottom: none;
}

.ingredient-list li::before {
  content: '✓';
  color: var(--accent-color);
  font-weight: bold;
}

/* 提示框样式 */
.tip-box {
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  padding: 15px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
}

.tip-box.warning {
  background: #fff3e0;
  border-left-color: var(--accent-color);
}

/* ==================== 相关文章 ==================== */
.related-section {
  background: var(--bg-secondary);
  padding: 40px 0;
}

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

.related-card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.related-thumb {
  height: 140px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 2rem;
}

.related-info {
  padding: 15px;
}

.related-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ==================== 404 页面 ==================== */
.error-page {
  min-height: calc(100vh - var(--header-height) - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1;
  margin-bottom: 20px;
  opacity: 0.8;
}

.error-title {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 15px;
}

.error-desc {
  color: var(--text-secondary);
  margin-bottom: 30px;
  max-width: 400px;
}

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

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

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

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
  }

  .search-box {
    display: none;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .hero-cta {
    flex-direction: column;
    width: 100%;
    max-width: 280px;
  }

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

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

  .content-thumb {
    width: 100%;
    height: 180px;
  }

  .article-title {
    font-size: 1.5rem;
  }

  .article-meta {
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
  }

  .article-featured-image {
    height: 220px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 30px;
  }

  .error-code {
    font-size: 5rem;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 30px 0;
  }

  .section-title {
    font-size: 1.2rem;
  }

  .card-body {
    padding: 15px;
  }

  .pagination a,
  .pagination span {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
}
