/* ===== 基础变量 ===== */
:root {
  --accent-color: #ff9800;
  --accent-dark: #f57c00;
  --text-primary: #333;
  --text-secondary: #666;
  --text-light: #999;
  --bg-primary: #fff;
  --bg-secondary: #f5f5f5;
  --bg-dark: #263238;
  --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;
  --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: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

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

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

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

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

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

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

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

.nav a {
  font-weight: 500;
  transition: color 0.2s;
}

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

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

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

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

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

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

.breadcrumb .sep {
  margin: 0 8px;
  color: var(--text-light);
}

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

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

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

.hero-search {
  max-width: 500px;
  margin: 32px auto 0;
  display: flex;
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
}

.hero-search input {
  flex: 1;
  border: none;
  padding: 16px 20px;
  font-size: 15px;
  outline: none;
}

.hero-search button {
  background: var(--accent-color);
  color: var(--bg-primary);
  border: none;
  padding: 0 28px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.hero-search button:hover {
  background: var(--accent-dark);
}

/* ===== 分类导航 ===== */
.category-section {
  padding: 40px 0;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.category-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.category-nav a {
  padding: 10px 20px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.category-nav a:hover,
.category-nav a.active {
  background: var(--accent-color);
  color: var(--bg-primary);
  border-color: var(--accent-color);
}

/* ===== 产品卡片 ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}

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

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

.product-image {
  aspect-ratio: 4/3;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 48px;
}

.product-info {
  padding: 16px;
}

.product-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.product-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-color);
}

.product-rating {
  color: #ffc107;
  font-size: 13px;
}

.product-rating span {
  color: var(--text-light);
  margin-left: 4px;
}

.product-btn {
  display: block;
  width: 100%;
  padding: 10px;
  background: var(--accent-color);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

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

/* ===== 文章列表 ===== */
.article-section {
  padding: 40px 0;
  background: var(--bg-primary);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.article-list {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
}

.article-list h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

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

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

.article-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  transition: color 0.2s;
}

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

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

/* ===== 分类页布局 ===== */
.category-header {
  background: var(--bg-primary);
  padding: 24px 0;
  border-bottom: 1px solid var(--border-color);
}

.category-header h1 {
  font-size: 24px;
  margin-bottom: 4px;
}

.category-header .count {
  color: var(--text-secondary);
  font-size: 14px;
}

.filter-bar {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.filter-item {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-item:hover,
.filter-item.active {
  background: var(--accent-color);
  color: var(--bg-primary);
}

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

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  font-size: 14px;
  transition: all 0.2s;
}

.pagination a:hover {
  background: var(--bg-secondary);
}

.pagination .current {
  background: var(--accent-color);
  color: var(--bg-primary);
}

/* ===== 文章详情页 ===== */
.article-header {
  background: var(--bg-primary);
  padding: 24px 0;
}

.article-header .container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.article-actions {
  display: flex;
  gap: 12px;
}

.action-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.article-main {
  padding: 40px 0;
}

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

.article-content {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 32px;
}

.article-gallery {
  aspect-ratio: 16/10;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 64px;
  margin-bottom: 24px;
}

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

.article-meta-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.article-price {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-color);
}

.article-stock {
  color: #4caf50;
  font-weight: 500;
}

.article-stock.out {
  color: #f44336;
}

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

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

.article-body h3 {
  font-size: 18px;
  color: var(--text-primary);
  margin: 24px 0 12px;
}

.article-body ul {
  list-style: disc;
  padding-left: 24px;
  margin-bottom: 16px;
}

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

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

.sidebar-card {
  background: var(--bg-primary);
  border-radius: var(--radius);
  padding: 20px;
}

.sidebar-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.spec-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 13px;
}

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

.spec-list .label {
  color: var(--text-light);
}

.spec-list .value {
  color: var(--text-primary);
  font-weight: 500;
}

.contact-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--accent-color);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 12px;
}

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

.contact-btn.secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

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

/* ===== 评价 ===== */
.review-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

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

.review-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.review-author {
  font-weight: 600;
}

.review-date {
  color: var(--text-light);
  font-size: 12px;
}

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

/* ===== 页脚 ===== */
.footer {
  background: var(--bg-dark);
  color: var(--bg-primary);
  padding: 48px 0 24px;
}

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

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

.footer-brand p {
  opacity: 0.8;
  font-size: 14px;
  line-height: 1.6;
}

.footer-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

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

.footer-links a {
  opacity: 0.8;
  font-size: 14px;
  transition: opacity 0.2s;
}

.footer-links a:hover {
  opacity: 1;
  color: var(--accent-color);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  text-align: center;
  font-size: 13px;
  opacity: 0.6;
}

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

.error-content {
  max-width: 480px;
}

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

.error-title {
  font-size: 24px;
  margin-bottom: 12px;
}

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

.error-btn {
  display: inline-block;
  padding: 14px 32px;
  background: var(--accent-color);
  color: var(--bg-primary);
  border-radius: var(--radius);
  font-weight: 500;
  transition: background 0.2s;
}

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

/* ===== 响应式设计 ===== */
@media (max-width: 992px) {
  .article-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: 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: 12px var(--gap);
  }

  .nav {
    order: 3;
    width: 100%;
    gap: 20px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .search-box {
    width: auto;
    flex: 1;
    margin-left: 16px;
  }

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

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

  .category-nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

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

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

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

  .filter-bar {
    overflow-x: auto;
  }

  .article-header .container {
    flex-direction: column;
    gap: 16px;
  }

  .article-content {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

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