/* 云顶商城 - 正规商城风格 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #c41e3a;
  --brand-dark: #a01830;
  --brand-soft: #fff1f2;
  --price: #c41e3a;
  --ok: #059669;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(17, 24, 39, 0.06);
  --nav-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --max: 1200px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: calc(60px + var(--safe-b));
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }
ul { list-style: none; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar-side { min-width: 40px; }
.brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  color: var(--brand);
  white-space: nowrap;
  text-align: center;
  justify-self: center;
}
.topbar-actions {
  display: flex; gap: 4px; justify-content: flex-end; align-items: center;
}
.icon-btn {
  position: relative; width: 40px; height: 40px;
  border: 0; background: transparent; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; color: var(--text);
}
.badge {
  position: absolute; top: 4px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--brand); color: #fff;
  font-size: 10px; border-radius: 8px;
  display: grid; place-items: center; font-weight: 700;
}

.wrap { width: min(var(--max), 100%); margin: 0 auto; padding: 12px 14px 24px; }
.page-title { font-size: 1.25rem; font-weight: 700; margin: 4px 0 14px; }

/* 分类导航 - 正规商城风格 */
.cat-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 8px 10px;
  margin-bottom: 14px;
}
.cat-scroll {
  display: flex; gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 20%;
  min-width: 68px;
  max-width: 88px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 4px 2px 6px;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  transition: color .15s;
}
.cat-chip:active { transform: none; opacity: .85; }
.cat-chip .ic {
  width: 44px; height: 44px; border-radius: 50%;
  background: #f5f6f8;
  color: #4b5563;
  display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.cat-chip.active .ic,
.cat-chip:hover .ic {
  background: var(--brand-soft);
  color: var(--brand);
}
.cat-chip span {
  font-size: .75rem;
  color: #4b5563;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.cat-chip.active span {
  color: var(--brand);
  font-weight: 700;
}
@media (min-width: 768px) {
  .cat-chip { flex: 1 1 0; max-width: none; min-width: 0; }
  .cat-scroll { justify-content: space-between; }
}

/* Banner 轮播 */
.banner {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 6.5;
  background: linear-gradient(120deg, #1f2937, #7f1d1d);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.banner-track {
  display: flex; height: 100%;
  transition: transform .45s cubic-bezier(.22,.8,.28,1);
}
.banner-slide {
  flex: 0 0 100%; height: 100%; position: relative;
}
.banner-slide img {
  width: 100%; height: 100%; object-fit: cover;
}
.banner-slide .cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 18px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  color: #fff;
}
.banner-slide .cap strong {
  display: block; font-size: clamp(1.15rem, 3.5vw, 1.6rem); font-weight: 800;
}
.banner-slide .cap em {
  font-style: normal; font-size: .85rem; opacity: .9;
}
.banner-dots {
  position: absolute; bottom: 10px; right: 14px;
  display: flex; gap: 6px;
}
.banner-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.45);
}
.banner-dots i.on { background: #fff; width: 14px; border-radius: 4px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 8px 0 12px;
}
.sec-head h2 {
  font-size: 1.05rem; font-weight: 800;
  display: flex; align-items: center; gap: 8px;
}
.sec-head h2::before {
  content: ''; width: 3px; height: 1em; background: var(--brand); border-radius: 2px;
}
.sec-head a { font-size: .82rem; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}
@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  body { padding-bottom: 40px; }
  .bottom-nav { display: none !important; }
  .banner { aspect-ratio: 21 / 7; }
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  animation: fadeUp .4s ease both;
  display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(17,24,39,.1); }
.product-card .thumb {
  aspect-ratio: 1; background: #f3f4f6; overflow: hidden; position: relative;
}
.product-card .thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s;
}
.product-card:hover .thumb img { transform: scale(1.04); }
.product-card .tag {
  position: absolute; left: 8px; top: 8px;
  background: rgba(196,30,58,.92); color: #fff;
  font-size: .65rem; font-weight: 700;
  padding: 2px 6px; border-radius: 4px;
}
.product-card .info { padding: 10px 10px 12px; flex: 1; display: flex; flex-direction: column; }
.product-card .name {
  font-size: .88rem; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.4em; color: #1f2937;
}
.product-card .sub {
  margin-top: 4px; font-size: .72rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.product-card .bottom {
  margin-top: auto; padding-top: 8px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
}
.product-card .price {
  color: var(--price); font-weight: 800; font-size: 1.05rem;
}
.product-card .price small { font-size: .7rem; font-weight: 600; }
.product-card .market {
  font-size: .72rem; color: #9ca3af; text-decoration: line-through; margin-left: 4px; font-weight: 400;
}
.product-card .sales { font-size: .7rem; color: #9ca3af; }

/* Detail */
.detail-layout { display: grid; gap: 16px; }
@media (min-width: 768px) {
  .detail-layout { grid-template-columns: 1fr 1fr; align-items: start; gap: 28px; }
}
.detail-img {
  border-radius: var(--radius); overflow: hidden;
  background: #fff; aspect-ratio: 1; box-shadow: var(--shadow);
}
.detail-img img { width: 100%; height: 100%; object-fit: cover; }
.detail-price {
  color: var(--price); font-size: 1.75rem; font-weight: 800; margin: 10px 0 4px;
}
.detail-price .market {
  font-size: .95rem; color: #9ca3af; text-decoration: line-through;
  font-weight: 400; margin-left: 8px;
}
.detail-meta { color: var(--muted); font-size: .88rem; margin-bottom: 14px; }
.cat-link {
  display: inline-block; margin-bottom: 8px;
  font-size: .8rem; color: var(--brand); background: var(--brand-soft);
  padding: 2px 10px; border-radius: 999px; font-weight: 600;
}
.detail-desc {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; margin-top: 16px; box-shadow: var(--shadow);
  white-space: pre-wrap; line-height: 1.75; color: #374151;
}
.qty-row { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.qty-ctrl {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff;
}
.qty-ctrl button { width: 36px; height: 36px; border: 0; background: #f9fafb; cursor: pointer; }
.qty-ctrl input { width: 48px; text-align: center; border: 0; height: 36px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border: 0; border-radius: 10px;
  font-weight: 600; cursor: pointer; transition: filter .15s, transform .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: #fff; border: 1px solid var(--line); color: var(--text); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 22px; font-size: 1.02rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.actions .btn { flex: 1; min-width: 120px; }

.form-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.form-card h3 {
  font-size: .98rem; margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .84rem; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; background: #fafafa;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); background: #fff;
}

.pay-options { display: grid; gap: 10px; }
.pay-option {
  display: flex; align-items: center; gap: 12px; padding: 13px;
  border: 2px solid var(--line); border-radius: 12px; cursor: pointer;
}
.pay-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.pay-option input { accent-color: var(--brand); width: 18px; height: 18px; }
.pay-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center; font-weight: 700; font-size: .75rem; color: #fff;
}
.pay-icon.alipay { background: #1677ff; }
.pay-icon.wxpay { background: #07c160; }
.pay-icon.douyin { background: #161823; }

.cart-item, .order-item {
  display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.cart-item:last-child, .order-item:last-child { border-bottom: 0; }
.cart-item img, .order-item img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: #f3f4f6;
}
.cart-item .meta, .order-item .meta { flex: 1; min-width: 0; }
.cart-item .name { font-weight: 600; font-size: .92rem; }
.cart-item .price { color: var(--price); margin-top: 4px; font-weight: 700; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: .95rem; }
.summary-row.total {
  font-size: 1.08rem; font-weight: 700; border-top: 1px dashed var(--line);
  margin-top: 8px; padding-top: 14px;
}
.summary-row.total span:last-child { color: var(--price); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b); height: calc(54px + var(--safe-b));
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  font-size: .68rem; color: var(--muted);
}
.bottom-nav a.active { color: var(--brand); font-weight: 700; }
.bottom-nav svg { width: 22px; height: 22px; }

.status-pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
}
.status-0 { background: #fff7ed; color: #c2410c; }
.status-1 { background: #ecfdf5; color: #047857; }
.status-2 { background: #eff6ff; color: #1d4ed8; }
.status-3 { background: #f3f4f6; color: #4b5563; }
.status-4, .status-5 { background: #fef2f2; color: #b91c1c; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%) translateY(-8px);
  background: rgba(17,24,39,.92); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: .88rem; z-index: 100; opacity: 0; pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: .9rem; }
.alert-success { background: #ecfdf5; color: #047857; }
.alert-error { background: #fef2f2; color: #b91c1c; }
.alert-info { background: #eff6ff; color: #1d4ed8; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .88rem; margin-bottom: 10px; }
.qr-box { text-align: center; padding: 24px; background: var(--surface); border-radius: var(--radius); }
.qr-box img { margin: 16px auto; width: 220px; height: 220px; }

.site-footer {
  margin-top: 28px; padding: 20px 0 8px; text-align: center;
  color: #9ca3af; font-size: .78rem; border-top: 1px solid var(--line);
}
@media (max-width: 959px) {
  .site-footer { display: none; }
}
