/* ========================================
   统一组件系统 (Component System)
   ======================================== */

/* ----- CSS Reset (必须) ----- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ----- Grid System ----- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--s-gap);
}

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

@media (max-width: 991px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ----- Card Grid (列表页统一) ----- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-gap);
}

@media (max-width: 991px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

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

/* ----- 统一卡片结构 (必须) ----- */
.card {
  background: var(--c-bg-card);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

/* 图片比例 4:3 (必须) */
.card-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

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

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

/* 卡片内容区 */
.card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* 标题高度一致 (必须) */
.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--c-heading);
  margin-bottom: 8px;
  min-height: 48px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.section-light .card-title {
  color: var(--c-heading-dark);
}

/* 描述最多2行 (必须) */
.card-desc {
  font-size: 14px;
  color: var(--c-text);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.section-light .card-desc {
  color: var(--c-text-dark);
}

/* 按钮底部对齐 (必须) */
.card-body .btn-sm,
.card-body .btn-outline {
  margin-top: auto;
  align-self: flex-start;
}

/* ----- 列表页卡片变体 ----- */
.card-product .card-image::after {
  content: 'In Stock';
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--c-accent);
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.card-blog .card-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--c-text-dim);
  margin-bottom: 8px;
}

.card-case .card-stats {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--c-border);
}

.card-case .stat {
  text-align: center;
}

.card-case .stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-accent);
}

.card-case .stat-label {
  font-size: 11px;
  color: var(--c-text-dim);
}

/* ----- 详情页布局 ----- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

@media (max-width: 991px) {
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.detail-image-wrap {
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-bg);
}

.detail-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.detail-category {
  display: inline-block;
  background: var(--c-accent);
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.detail-title {
  font-size: 32px;
  color: var(--c-heading-dark);
  margin-bottom: 16px;
  line-height: 1.3;
}

.detail-desc {
  font-size: 16px;
  color: var(--c-text-dark);
  margin-bottom: 24px;
  line-height: 1.6;
}

.detail-specs {
  background: var(--c-bg-light);
  border-radius: var(--r-md);
  padding: 20px;
  margin-bottom: 24px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--c-border-l);
}

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

.spec-label {
  font-weight: 500;
  color: var(--c-text-dark);
}

.spec-value {
  color: var(--c-text-dim);
}

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

/* ----- 内容布局 ----- */
.content-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 48px;
}

@media (max-width: 991px) {
  .content-layout {
    grid-template-columns: 1fr;
  }
}

.content-main h2 {
  font-size: 24px;
  margin: 32px 0 16px;
  color: var(--c-heading-dark);
}

.content-main h2:first-child {
  margin-top: 0;
}

.content-main p {
  margin-bottom: 16px;
  color: var(--c-text-dark);
}

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

.content-main li {
  margin-bottom: 8px;
  color: var(--c-text-dark);
}

.content-sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.sidebar-box {
  background: var(--c-bg-light);
  border: 1px solid var(--c-border-l);
  border-radius: var(--r-md);
  padding: 24px;
  margin-bottom: 24px;
}

.sidebar-box h4 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--c-heading-dark);
}

.sidebar-box p {
  font-size: 14px;
  color: var(--c-text-dark);
  margin-bottom: 16px;
}

/* ----- 介绍页布局 ----- */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

.info-grid.image-right {
  direction: rtl;
}

.info-grid.image-right > * {
  direction: ltr;
}

@media (max-width: 991px) {
  .info-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.info-image img {
  width: 100%;
  border-radius: var(--r-md);
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.info-content h2 {
  font-size: 32px;
  margin-bottom: 24px;
  color: var(--c-heading-dark);
}

.info-content p {
  font-size: 16px;
  color: var(--c-text-dark);
  margin-bottom: 16px;
  line-height: 1.7;
}

/* ----- 统计数据模块 ----- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 991px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.stat-card {
  text-align: center;
  padding: 32px 24px;
  background: var(--c-bg-card);
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
}

.stat-number {
  font-size: 48px;
  font-weight: 800;
  color: var(--c-accent);
  line-height: 1;
  margin-bottom: 8px;
}

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

/* ----- 筛选栏 ----- */
.filter-bar {
  background: var(--c-bg-2);
  padding: 20px 0;
  border-bottom: 1px solid var(--c-border);
}

.filter-inner {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-label {
  font-size: 14px;
  color: var(--c-text);
  margin-right: 8px;
}

.filter-select {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  padding: 8px 16px;
  color: var(--c-text);
  font-size: 14px;
  min-width: 160px;
}

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

.filter-tag {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--c-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tag:hover,
.filter-tag.active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #fff;
}

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

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--c-text);
}

.breadcrumb a {
  color: var(--c-text);
  transition: color 0.2s ease;
}

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

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

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

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  color: var(--c-text);
  font-size: 14px;
  transition: all 0.2s ease;
}

.page-link:hover,
.page-link.active {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: #fff;
}

/* ----- 按钮尺寸 ----- */
.btn-lg {
  height: 52px;
  padding: 0 32px;
  font-size: 16px;
}

.btn-sm {
  height: 36px;
  padding: 0 20px;
  font-size: 13px;
}

/* ----- 工具类 ----- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
