/* ============================================
   川菜 - 食谱集风格样式表
   www.sichuanwaimai.cn
   ============================================ */

/* CSS 变量 */
:root {
  --accent-color: #e91e63;
  --primary-color: #d32f2f;
  --secondary-color: #ff5722;
  --text-color: #333;
  --text-light: #666;
  --text-muted: #999;
  --bg-color: #fff;
  --bg-light: #f5f5f5;
  --bg-warm: #fff8f0;
  --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;
  --gap: 24px;
}

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

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

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s;
}

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

ul {
  list-style: none;
}

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

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}

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

.nav a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-color);
  padding: 8px 0;
  border-bottom: 2px solid transparent;
}

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

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-light);
  border-radius: 24px;
  padding: 8px 16px;
  width: 240px;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  flex: 1;
  font-size: 14px;
}

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

/* ============================================
   Hero Section
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--bg-warm) 0%, #fff 100%);
  padding: 60px 0;
  text-align: center;
}

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

.hero-subtitle {
  font-size: 20px;
  color: var(--text-light);
  margin-bottom: 32px;
}

.hero-tags {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 8px 20px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 14px;
  color: var(--text-light);
  transition: all 0.3s;
}

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

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

/* ============================================
   区块标题
   ============================================ */
.section {
  padding: 48px 0;
}

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

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.section-more {
  font-size: 14px;
  color: var(--text-muted);
}

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

/* ============================================
   卡片网格 - 三列布局
   ============================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

/* 卡片组件 */
.card {
  background: #fff;
  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 {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--bg-light);
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.card:hover .card-image img {
  transform: scale(1.05);
}

.card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  background: var(--primary-color);
  color: #fff;
  font-size: 12px;
  border-radius: 12px;
}

.card-save {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.3s;
}

.card-save:hover {
  background: #fff;
  color: var(--accent-color);
}

.card-content {
  padding: 16px;
}

.card-category {
  font-size: 12px;
  color: var(--primary-color);
  margin-bottom: 8px;
}

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

.card-desc {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

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

/* 难度标签 */
.difficulty-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 4px;
}

.difficulty-easy {
  background: #e8f5e9;
  color: #2e7d32;
}

.difficulty-medium {
  background: #fff3e0;
  color: #ef6c00;
}

.difficulty-hard {
  background: #ffebee;
  color: #c62828;
}

/* ============================================
   分类筛选
   ============================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 14px;
  color: var(--text-light);
}

.filter-btn {
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

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

/* ============================================
   面包屑
   ============================================ */
.breadcrumb {
  padding: 16px 0;
  font-size: 14px;
  color: var(--text-muted);
}

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

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

.breadcrumb .sep {
  margin: 0 8px;
}

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

/* ============================================
   分类页头部
   ============================================ */
.category-header {
  background: var(--bg-warm);
  padding: 40px 0;
  margin-bottom: 24px;
}

.category-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 8px;
}

.category-desc {
  font-size: 16px;
  color: var(--text-light);
}

/* ============================================
   文章详情页
   ============================================ */
.article-header {
  text-align: center;
  padding: 40px 0;
}

.article-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 16px;
  line-height: 1.3;
}

.article-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  color: var(--text-muted);
}

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

.article-featured-image {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 40px;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.article-featured-image img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.article-content {
  max-width: 800px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.8;
  color: var(--text-color);
}

.article-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 32px 0 16px;
  color: var(--text-color);
}

.article-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--text-color);
}

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

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

.article-content ul li {
  list-style: disc;
  margin-bottom: 8px;
}

.article-content ol li {
  list-style: decimal;
  margin-bottom: 8px;
}

.article-content img {
  width: 100%;
  border-radius: var(--radius);
  margin: 24px 0;
}

/* 食材清单 */
.ingredient-list {
  background: var(--bg-light);
  padding: 24px;
  border-radius: var(--radius);
  margin: 24px 0;
}

.ingredient-list h3 {
  margin-top: 0;
  font-size: 18px;
}

.ingredient-list ul {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ingredient-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-color);
}

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

/* 步骤 */
.steps {
  margin: 32px 0;
}

.step {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.step-number {
  width: 36px;
  height: 36px;
  background: var(--primary-color);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-content p {
  margin: 0;
}

/* 操作按钮 */
.action-bar {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 40px 0;
  padding: 24px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

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

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

.btn-primary:hover {
  background: #b71c1c;
}

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

.btn-secondary:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* ============================================
   侧边栏文章列表
   ============================================ */
.sidebar-section {
  background: var(--bg-light);
  padding: 24px;
  border-radius: var(--radius-lg);
}

.sidebar-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-color);
}

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

.article-list-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius);
  transition: box-shadow 0.3s;
}

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

.article-list-item img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius);
}

.article-list-info {
  flex: 1;
}

.article-list-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-list-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* 三栏底部 */
.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  margin-top: 48px;
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-list a {
  font-size: 14px;
  color: var(--text-light);
  padding: 4px 0;
}

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

.link-list a::before {
  content: '•';
  margin-right: 8px;
  color: var(--primary-color);
}

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

.page-btn {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

.page-btn:hover,
.page-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.page-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   加载更多
   ============================================ */
.load-more {
  text-align: center;
  margin: 40px 0;
}

.btn-load-more {
  padding: 12px 48px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-load-more:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* ============================================
   页脚 Footer
   ============================================ */
.footer {
  background: var(--bg-light);
  padding: 48px 0 24px;
  margin-top: 48px;
}

.footer-grid-4 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 32px;
}

.footer-brand {
  max-width: 300px;
}

.footer-brand .logo {
  margin-bottom: 16px;
}

.footer-desc {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
}

.footer-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-color);
}

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

.footer-links a {
  font-size: 14px;
  color: var(--text-light);
}

.footer-links a:hover {
  color: var(--primary-color);
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

/* ============================================
   404 页面
   ============================================ */
.error-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 0;
}

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

.error-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 16px;
}

.error-desc {
  font-size: 16px;
  color: var(--text-light);
  margin-bottom: 32px;
}

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

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

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

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 16px;
  }

  .search-box {
    width: 100%;
    order: 2;
  }

  .hero-title {
    font-size: 32px;
  }

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

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

  .footer-grid-4 {
    grid-template-columns: 1fr;
    gap: 32px;
  }

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

  .ingredient-list ul {
    grid-template-columns: 1fr;
  }

  .action-bar {
    flex-wrap: wrap;
  }

  .article-title {
    font-size: 24px;
  }

  .category-title {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  :root {
    --gap: 16px;
  }

  .hero {
    padding: 40px 0;
  }

  .section {
    padding: 32px 0;
  }

  .error-code {
    font-size: 80px;
  }
}
