/* 商城前台样式(复用 style.css 中的设计变量与按钮/表单/模态框基础样式) */

.shop-body { background: var(--bg); }

/* ---------------- 顶栏 ---------------- */
.shop-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.shop-header-inner {
  max-width: 1180px;
  margin: 0 auto;
  height: 60px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.shop-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}
.shop-search {
  flex: 1;
  display: flex;
  gap: 8px;
  max-width: 460px;
}
.shop-search input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.shop-search input:focus { border-color: var(--primary); }

.shop-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  white-space: nowrap;
}
.shop-nav a { color: var(--text); }
.shop-nav a:hover { color: var(--primary); }
.shop-user { color: var(--muted); }

.shop-cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}
.shop-cart-btn:hover { background: var(--primary-dark); }
.cart-badge {
  margin-left: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #fff;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.cart-badge.hidden { display: none; }

.shop-tabs { display: none; }

/* ---------------- 主体 ---------------- */
.shop-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 18px 40px;
  min-height: 60vh;
}
.shop-title { font-size: 18px; margin-bottom: 14px; }
.shop-back { margin-bottom: 14px; }
.shop-panel { margin-top: 16px; }

.shop-hero {
  border-radius: 12px;
  padding: 26px 28px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, #6b3df5 100%);
  margin-bottom: 18px;
}
.shop-hero h2 { font-size: 22px; margin-bottom: 6px; }
.shop-hero p { font-size: 13px; opacity: .9; }

.shop-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.shop-cats button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text);
}
.shop-cats button:hover { border-color: var(--primary); color: var(--primary); }
.shop-cats button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.shop-count { color: var(--muted); font-size: 13px; }
.shop-sort { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.shop-sort select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}

/* ---------------- 商品网格 ---------------- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
.shop-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(20, 30, 60, .06);
  display: flex;
  flex-direction: column;
  transition: transform .12s ease, box-shadow .12s ease;
}
.shop-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(20, 30, 60, .12); }
.shop-card-link { display: block; color: inherit; }
.shop-card-info { padding: 12px 14px 0; }
.shop-card-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.shop-card-cat { font-size: 12px; color: var(--muted); margin-top: 4px; }
.shop-card-foot {
  padding: 10px 14px 14px;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.shop-price { color: var(--danger); font-size: 17px; font-weight: 700; }
.shop-price small { font-size: 12px; font-weight: 400; }
.shop-card .btn { flex-shrink: 0; }
.shop-stock-out { color: var(--muted); font-size: 12px; }

/* 商品图:图片加载失败时自动移除,露出底层占位块 */
.shop-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #eef1f7;
  overflow: hidden;
}
.shop-thumb img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.shop-ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .92);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 2px;
}

/* ---------------- 商品详情 ---------------- */
.shop-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 26px;
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 1px 3px rgba(20, 30, 60, .06);
}
.shop-detail .shop-thumb { border-radius: 10px; font-size: 60px; }
.shop-detail-name { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.shop-detail-price {
  font-size: 26px;
  color: var(--danger);
  font-weight: 700;
  margin-bottom: 14px;
}
.shop-meta { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.shop-meta .row { display: flex; font-size: 13px; }
.shop-meta .row span:first-child { width: 64px; color: var(--muted); flex-shrink: 0; }
.shop-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-bottom: 18px;
  white-space: pre-wrap;
}

.shop-qty { display: inline-flex; align-items: center; gap: 0; margin-right: 12px; }
.shop-qty button {
  width: 32px;
  height: 34px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 16px;
  line-height: 1;
}
.shop-qty button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.shop-qty button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.shop-qty input {
  width: 58px;
  height: 34px;
  border: 1px solid var(--border);
  border-left: none;
  border-right: none;
  text-align: center;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.shop-buy-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------------- 购物车 / 订单 ---------------- */
.shop-cart-item { display: flex; align-items: center; gap: 12px; }
.shop-cart-thumb { width: 60px; flex-shrink: 0; }
.shop-cart-thumb .shop-thumb { border-radius: 6px; font-size: 20px; }
.shop-empty {
  background: #fff;
  border-radius: 10px;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.shop-empty .btn { margin-top: 14px; }

.shop-summary {
  background: #fff;
  border-radius: 10px;
  padding: 16px 18px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}
.shop-summary .total { font-size: 15px; }
.shop-summary .total b { color: var(--danger); font-size: 22px; margin-left: 6px; }

/* ---------------- 个人中心 ---------------- */
.shop-profile { padding: 20px 22px; }
.shop-profile .field { max-width: 380px; }
.shop-profile hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---------------- 页脚 ---------------- */
.shop-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px 0 30px;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .shop-header-inner { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
  .shop-logo { font-size: 16px; }
  .shop-search { order: 3; flex: 1 1 100%; max-width: none; }
  .shop-nav a[data-route], .shop-nav .shop-user { display: none; }
  .shop-cart-btn { margin-left: auto; }

  .shop-tabs {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 0 14px 10px;
    font-size: 13px;
    -webkit-overflow-scrolling: touch;
  }
  .shop-tabs a { color: var(--muted); white-space: nowrap; padding-bottom: 4px; }
  .shop-tabs a.active { color: var(--primary); font-weight: 600; border-bottom: 2px solid var(--primary); }

  .shop-main { padding: 14px 14px 30px; }
  .shop-detail { grid-template-columns: 1fr; gap: 18px; padding: 16px; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .shop-hero { padding: 20px; }
  .shop-hero h2 { font-size: 18px; }
}

@media (max-width: 560px) {
  .shop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-card-foot { flex-direction: column; align-items: stretch; }
  .shop-card-foot .btn { width: 100%; }
  .shop-summary { justify-content: space-between; }
  .shop-buy-row .btn { flex: 1; }
}
