/**
 * 号卡商城 - 商品展示样式
 * 依赖：style.css（:root变量）
 */

/* ===== 商城页面布局 ===== */
.shop-header {
  background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
  color: #fff;
  padding: 40px 20px;
  text-align: center;
  margin-bottom: 30px;
}
.shop-header h1 { font-size: 1.8rem; margin-bottom: 8px; }
.shop-header p { opacity: .85; font-size: .95rem; }

/* 筛选栏 */
.filter-bar {
  max-width: var(--max-width);
  margin: 0 auto 24px;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.filter-bar label { font-size: .88rem; color: var(--text-secondary); margin-right: 4px; }
.shop-search-box {
  display: flex;
  gap: 6px;
  margin-right: 16px;
}
.shop-search-box input {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .85rem;
  outline: none;
  width: 200px;
  transition: border-color .2s;
}
.shop-search-box input:focus { border-color: var(--primary); }
.shop-search-box button {
  padding: 6px 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: .85rem;
  cursor: pointer;
  font-weight: 500;
  transition: opacity .2s;
}
.shop-search-box button:hover { opacity: .85; }
.filter-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-white);
  color: var(--text-secondary);
  font-size: .85rem;
  cursor: pointer;
  transition: all .2s;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.sort-select {
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
  color: var(--text);
  background: var(--bg-white);
  cursor: pointer;
}

/* ===== 商品网格 ===== */
.product-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .product-grid { grid-template-columns: 1fr; }
}

/* ===== 商品卡片 ===== */
.product-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all .3s;
  display: flex;
  flex-direction: column;
  position: relative;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

/* 运营商标签 */
.product-operator {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  color: #fff;
  z-index: 2;
}
.product-operator.operator-dianxin { background: #e60012; }
.product-operator.operator-liantong { background: #e60012; }
.product-operator.operator-yidong { background: #007bff; }
.product-operator.operator-guangdian { background: #ff6900; }

/* 主图 - 正方形 */
.product-img-wrap {
  width: 100%;
  aspect-ratio: 1/1;
  background: var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform .3s;
}
.product-card:hover .product-img-wrap img {
  transform: scale(1.05);
}
.product-img-wrap img[src=""] + .product-img-placeholder,
.product-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 100%);
  color: var(--primary);
  font-size: 2.5rem;
}

/* 卡片内容 */
.product-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.product-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-name:hover { color: var(--primary); }

.product-package {
  font-size: .82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.5;
}
.product-package span {
  display: inline-block;
  background: var(--border-light);
  padding: 1px 8px;
  border-radius: 4px;
  margin-right: 4px;
  margin-bottom: 4px;
  font-size: .78rem;
}

.product-price {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.product-price .price-label { font-size: .8rem; color: var(--text-light); }
.product-price .price-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #e60012;
}
.product-price .price-unit { font-size: .8rem; color: var(--text-light); }

.product-restrict {
  font-size: .75rem;
  color: var(--text-light);
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.product-restrict .tag {
  background: #fef3c7;
  color: #92400e;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: .72rem;
}

/* 立即办理按钮 */
.product-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 12px 16px 16px;
  padding: 10px 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s;
  text-align: center;
  text-decoration: none;
}
.product-btn:hover { opacity: .85; }

/* ===== 加载状态 ===== */
.product-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--text-light);
  font-size: .95rem;
}
.product-loading .spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 分页器 ===== */
.pagination {
  max-width: var(--max-width);
  margin: 30px auto;
  padding: 0 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.page-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-white);
  color: var(--text-secondary);
  font-size: .85rem;
  cursor: pointer;
  transition: all .2s;
}
.page-btn:hover, .page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-info { font-size: .82rem; color: var(--text-light); margin: 0 8px; }

/* ===== 首页商品展示区（缩略版） ===== */
.home-products {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}
.home-products .product-grid {
  padding: 0;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px) {
  .home-products .product-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .home-products .product-grid { grid-template-columns: 1fr; }
}
.home-products .product-name { font-size: .92rem; }
.home-products .product-price .price-value { font-size: 1.2rem; }
.home-products .product-btn { padding: 8px 0; font-size: .85rem; }

/* 查看全部按钮 */
.view-all-btn {
  display: block;
  max-width: 200px;
  margin: 20px auto 0;
  padding: 10px 28px;
  background: var(--bg-white);
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all .2s;
}
.view-all-btn:hover { background: var(--primary); color: #fff; }

/* ===== 空状态 ===== */
.product-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--text-light);
}
.product-empty .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.product-empty p { font-size: .95rem; }
