/* ====================================================
   捷嘉商城 · 全站样式 v2.0
   支持 PC(≥1024px) + 平板(768~1024px) + 移动端(<768px)
   ==================================================== */

/* ---------- CSS变量 ---------- */
:root {
  --primary:   #e53e3e;
  --primary2:  #fc5c63;
  --accent:    #f6c90e;
  --bg:        #f5f5f7;
  --card-bg:   #ffffff;
  --text:      #1a1a2e;
  --muted:     #6b7280;
  --border:    #e5e7eb;
  --shadow:    0 2px 12px rgba(0,0,0,.07);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --radius:    12px;
  --radius-sm: 8px;
  --header-h:  64px;
  --bottom-nav-h: 60px;
  --sidebar-w: 240px;
  --content-max: 1200px;
}

/* ---------- 重置 & 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ---------- PC顶部导航 ---------- */
.pc-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
  height: var(--header-h);
}
.pc-header-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
}
.pc-logo {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary);
  white-space: nowrap;
  letter-spacing: -.5px;
  flex-shrink: 0;
}
.pc-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.pc-nav a {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: all .18s;
  white-space: nowrap;
}
.pc-nav a:hover { background: var(--bg); color: var(--text); }
.pc-nav a.active { color: var(--primary); background: #fff1f1; }

.pc-search {
  flex: 1;
  min-width: 0;
  max-width: 340px;
}
.pc-search form {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  transition: border-color .18s;
  background: var(--bg);
}
.pc-search form:focus-within { border-color: var(--primary); background: #fff; }
.pc-search input {
  flex: 1;
  border: none;
  padding: 9px 16px;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--text);
}
.pc-search button {
  padding: 0 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  border-radius: 0 999px 999px 0;
  transition: background .18s;
}
.pc-search button:hover { background: var(--primary2); }

.pc-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.pc-cart-btn, .pc-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: all .18s;
  position: relative;
}
.pc-cart-btn:hover, .pc-user-btn:hover { background: var(--bg); color: var(--text); }
.pc-cart-btn.active, .pc-user-btn.active { color: var(--primary); }
.pc-cart-btn .badge {
  position: absolute;
  top: 2px; right: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 5px;
  line-height: 1.4;
}
.pc-login-btn, .pc-reg-btn {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  transition: all .18s;
}
.pc-login-btn { color: var(--primary); border: 1.5px solid var(--primary); }
.pc-login-btn:hover { background: #fff1f1; }
.pc-reg-btn { background: var(--primary); color: #fff; }
.pc-reg-btn:hover { background: var(--primary2); }

/* ---------- PC主体布局 ---------- */
.pc-body {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 24px 24px 80px;
}
.pc-main { flex: 1; min-width: 0; }

/* ---------- Alert消息 ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 600;
}
.alert-ok { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-err { background: #fff1f2; color: #dc2626; border: 1px solid #fecdd3; }

/* ---------- 页面内容 ---------- */
.page-content { }

/* ---------- 顶部栏（移动端） ---------- */
.topbar {
  display: none; /* 移动端显示 */
  align-items: center;
  gap: 10px;
  padding: 10px 0 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
}
.topbar .title {
  flex: 1;
  font-size: 18px;
  font-weight: 900;
  color: var(--text);
}
.topbar .search {
  flex: 1;
  min-width: 0;
}
.topbar .search input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  background: var(--card-bg);
  outline: none;
  transition: border-color .18s;
}
.topbar .search input:focus { border-color: var(--primary); }

/* ---------- PC页面专用横幅 ---------- */
.pc-page-banner {
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #fee2e2 0%, #fde8d8 100%);
  padding: 32px 40px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.pc-page-banner img { max-height: 140px; border-radius: var(--radius-sm); }
.pc-page-banner .text h1 { font-size: 28px; font-weight: 900; color: var(--primary); }
.pc-page-banner .text p { color: var(--muted); margin-top: 6px; font-size: 15px; }

/* ---------- 分类标签栏 ---------- */
.category-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.category-bar a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: all .18s;
}
.category-bar a .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.category-bar a:hover, .category-bar a.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff1f1;
}

/* ---------- 移动端分类网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 0 0 16px;
}
.grid .item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.grid .icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
}
.grid .label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

/* ---------- 商品网格 (PC) ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.product-card .thumb-wrap {
  aspect-ratio: 4/3;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}
.product-card .thumb-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.product-card:hover .thumb-wrap img { transform: scale(1.04); }
.product-card .info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.product-card .name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}
.product-card .desc {
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.product-card .bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.product-card .tag {
  font-size: 11px;
  color: var(--muted);
}
.product-card .price-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.product-card .price {
  font-size: 18px;
  font-weight: 900;
  color: var(--primary);
}
.product-card .price-unit { font-size: 13px; font-weight: 600; color: var(--primary); }

/* ---------- 移动端卡片样式 ---------- */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card .row {
  display: flex;
  gap: 10px;
  padding: 10px;
  align-items: flex-start;
}
.card .thumb {
  width: 100px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}
.card .meta { flex: 1; min-width: 0; }
.card .meta .name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}
.card .meta .desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}
.card .meta .bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}
.tag { font-size: 11px; color: var(--muted); }

/* ---------- 区域标题 ---------- */
.section { margin-bottom: 20px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.section-head .h { font-size: 17px; font-weight: 900; color: var(--text); }
.section-head .more { font-size: 13px; color: var(--primary); font-weight: 700; }

/* 商品小横幅 */
.banner { border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.banner img { width: 100%; max-height: 160px; object-fit: cover; }

/* ---------- 价格 ---------- */
.price { color: var(--primary); font-weight: 900; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  transition: all .18s;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary2); box-shadow: 0 4px 12px rgba(229,62,62,.35); }
.btn.buy { background: linear-gradient(90deg, #f97316, #ef4444); color: #fff; }
.btn.buy:hover { box-shadow: 0 4px 12px rgba(239,68,68,.35); }
.btn.ghost { border-color: var(--border); color: var(--text); background: var(--card-bg); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.danger { background: #fff1f2; color: #dc2626; border-color: #fecdd3; }
.btn.danger:hover { background: #fde8e8; }
.btn.full { width: 100%; }
.btn.lg { padding: 13px 28px; font-size: 16px; }

/* ---------- 表单 ---------- */
.form { max-width: 480px; }
.form form { display: flex; flex-direction: column; gap: 10px; }
.form label { font-size: 13px; font-weight: 700; color: var(--muted); }
.form input, .form textarea, .form select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color .18s;
  background: var(--card-bg);
  width: 100%;
  color: var(--text);
}
.form input:focus, .form textarea:focus { border-color: var(--primary); }
.form textarea { min-height: 80px; resize: vertical; }

/* ---------- 支付方式 ---------- */
.pay-methods { display: flex; flex-wrap: wrap; gap: 10px; }
.pay-method {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all .18s;
  background: var(--card-bg);
  flex: 1;
  min-width: 140px;
}
.pay-method:has(input:checked) { border-color: var(--primary); background: #fff1f1; color: var(--primary); }
.pay-method input { display: none; }
.badge.wechat { background: #07c160; color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.badge.alipay { background: #1677ff; color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.badge.uvb { background: #8b5cf6; color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; }

/* ---------- 商品详情 ---------- */
.product-hero {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 16px;
}
.product-hero img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  display: block;
}
.product-hero .p { padding: 16px; }
.product-hero .t { font-size: 18px; font-weight: 900; line-height: 1.35; }
.product-hero .sub { color: var(--muted); font-size: 13px; margin-top: 10px; line-height: 1.7; }
.product-hero .stat {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

/* PC 商品详情两栏 */
.pc-product-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: flex-start;
}
.pc-product-img {
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  position: sticky;
  top: calc(var(--header-h) + 16px);
}
.pc-product-img img { width: 100%; height: 100%; object-fit: cover; }
.pc-product-info { display: flex; flex-direction: column; gap: 16px; }

/* ---------- 底部操作栏（商品详情移动端） ---------- */
.actionbar {
  position: fixed;
  bottom: var(--bottom-nav-h);
  left: 0; right: 0;
  z-index: 50;
  padding: 10px 12px;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,.07);
}
.actionbar .inner {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 500px;
  margin: 0 auto;
}
.actionbar .mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.actionbar .mini .i { width: 22px; height: 22px; background: var(--bg); border-radius: 6px; }
.actionbar .cta { display: flex; gap: 8px; flex: 1; }
.actionbar .cta form { flex: 1; }
.actionbar .cta .btn { width: 100%; }

/* ---------- 移动端底部导航 ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
}
.bottom-nav .inner {
  display: flex;
  height: var(--bottom-nav-h);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 4px;
  transition: color .18s;
}
.bottom-nav a svg { width: 20px; height: 20px; }
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a span { line-height: 1; }

/* ---------- 头像 ---------- */
.avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  flex-shrink: 0;
}

/* ---------- 聊天气泡 ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; min-height: 60px; }
.bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  line-height: 1.6;
  font-size: 13px;
  align-self: flex-start;
}
.bubble.me { align-self: flex-end; background: #fff1f1; border-color: #fecdd3; }
.bubble .meta { font-size: 11px; color: var(--muted); margin-top: 5px; }

/* ---------- 发货内容块 ---------- */
.delivery-block {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed rgba(34,197,94,.5);
  background: rgba(34,197,94,.05);
  margin-top: 10px;
}
.delivery-block .title { font-weight: 900; font-size: 14px; color: #16a34a; }
.delivery-block .content { margin-top: 6px; line-height: 1.7; word-break: break-word; font-size: 13px; }

/* ---------- 统计卡片 ---------- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.stat-card .num { font-size: 24px; font-weight: 900; }
.stat-card .label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 个人中心菜单 ---------- */
.me-menu { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; }
.me-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: all .18s;
}
.me-menu a:hover { background: #fff1f1; color: var(--primary); border-color: var(--primary); }
.me-menu a .arrow { color: var(--muted); font-size: 18px; }
.me-menu a .icon { font-size: 20px; margin-right: 10px; }

/* ---------- 空态占位 ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .emoji { font-size: 56px; margin-bottom: 14px; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); }
.empty-state p { font-size: 14px; margin-top: 6px; }
.empty-state .actions { margin-top: 20px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card-bg);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Footer ---------- */
.footer-icp {
  padding: 24px 0 8px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.footer-icp a { color: inherit; }
.footer-icp a:hover { text-decoration: underline; }

/* ---------- 通知提示 ---------- */
.notice {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* ---------- 订单状态徽章 ---------- */
.order-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.order-badge.paid { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.order-badge.pending { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }

/* ======================================================
   响应式断点
   ====================================================== */

/* 平板 & 小屏PC (768px ~ 1024px) */
@media (max-width: 1024px) {
  .pc-nav { display: none; }
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .pc-product-layout { grid-template-columns: 1fr; }
  .pc-product-img { position: static; aspect-ratio: 16/9; }
}

/* 移动端 (<768px) */
@media (max-width: 768px) {
  :root { --header-h: 0px; }

  .pc-header { display: none; }
  .pc-body { padding: 0 12px 72px; }
  .topbar { display: flex; }
  .pc-search { display: none; }

  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pc-page-banner { display: none; }
  .category-bar { display: none; }

  /* 移动端用卡片列表替代 */
  .product-grid .product-card .thumb-wrap { aspect-ratio: 3/2; }
  .product-grid .product-card .price { font-size: 15px; }

  .form { max-width: 100%; }
  .pc-product-layout { grid-template-columns: 1fr; }

  .bottom-nav { display: block; }
}

/* 只有PC才显示底部导航隐藏 */
@media (min-width: 769px) {
  .bottom-nav { display: none; }
  .actionbar { bottom: 0; }
}

/* 超小屏 */
@media (max-width: 400px) {
  .product-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .pc-body { padding: 0 8px 70px; }
}
