/* ============================================================
 *  oo电竞 · 商品/服务单 模块样式
 *  客户端「分类」页(浅色橙黄 + 紫主题) + 后台商品管理
 *  只作用于 .sh- / .gd- 前缀的类,不影响 APP 其它页面的深色主题
 * ============================================================ */
:root {
  --sk-bg: #fdf7ea;
  --sk-bg2: #f7efe0;
  --sk-card: #fff;
  --sk-line: #efe3cd;
  --sk-txt: #2a2418;
  --sk-txt2: #8b7f66;
  --sk-purple: #7c3aed;
  --sk-purple2: #a855f7;
  --sk-red: #e11d48;
  --sk-amber: #b45309;
  --sk-amber-bg: linear-gradient(135deg, #fff6da, #ffe9b8);
}

/* 商品页整体接管滚动:内部两栏各自滚,页面本身不滚 */
body.shop-mode #app { height: 100vh; height: 100dvh; overflow: hidden; padding-bottom: 0; }
body.shop-mode::before { background: var(--sk-bg); }

.sh-top {
  /* 顶部安全区:iPhone 刘海/灵动岛那一条不能压住搜索框 */
  padding: calc(10px + var(--safe-top, env(safe-area-inset-top, 0px))) 12px 8px;
  background: linear-gradient(180deg, #fff9ec 0%, var(--sk-bg) 100%);
  border-bottom: 1px solid var(--sk-line);
}
.sh-search {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--sk-line); border-radius: 999px;
  padding: 7px 8px 7px 12px; box-shadow: 0 2px 8px rgba(160, 120, 30, .06);
}
.sh-search-ic { font-size: 14px; opacity: .6; }
.sh-search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 14px; color: var(--sk-txt); font-family: inherit;
}
.sh-search input::placeholder { color: #b3a88f; }
.sh-search input::-webkit-search-cancel-button { display: none; }
.sh-search button {
  border: 0; border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, var(--sk-purple), var(--sk-purple2));
  box-shadow: 0 3px 10px rgba(124, 58, 237, .3); cursor: pointer;
}
.sh-search button:active { transform: scale(.97); }

.sh-body {
  display: flex; align-items: stretch;
  /* 62px = 搜索条本身的高度,76px = 底部导航条;上下安全区都要扣掉,否则底下一排卡片会被导航条吃掉。
     dvh 是「真正看得见的那块高度」,手机浏览器地址栏收放时不会算错 */
  height: calc(100vh - 62px - 76px - var(--safe-top, env(safe-area-inset-top, 0px)) - var(--safe-bottom, env(safe-area-inset-bottom, 0px)));
  height: calc(100dvh - 62px - 76px - var(--safe-top, env(safe-area-inset-top, 0px)) - var(--safe-bottom, env(safe-area-inset-bottom, 0px)));
}

/* ---------- 左侧分类竖导 ---------- */
.sh-cats {
  width: 92px; flex: 0 0 92px; overflow-y: auto; background: var(--sk-bg2);
  padding: 8px 0 20px; -webkit-overflow-scrolling: touch;
}
.sh-cat {
  padding: 12px 6px; text-align: center; cursor: pointer;
  color: var(--sk-txt2); font-size: 12px; line-height: 1.35; transition: .16s;
}
.sh-cat .ic { font-size: 17px; margin-bottom: 3px; }
.sh-cat.on {
  background: linear-gradient(135deg, var(--sk-purple), var(--sk-purple2));
  color: #fff; font-weight: 700; border-radius: 12px; margin: 0 6px;
  box-shadow: 0 4px 14px rgba(124, 58, 237, .32);
}
.sh-cat-empty { padding: 20px 6px; text-align: center; font-size: 11px; color: var(--sk-txt2); }

/* ---------- 右侧 ---------- */
.sh-right { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--sk-bg); }
.sh-tags {
  /* 标签换成自动换行,不再横着滑(页面里任何一处都不再出现左右滑动) */
  display: flex; flex-wrap: wrap; gap: 7px; padding: 9px 10px 8px; flex: 0 0 auto;
}
.sh-tags::-webkit-scrollbar { display: none; }
.sh-tag {
  flex: 0 0 auto; padding: 5px 13px; border-radius: 999px; font-size: 12px; cursor: pointer;
  background: #fff; color: var(--sk-txt2); border: 1px solid var(--sk-line); white-space: nowrap;
}
.sh-tag.on {
  background: linear-gradient(135deg, var(--sk-purple), var(--sk-purple2));
  color: #fff; font-weight: 700; border-color: transparent;
  box-shadow: 0 3px 10px rgba(124, 58, 237, .28);
}

/* ---------- 双列瀑布流(只纵向滚,绝不左右滑)----------
 * 以前 column-count 直接架在滚动容器上:容器高度是定死的(撑满剩余屏幕),
 * 内容一超过两列能装下的高度,浏览器就自动往右边再加一列 → 多出来的列跑到屏幕外,
 * 页面能左右滑、卡片还被切掉一半。现在拆两层:
 *   外层 .sh-grid = 纵向滚动容器
 *   内层 .sh-in   = 高度自适应,双列在这里排列 —— 只会往下长,永远不横向溢出
 */
.sh-grid {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 24px;
  -webkit-overflow-scrolling: touch;
}
.sh-in { column-count: 2; column-gap: 9px; }
.sh-in .loading, .sh-in .empty { column-span: all; }
/* 老写法留着兜底(万一哪里还直接往 .sh-grid 里塞内容) */
.sh-grid .loading, .sh-grid .empty { column-span: all; }

.gd-card {
  break-inside: avoid; -webkit-column-break-inside: avoid; page-break-inside: avoid;
  background: var(--sk-card); border: 1px solid var(--sk-line); border-radius: 14px;
  margin: 0 0 9px; overflow: hidden; cursor: pointer;
  box-shadow: 0 3px 12px rgba(160, 120, 30, .07); transition: .16s;
}
.gd-card:active { transform: scale(.985); }
.gd-tagline { padding: 7px 7px 0; }
.gd-pill {
  display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  color: var(--sk-amber); background: var(--sk-amber-bg); border: 1px solid #f6dfae;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: top;
}
.gd-cover { position: relative; margin: 7px; border-radius: 11px; overflow: hidden; background: #efe6d5; }
.gd-cover img { width: 100%; display: block; aspect-ratio: 10 / 7; object-fit: cover; }
.gd-ov {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 7px 5px;
  font-size: 10.5px; color: #fff; line-height: 1.3;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .68));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gd-sold {
  position: absolute; right: 6px; top: 6px; padding: 2px 7px; border-radius: 999px;
  font-size: 9.5px; color: #fff; background: rgba(0, 0, 0, .45); backdrop-filter: blur(4px);
}
.gd-info { padding: 0 8px 9px; }
.gd-title {
  font-size: 13px; font-weight: 700; color: var(--sk-txt); line-height: 1.38;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gd-sub {
  font-size: 10.5px; color: var(--sk-txt2); margin-top: 3px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.gd-foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.gd-price { color: var(--sk-red); font-size: 11px; font-weight: 700; white-space: nowrap; }
.gd-price b { font-size: 16px; letter-spacing: -.3px; }
.gd-price i { font-style: normal; font-size: 10px; font-weight: 500; margin-left: 1px; }
.gd-buy {
  margin-left: auto; border: 0; border-radius: 999px; padding: 5px 12px; font-size: 11.5px;
  font-weight: 700; color: #fff; cursor: pointer; white-space: nowrap;
  background: linear-gradient(135deg, var(--sk-purple), var(--sk-purple2));
  box-shadow: 0 3px 9px rgba(124, 58, 237, .28);
}
.gd-buy:active { transform: scale(.95); }

/* ---------- 详情弹层 ---------- */
.sh-mask {
  position: fixed; inset: 0; z-index: 9999; background: rgba(20, 14, 4, .55);
  display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(2px);
}
.sh-sheet {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; position: relative;
  background: var(--sk-bg); border-radius: 20px 20px 0 0; padding-bottom: 18px;
  animation: sh-up .22s ease-out;
}
@keyframes sh-up { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.sh-sheet-close {
  position: absolute; right: 12px; top: 12px; z-index: 3; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0, 0, 0, .42); color: #fff; font-size: 14px; cursor: pointer;
}
.sh-d-cover { position: relative; border-radius: 20px 20px 0 0; overflow: hidden; }
.sh-d-cover img { width: 100%; display: block; aspect-ratio: 16 / 10; object-fit: cover; }
.sh-d-body { padding: 12px 14px 0; }
.sh-d-title { font-size: 17px; font-weight: 800; color: var(--sk-txt); margin-top: 7px; line-height: 1.4; }
.sh-d-sub { font-size: 12.5px; color: var(--sk-txt2); margin-top: 5px; }
.sh-d-row { display: flex; align-items: flex-end; margin-top: 11px; }
.sh-d-price { color: var(--sk-red); font-size: 13px; font-weight: 700; }
.sh-d-price b { font-size: 26px; letter-spacing: -.6px; }
.sh-d-price i { font-style: normal; font-size: 11px; font-weight: 500; }
.sh-d-desc {
  margin-top: 10px; padding: 11px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--sk-line);
  font-size: 12.5px; color: #554a35; line-height: 1.7;
}

/* ============================================================
 *  后台 · 商品管理
 * ============================================================ */
.gd-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.gd-tabs .t {
  padding: 7px 14px; border-radius: 10px; font-size: 13px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--txt2);
}
.gd-tabs .t.on { background: var(--grad-soft); color: var(--cyan); border-color: rgba(34, 211, 238, .45); font-weight: 700; }
.gd-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.gd-bar input, .gd-bar select {
  background: var(--surface); border: 1px solid var(--line); color: var(--txt);
  border-radius: 10px; padding: 8px 11px; font-size: 13px; font-family: inherit;
}
.gd-bar input { min-width: 190px; }
.gd-thumb {
  width: 62px; height: 43px; border-radius: 8px; object-fit: cover; display: block;
  border: 1px solid var(--line2); background: #0e1626;
}
.gd-name { font-weight: 700; }
.gd-dim { font-size: 12px; color: var(--txt3); }
.gd-pricecell { color: var(--gold); font-weight: 700; }
.gd-opt { display: flex; gap: 6px; flex-wrap: wrap; }
.gd-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.gd-pick .p {
  border: 2px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface2);
}
.gd-pick .p.on { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(34, 211, 238, .25); }
.gd-pick .p img { width: 100%; display: block; aspect-ratio: 3 / 2; object-fit: cover; }
.gd-pick .p .t { font-size: 11px; text-align: center; padding: 4px; color: var(--txt2); }
.gd-sub { font-size: 12px; color: var(--txt3); margin: -4px 0 10px; }
.gd-preview { margin-top: 8px; }
.gd-preview img { width: 150px; border-radius: 10px; border: 1px solid var(--line2); }

/* 后台弹窗里的两列表单 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 620px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
