/* ========== 全局样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100vh;
  padding-bottom: 60px;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ========== 顶部导航 ========== */
.header {
  background: #fff;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  color: #333;
}

.header-contact {
  font-size: 28px;
  color: #333;
  cursor: pointer;
}

.back-btn {
  font-size: 16px;
  color: #333;
  cursor: pointer;
}

/* ========== 搜索条 ========== */
.search-bar {
  padding: 10px 15px;
  background: #fff;
  display: flex;
  align-items: center;
}

.search-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: #f0f0f0;
  border-radius: 20px;
  padding: 8px 15px;
}

.search-icon {
  font-size: 16px;
  margin-right: 8px;
  color: #999;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  color: #333;
  padding: 6px 0;
  outline: none;
}

.search-btn {
  background: #333;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  margin-left: 10px;
  cursor: pointer;
}

/* ========== 首页一行5图 ========== */
.goods-grid-five {
  display: flex;
  flex-wrap: wrap;
  padding: 10px 10px 0 10px;
}

.goods-grid-five .goods-card {
  width: calc(20% - 6px);
  margin: 0 3px 6px 3px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}

.goods-grid-five .goods-card img {
  width: 100%;
  display: block;
  aspect-ratio: 3/4;
  object-fit: cover;
}

.goods-grid-five .goods-info {
  padding: 6px 6px 8px 6px;
}

.goods-grid-five .goods-title {
  font-size: 11px;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  margin-bottom: 4px;
}

.goods-grid-five .goods-price {
  font-size: 13px;
  font-weight: bold;
  color: #e74c3c;
}

/* ========== 分类页一行4图 ========== */
.goods-grid-four {
  flex: 1;
  background: #fff;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
}

.goods-grid-four .goods-card {
  width: calc(25% - 6px);
  margin: 0 3px 6px 3px;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}

.goods-grid-four .goods-card img {
  width: 100%;
  display: block;
  aspect-ratio: 3/4;
  object-fit: cover;
}

.goods-grid-four .goods-info {
  padding: 5px 5px 6px 5px;
}

.goods-grid-four .goods-title {
  font-size: 11px;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  margin-bottom: 3px;
}

.goods-grid-four .goods-price {
  font-size: 12px;
  font-weight: bold;
  color: #e74c3c;
}

/* ========== 底部导航 ========== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  display: flex;
  justify-content: space-around;
  padding: 6px 0 8px 0;
  border-top: 1px solid #eee;
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
  color: #999;
}

.tab-item.active {
  color: #333;
  font-weight: bold;
}

.tab-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

/* ========== 分类页 ========== */
.top-category-nav {
  display: flex;
  background: #fff;
  padding: 10px 15px;
  gap: 10px;
  overflow-x: auto;
}

.top-cat-item {
  padding: 6px 20px;
  border-radius: 16px;
  background: #f0f0f0;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  white-space: nowrap;
}

.top-cat-item.active {
  background: #333;
  color: #fff;
}

.category-body {
  display: flex;
  height: calc(100vh - 200px);
}

.sub-category-list {
  width: 100px;
  background: #f8f8f8;
  overflow-y: auto;
}

.sub-cat-item {
  padding: 14px 8px;
  text-align: center;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  position: relative;
}

.sub-cat-item.active {
  background: #fff;
  color: #333;
  font-weight: bold;
}

.sub-cat-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: #333;
  border-radius: 0 2px 2px 0;
}

/* ========== 商品详情 ========== */
.swiper {
  width: 100%;
  height: 375px;
  background: #eee;
  overflow: hidden;
}

/* 详情页左侧轮播图容器：竖向 2:3 比例、宽度 44% 由文件末尾强制规则控制 */
.detail-images {
  position: relative;    /* 供轮播圆点/左右按钮 absolute 定位参照 */
}

/* 右侧文字信息区域：自动占剩余宽度 */
.detail-info {
  flex: 1;
  min-width: 0;
}

/* 覆盖全局 .swiper 的固定高度，让高度由 aspect-ratio 控制 */
.detail-images .swiper {
  height: 100%;
}

.detail-images .swiper-slide img,
.detail-images img {
  width: 100%;
  height: 100%;
  object-fit: cover;     /* 图片填充容器，不拉伸变形 */
}

/* 轮播点在竖向容器底部定位，不撑开布局 */
.detail-images .swiper-dots {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px;
  background: rgba(255, 255, 255, 0.6);
}

/* 详情头部与下方模块的间距（只保留必要间距） */
.detail-header {
  margin-bottom: 12px;
}

/* 图片网格紧贴详情头部，清除顶部多余间距 */
#imageGrid {
  margin-top: 0;
}

/* 移动端同样保持竖向比例 */
@media (max-width: 768px) {
  .detail-images {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    aspect-ratio: 2 / 3;  /* 移动端同样保持竖向比例 */
  }
}

.swiper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.swiper img.active {
  display: block;
}

.swiper-dots {
  text-align: center;
  padding: 8px;
  background: #fff;
}

.swiper-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ddd;
  margin: 0 4px;
}

.swiper-dot.active {
  background: #333;
}

.product-info {
  background: #fff;
  padding: 15px;
  margin-top: 8px;
}

.product-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
}

.product-price {
  font-size: 22px;
  font-weight: bold;
  color: #e74c3c;
  margin-bottom: 12px;
}

.product-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.8;
}

.image-grid {
  background: #fff;
  margin-top: 0;
  padding: 4px;
  /* 三列网格布局，多图并排显示 */
  display: grid;
  grid-template-columns: repeat(3, 1fr);   /* 固定三列 */
  gap: 4px;                                 /* 图片间距 */
}

.image-grid img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
  cursor: pointer;
}

.mini-guide {
  padding: 20px;
  text-align: center;
  font-size: 14px;
  color: #999;
}

/* ========== 搜索页 ========== */
.search-result {
  padding: 10px;
}

.search-suggest {
  padding: 20px 15px;
}

.hot-search h4 {
  font-size: 14px;
  color: #999;
  text-align: center;
  margin-bottom: 12px;
}

.hot-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hot-tag {
  padding: 8px 16px;
  background: #fff;
  border-radius: 16px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
}

/* ========== 联系方式页 ========== */
.contact-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px 30px;
  margin: 30px;
  text-align: center;
}

.contact-icon {
  font-size: 60px;
}

.contact-card h2 {
  font-size: 20px;
  margin: 16px 0 24px 0;
}

.qrcode {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  border: 1px solid #eee;
  margin-bottom: 24px;
}

.wechat-id {
  font-size: 16px;
  color: #333;
  margin-bottom: 8px;
}

.copy-btn {
  font-size: 18px;
  cursor: pointer;
  margin-left: 6px;
}

.work-time {
  font-size: 13px;
  color: #999;
}

/* ========== 电脑端适配 ========== */
@media (min-width: 768px) {
  .app {
    max-width: 1200px;
    margin: 0 auto;
  }

  .goods-grid-five .goods-card {
    width: calc(20% - 8px);
    margin: 0 4px 8px 4px;
  }

  .goods-grid-five .goods-title {
    font-size: 12px;
  }

  .goods-grid-five .goods-price {
    font-size: 14px;
  }

  .goods-grid-four .goods-card {
    width: calc(25% - 8px);
    margin: 0 4px 8px 4px;
  }

  .goods-grid-four .goods-title {
    font-size: 12px;
  }

  .goods-grid-four .goods-price {
    font-size: 13px;
  }

  .contact-card {
    max-width: 400px;
    margin: 60px auto;
  }

  .tab-bar {
    max-width: 1200px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* ========== Logo ========== */
.brand-wrap {
  display: flex;
  align-items: center;
}

.brand-logo {
  width: 28px;
  height: 28px;
  margin-right: 8px;
}

/* 产品详情页左侧轮播图：竖向比例 2:3，占宽度 44% */
.detail-images {
    flex: 0 0 44% !important;
    max-width: 44% !important;
    aspect-ratio: 2 / 3 !important;
    overflow: hidden;
    position: relative; /* 为左右切换按钮提供定位参考 */
}
.detail-images img,
.detail-images .swiper-slide img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* 右侧标题放大一号 */
.product-title {
    font-size: 18px !important;  /* 比默认16px大一号 */
    line-height: 1.4;
}

/* 右侧描述文字放大一号 */
.product-desc {
    font-size: 15px !important;  /* 比默认14px大一号 */
    line-height: 1.8;
}

/* 左右切换按钮样式（半透明，悬停时加深） */
.detail-swiper-prev,
.detail-swiper-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    font-size: 16px;
    color: #333;
    transition: background 0.2s;
    user-select: none;
}
.detail-swiper-prev { left: 8px; }
.detail-swiper-next { right: 8px; }
.detail-swiper-prev:hover,
.detail-swiper-next:hover {
    background: rgba(255, 255, 255, 0.85);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .detail-images {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        aspect-ratio: 2 / 3 !important;
    }
}
