/* ============ 服装溯源平台 · 查询页样式 ============ */
:root {
  --brand: #2f5d50;          /* 品牌深绿 */
  --brand-light: #e8f0ed;
  --brand-grad: #3d7362;     /* 渐变副色(主色混 13% 白),applyTheme 会动态覆盖 */
  --ink: #1f2421;
  --ink-2: #5c6661;
  --ink-3: #9aa39e;
  --line: #e6eae8;
  --bg: #f6f7f5;
  --card: #ffffff;
  --gold: #b98a3e;
  --danger: #c0392b;
  --ok: #2e8b57;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* ---------- 页脚备案信息 ---------- */
.site-footer {
  padding: 22px 16px 30px;
  text-align: center;
  font-size: 12px;
  line-height: 1.9;
  color: var(--ink-3);
}
.site-footer a { color: var(--ink-3); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
}

/* ---------- 顶部 ---------- */
.topbar {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-grad) 100%);
  color: #fff;
  padding: 22px 20px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}
.topbar .brand-box { position: relative; }
.topbar .brand-corner {
  position: absolute; left: 0; top: 0; width: 18px; height: 18px;
  cursor: default; z-index: 2; opacity: 0;
}
.topbar .brand-name { font-size: 21px; font-weight: 700; letter-spacing: 2px; }
.topbar .brand-slogan { font-size: 12px; opacity: .82; margin-top: 4px; letter-spacing: 1px; }
.topbar .link-admin {
  display: inline-block;
  background: rgba(255,255,255,.18);
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 18px;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar .link-admin:hover { background: rgba(255,255,255,.30); }

/* ---------- 查询表单(首页) ---------- */
.query-box { max-width: 480px; margin: -18px auto 0; padding: 0 16px; position: relative; z-index: 2; }
.query-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(31, 36, 33, .08);
  padding: 18px;
}
.query-card h2 { font-size: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.query-card h2 .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); display: inline-block; }
.query-row { display: flex; gap: 10px; }
.query-row input {
  flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; letter-spacing: 1px; outline: none; background: #fbfcfb;
  font-family: "SF Mono", Consolas, monospace;
}
.query-row input:focus { border-color: var(--brand); background: #fff; }
.query-row button {
  padding: 12px 22px; border: none; border-radius: 10px; background: var(--brand); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.query-row button:active { transform: scale(.97); }

.tips { max-width: 480px; margin: 14px auto 0; padding: 0 16px; font-size: 12px; color: var(--ink-3); }
.tips b { color: var(--ink-2); }

/* ---------- 结果页 ---------- */
.result-wrap { max-width: 480px; margin: 0 auto; padding: 16px; }

/* 状态条:正品 / 无效 */
.badge {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--radius);
  margin-bottom: 14px; font-size: 14px;
}
.badge .icon { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff; }
.badge.genuine { background: var(--brand-light); color: var(--ok); }
.badge.genuine .icon { background: var(--ok); }
.badge.invalid { background: #fdf0ee; color: var(--danger); }
.badge.invalid .icon { background: var(--danger); }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: 0 2px 12px rgba(31,36,33,.05);
  padding: 18px; margin-bottom: 14px;
}
.card .sec-title {
  font-size: 13px; color: var(--ink-3); letter-spacing: 1px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.card .sec-title::before { content: ''; width: 4px; height: 13px; border-radius: 2px; background: var(--brand); }

/* 衣服信息头部 */
.prod-head { display: flex; gap: 14px; align-items: flex-start; }
.prod-photo {
  width: 92px; height: 110px; border-radius: 10px; flex-shrink: 0; overflow: hidden;
  background: linear-gradient(135deg, #eef1ef, #dfe6e2);
  display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 12px;
}
.prod-photo img { width: 100%; height: 100%; object-fit: cover; }
.prod-info { flex: 1; }
.prod-info .p-name { font-size: 18px; font-weight: 700; }
.prod-info .p-cat { display: inline-block; font-size: 11px; color: var(--brand); background: var(--brand-light); border-radius: 20px; padding: 2px 10px; margin-top: 6px; }
.prod-info .p-price { color: #b8452b; font-weight: 700; margin-top: 6px; }
.prod-info .p-price small { font-size: 12px; color: var(--ink-3); font-weight: 400; }

/* 信息表格 */
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv td { padding: 8px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.kv tr:last-child td { border-bottom: none; }
.kv td.k { color: var(--ink-3); width: 88px; flex-shrink: 0; }
.kv td.v { color: var(--ink); }

/* 溯源码展示 */
.code-chip {
  font-family: "SF Mono", Consolas, monospace; letter-spacing: 2px; font-weight: 700;
  background: #f4f6f5; border: 1px dashed var(--line); border-radius: 10px;
  padding: 12px; text-align: center; font-size: 17px; color: var(--ink);
}

/* 防伪提示 */
.anti-tips { font-size: 13px; color: var(--ink-2); background: #fafbfa; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.anti-tips li { margin-left: 18px; margin-bottom: 4px; }

/* 页脚 */
.footer { text-align: center; color: var(--ink-3); font-size: 12px; padding: 22px 16px 32px; }

/* 加载动画 */
.loading { text-align: center; padding: 60px 0; color: var(--ink-3); }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--brand-light); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* 彩蛋后台入口 */
.brand-char { cursor: default; }
.admin-gate {
  position: fixed; top: 86px; left: 50%; transform: translateX(-50%);
  background: #fff; border-radius: 12px; box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
  padding: 12px 14px; z-index: 150; width: min(320px, 86vw);
}
.admin-gate input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; outline: none; box-sizing: border-box; font-family: inherit;
}
.admin-gate input:focus { border-color: var(--brand); }
.admin-gate-err { color: #c0392b; font-size: 12px; margin-top: 6px; min-height: 16px; }

/* 款式图片 */
.prod-img {
  width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px;
  border: 1px solid var(--line); background: #fbfcfb; margin-bottom: 12px; display: block;
}

/* 短袖系列一览 */
.series { margin-top: 18px; }
.series-title {
  text-align: center; font-size: 17px; font-weight: 800; letter-spacing: 4px;
  color: var(--ink); margin-bottom: 14px;
}
.series-title::before, .series-title::after {
  content: ''; display: inline-block; width: 22px; height: 2px; background: var(--brand);
  vertical-align: middle; margin: 0 10px; border-radius: 2px;
}
.series-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%; max-width: 100%; }
.series-item {
  min-width: 0; max-width: 100%; background: var(--card); border-radius: 12px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(31, 36, 33, .06); cursor: pointer;
  transition: transform .15s;
}
.series-item:active { transform: scale(.96); }
.series-item img {
  width: 100%; max-width: 100%; height: auto; display: block; object-fit: contain;
  background: #fafbfa; min-height: 60px;
}
.series-name { text-align: center; font-weight: 700; font-size: 13px; padding: 8px 4px 2px; }
.series-tag { text-align: center; font-size: 11px; color: var(--ink-2); padding: 0 6px 10px; line-height: 1.5; }

/* 短袖板块放大卡片 */
.series-modal {
  position: relative;
  background: #fff; border-radius: 16px; width: min(560px, 92vw); padding: 16px 18px 22px;
  display: flex; flex-direction: column; align-items: center;
  max-height: 88vh; overflow-y: auto;
}
.series-modal-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0, 0, 0, .10); color: #333;
  font-size: 17px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.series-modal-img {
  width: 100%; max-width: 100%; max-height: 52vh; object-fit: contain;
  border-radius: 10px; background: #fafbfa;
}
.series-modal-name { margin-top: 14px; font-size: 20px; font-weight: 800; color: var(--ink); }
.series-modal-tag { margin-top: 8px; font-size: 14px; color: var(--ink-2); text-align: center; line-height: 1.7; }

/* ---------- 质检报告按钮与二级页面 ---------- */
.qc-btn {
  display: block; width: 100%; padding: 14px; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-grad) 100%);
  color: #fff; border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.qc-btn:active { transform: scale(.98); }

.qc-mask {
  position: fixed; inset: 0; background: rgba(20, 24, 22, .6); z-index: 200;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.qc-mask.show { display: flex; }
.qc-modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 480px;
  max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
}
.qc-head {
  padding: 14px 18px; font-size: 16px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.qc-close { cursor: pointer; color: var(--ink-3); font-size: 20px; padding: 4px 8px; }
.qc-body { overflow-y: auto; padding: 14px 18px 22px; }
.qc-body .qc-own-tip {
  text-align: center; font-size: 13px; font-weight: 600;
  padding: 2px 0 10px;
}
.qc-body .qc-img {
  width: 100%; border-radius: 10px; border: 1px solid var(--line);
  margin-bottom: 12px; display: block;
}
/* PDF 质检报告:新窗口打开按钮 + 内嵌预览 */
.qc-body .qc-pdf-wrap { margin-bottom: 14px; }
.qc-body .qc-pdf-open {
  display: inline-block; margin-bottom: 8px; padding: 8px 14px;
  background: var(--brand); color: #fff; border-radius: 8px;
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.qc-body .qc-pdf {
  width: 100%; height: 62vh; border: 1px solid var(--line);
  border-radius: 10px; background: #f5f5f5; display: block;
}
.qc-body .empty-tip { text-align: center; color: var(--ink-3); padding: 30px 0; }

/* 后台图库管理 */
.uploads-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.uploads-grid.empty { display: block; color: var(--ink-3); padding: 16px 0; }
.up-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.up-thumb { width: 100%; aspect-ratio: 1/1; background: #f3f3f3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%23eee'/%3E%3Cpath d='M10 26l7-7 5 5 8-9 3 3v6H10z' fill='%23ccc'/%3E%3C/svg%3E") center/40% no-repeat; display: flex; align-items: center; justify-content: center; }
.up-thumb img { width: 100%; height: 100%; object-fit: cover; }
.up-thumb .up-pdf { font-size: 28px; }
.up-meta { padding: 6px 8px; font-size: 12px; }
.up-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.up-info { color: var(--ink-3); margin-top: 2px; }
.up-badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 6px; margin-right: 4px; }
.up-badge.used { background: #e6f4ea; color: #137333; }
.up-badge.unused { background: #fce8e6; color: #a50e0e; }
.up-del { margin: 0 8px 8px; padding: 5px 0; font-size: 12px; }
.up-check { position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; accent-color: var(--brand, #0a66ff); cursor: pointer; }
.up-card { position: relative; }
.up-card.selected { border-color: #0a66ff; box-shadow: 0 0 0 2px rgba(10,102,255,.15); }
.btn-danger { background: #d93025; border-color: #d93025; color: #fff; }
.btn-danger:disabled { background: #f1f1f1; border-color: var(--line); color: var(--ink-3); cursor: not-allowed; }

/* 桌面端加宽 */
@media (min-width: 640px) {
  body { font-size: 16px; }
  .result-wrap, .query-box, .tips { max-width: 560px; }
  .prod-photo { width: 110px; height: 132px; }
}
