﻿/* ===========================================================
   产品目录 · 移动端样式
   纯手写，无框架。改配色只看 :root 里的变量。
   =========================================================== */

:root {
  --brand: #2563eb;
  --brand-weak: #eff4ff;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #8a94a6;
  --line: #e7ecf3;
  --bg: #f6f8fb;
  --card: #fff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .05);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(76px + var(--safe-b));
}

body.no-scroll { overflow: hidden; }

button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- 顶部标题 ---------- */
.topbar {
  background: linear-gradient(120deg, #1d4ed8 0%, #2563eb 55%, #3b82f6 100%);
  color: #fff;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 16px;
}
.topbar-inner { max-width: 760px; margin: 0 auto; }
.topbar h1 { font-size: 19px; font-weight: 600; letter-spacing: .2px; }
.topbar p { margin-top: 2px; font-size: 12px; opacity: .85; }

/* ---------- 搜索 + 筛选 ---------- */
.sticky-tools {
  position: sticky; top: 0; z-index: 30;
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px;
  background: rgba(246, 248, 251, .92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
  max-width: 760px; margin: 0 auto;
}

.search {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
}
.search svg { width: 17px; height: 17px; color: var(--ink-3); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 14px; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }

.filter-btn {
  flex: none; position: relative;
  height: 38px; padding: 0 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
}
.filter-btn:active { background: #eef2f8; }

.badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--brand); color: #fff;
  font-size: 11px; line-height: 17px; text-align: center;
}

/* ---------- 快捷标签 ---------- */
.chips {
  display: flex; gap: 8px;
  padding: 10px 12px 4px;
  overflow-x: auto; scrollbar-width: none;
  max-width: 760px; margin: 0 auto;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  height: 32px; padding: 0 13px;
  border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2); white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }

/* ---------- 产品网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 12px 20px;
  max-width: 760px; margin: 0 auto;
}

@media (min-width: 620px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
}

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .16s ease;
}
.card:active { transform: scale(.985); }

.card-media {
  position: relative; aspect-ratio: 1 / 1; background: #f1f4f9; overflow: hidden;
}
.card-media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease;
}
.card.noimg .card-media::after {
  content: "暂无图片";
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 12px; color: var(--ink-3);
}

.card-body { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 3px; }
.card-name {
  font-size: 14px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-code { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.card-spec {
  font-size: 12px; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 骨架屏 */
.skeleton {
  aspect-ratio: 3 / 4; border-radius: var(--radius);
  background: linear-gradient(100deg, #eef2f7 30%, #f7f9fc 50%, #eef2f7 70%);
  background-size: 240% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }

/* 空状态 */
.empty {
  grid-column: 1 / -1; padding: 56px 20px; text-align: center; color: var(--ink-3);
}
.empty strong { display: block; margin-bottom: 6px; font-size: 15px; color: var(--ink-2); }
.empty button { margin-top: 16px; }

/* ---------- 底部操作条 ---------- */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; gap: 10px;
  padding: 10px 12px calc(10px + var(--safe-b));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(160%) blur(12px);
  border-top: 1px solid var(--line);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; border-radius: 12px; font-size: 15px; font-weight: 500;
  flex: 1; transition: opacity .15s, background .15s;
}
.btn:active { opacity: .82; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-ghost { background: var(--brand-weak); color: var(--brand); border: 1px solid #d8e3fb; }

/* ---------- 遮罩与底部面板 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16, 24, 40, .42);
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; flex-direction: column;
  max-height: 84vh;
  overflow: hidden;
  background: #fff;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 32px rgba(16, 24, 40, .14);
  transform: translateY(102%);
  visibility: hidden;
  transition: transform .28s cubic-bezier(.32, .72, 0, 1), visibility .28s;
  padding-bottom: var(--safe-b);
}
.sheet.open { transform: translateY(0); visibility: visible; }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; flex: none;
}
.sheet-head h2 { font-size: 16px; font-weight: 600; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: #f2f5f9; color: var(--ink-2);
}
.icon-btn svg { width: 16px; height: 16px; }

.sheet-body { padding: 0 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1; }

.sheet-foot {
  display: flex; gap: 10px; flex: none;
  padding: 10px 16px calc(12px + var(--safe-b));
  border-top: 1px solid var(--line);
}
.sheet-foot .btn { height: 42px; }

/* 筛选项 */
.group { padding: 6px 0 12px; }
.group h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.group-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  height: 33px; padding: 0 13px; border-radius: 9px;
  background: #f4f6fa; border: 1px solid transparent;
  font-size: 13px; color: var(--ink-2);
}
.tag.on { background: var(--brand-weak); border-color: var(--brand); color: var(--brand); font-weight: 500; }

/* ---------- 详情面板 ---------- */
.sheet-detail { max-height: 92vh; }
.detail-close { position: absolute; top: 12px; right: 12px; z-index: 3; background: rgba(255, 255, 255, .9); }

.gallery {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; background: #f1f4f9;
  flex: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery .slide { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 1 / 1; }
.gallery .slide img { width: 100%; height: 100%; object-fit: contain; }

.gallery-dots {
  display: flex; gap: 6px; justify-content: center; padding: 8px 0 2px; flex: none;
}
.gallery-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: #cfd6e2; transition: background .2s, width .2s;
}
.gallery-dots i.on { background: var(--brand); width: 14px; border-radius: 3px; }

.detail-body { padding: 12px 16px 16px; overflow-y: auto; }
.detail-name { font-size: 17px; font-weight: 600; }
.detail-code { margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.detail-spec { margin-top: 10px; font-size: 14px; color: var(--ink-2); }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.detail-tags span {
  font-size: 12px; color: var(--ink-2);
  background: #f4f6fa; border-radius: 6px; padding: 3px 8px;
}
.detail-desc {
  margin-top: 12px; font-size: 13px; line-height: 1.7; color: var(--ink-2);
  border-top: 1px dashed var(--line); padding-top: 12px;
}
.sheet-foot-fixed { border-top: 1px solid var(--line); }

/* ---------- 微信弹窗 ---------- */
.sheet-mini { max-height: 70vh; }
.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-bottom: 22px; }
#qrImg { width: 180px; height: 180px; border-radius: 12px; background: #f4f6fa; object-fit: contain; }
.qr-id { font-size: 13px; color: var(--ink-2); letter-spacing: .5px; }
.qr-tip { font-size: 12px; color: var(--ink-3); }

/* ---------- 回到顶部 ---------- */
.to-top {
  position: fixed; right: 14px; bottom: calc(84px + var(--safe-b)); z-index: 35;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, .95); border: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(16, 24, 40, .12);
  display: grid; place-items: center; color: var(--ink-2);
}
.to-top svg { width: 18px; height: 18px; }
.to-top[hidden] { display: none; }

/* 底部安全区内的页面留白 */
@supports (padding: max(0px)) {
  .bottombar { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
