/* ============================================================
   隆威防伪验证 H5 - 全局样式
   配色对齐原小程序 app.wxss：主色 #1a6c3d、白底卡片、圆角
   rpx 换算：1rpx = 0.5px（按 375px 视口）
   ============================================================ */
:root {
  --primary: #1a6c3d;
  --primary-2: #2e7d32;
  --danger: #d32f2f;
  --danger-2: #c62828;
  --text: #333333;
  --text-mid: #666666;
  --text-light: #999999;
  --bg: #f5f5f5;
  --card-radius: 8px;
  --card-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: #ebebeb;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.08);
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* ---------- 通用 ---------- */
.brand-bg { background-color: var(--primary); }

.container {
  padding: 0 15px 90px;
}

.card {
  background: #ffffff;
  border-radius: var(--card-radius);
  padding: 15px;
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  display: block;
}

.btn-primary {
  display: block;
  width: 100%;
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 25px;
  height: 44px;
  line-height: 44px;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active { opacity: 0.85; }

.tag-safe {
  display: inline-block;
  background-color: #e8f5e9;
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.tag-danger {
  display: inline-block;
  background-color: #ffebee;
  color: var(--danger);
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.divider {
  height: 1px;
  background-color: #eeeeee;
  margin: 10px 0;
}

/* ---------- 首页：顶部品牌区 ---------- */
.header {
  padding: 34px 15px 44px;
}

.logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-text {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 4px;
  margin-bottom: 6px;
}

.logo-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 2px;
}

/* ---------- 首页：扫码卡片 ---------- */
.scan-card {
  margin-top: -26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 25px 15px;
}

.scan-icon-wrap {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}

.scan-icon-svg { width: 40px; height: 40px; }

.scan-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.scan-desc {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 20px;
  text-align: center;
}

.scan-btn { width: 200px; }

.scan-hint {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.6;
  text-align: center;
}

/* ---------- 首页：手动输入 ---------- */
.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.code-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  background-color: #f8f8f8;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
  text-transform: uppercase;
  outline: none;
  -webkit-appearance: none;
}

.code-input:focus {
  border-color: var(--primary);
  background-color: #ffffff;
}

.code-input::placeholder {
  color: #bbbbbb;
  font-size: 13px;
  text-transform: none;
}

.query-btn {
  width: 70px;
  height: 40px;
  background-color: var(--primary);
  color: #ffffff;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  padding: 0;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.query-btn:active { opacity: 0.85; }

.input-tools {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.tool-btn {
  background: #f5f5f5;
  border: none;
  border-radius: 14px;
  color: var(--text-mid);
  font-size: 12px;
  padding: 5px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tool-btn:active { background: #eeeeee; }

.input-error {
  margin-top: 10px;
  font-size: 12px;
  color: var(--danger);
  background: #ffebee;
  border-radius: 6px;
  padding: 8px 10px;
}

/* ---------- 首页：最近查询 ---------- */
.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-chip {
  background: #e8f5e9;
  color: var(--primary);
  border: none;
  border-radius: 14px;
  font-size: 12px;
  padding: 6px 12px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.recent-chip:active { opacity: 0.8; }

/* ---------- 首页：记录入口 / 使用说明 ---------- */
.entry-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
}

.entry-arrow {
  color: #cccccc;
  font-size: 20px;
  line-height: 1;
}

.guide-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.guide-item:last-child { margin-bottom: 0; }

.guide-step {
  width: 24px;
  height: 24px;
  min-width: 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-radius: 50%;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-text {
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.6;
}

/* ---------- 首页：底部公司信息 ---------- */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 15px 30px;
  gap: 4px;
  font-size: 11px;
  color: var(--text-light);
}

.footer-link { color: var(--text-light); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: #ffffff;
  box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.06);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 10px;
  font-size: 11px;
  color: var(--text-light);
  -webkit-tap-highlight-color: transparent;
}

.tab-item.active { color: var(--primary); }

.tab-icon { font-size: 20px; line-height: 1; }

/* ---------- 扫码浮层 ---------- */
.scan-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.scan-frame {
  position: relative;
  width: 78%;
  max-width: 300px;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.scan-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-mask {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  pointer-events: none;
}

.scan-mask::before,
.scan-mask::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
}

.scan-mask::before {
  top: -2px;
  left: -2px;
  border-top: 4px solid #4caf50;
  border-left: 4px solid #4caf50;
  border-top-left-radius: 12px;
}

.scan-mask::after {
  bottom: -2px;
  right: -2px;
  border-bottom: 4px solid #4caf50;
  border-right: 4px solid #4caf50;
  border-bottom-right-radius: 12px;
}

.scan-tip {
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
}

.scan-close {
  margin-top: 24px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  padding: 9px 26px;
  cursor: pointer;
}

/* ---------- 结果页：头部 ---------- */
.result-header {
  padding: 28px 15px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  transition: background 0.3s;
}

.result-header.authentic { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.result-header.fake { background: linear-gradient(135deg, var(--danger), var(--danger-2)); }

.result-icon-wrap {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.result-icon {
  font-size: 28px;
  color: #ffffff;
  font-weight: 700;
  line-height: 1;
}

.result-status {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.result-code {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 4px;
  word-break: break-all;
  text-align: center;
}

.result-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

/* ---------- 结果页：加载 ---------- */
.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 30px 15px;
  color: var(--text-light);
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 结果页：产品图片 ---------- */
.image-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.product-image {
  width: 100px;
  height: 100px;
  border-radius: 6px;
  object-fit: cover;
  background-color: #f5f5f5;
  cursor: pointer;
  border: none;
  padding: 0;
}

.img-fallback {
  width: 100%;
  min-height: 64px;
  border-radius: 6px;
  background: #f5f5f5;
  color: #bbbbbb;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 结果页：信息列表 ---------- */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.info-label {
  font-size: 12px;
  color: var(--text-light);
}

.info-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  word-break: break-all;
}

.info-value.link { color: var(--primary); }

.info-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.call-btn {
  font-size: 12px;
  color: var(--primary);
  padding: 3px 10px;
  border: 1px solid var(--primary);
  border-radius: 10px;
  -webkit-tap-highlight-color: transparent;
}

.call-btn:active { opacity: 0.7; }

/* ---------- 结果页：查询统计 ---------- */
.query-stats {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 10px 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.stat-num-sm { font-size: 15px; }

.stat-label {
  font-size: 12px;
  color: var(--text-light);
}

.stat-divider {
  width: 1px;
  height: 30px;
  background-color: #eeeeee;
}

.stat-sub {
  text-align: center;
  font-size: 11px;
  color: #bbbbbb;
  padding-bottom: 8px;
}

/* ---------- 结果页：查询历史 ---------- */
.query-history { margin-top: 4px; }

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid #f0f0f0;
}

.history-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.history-time {
  font-size: 13px;
  color: var(--text);
}

.history-location {
  font-size: 11px;
  color: var(--text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-tag {
  font-size: 11px;
  color: var(--text-light);
  padding: 2px 8px;
  border-radius: 8px;
  background-color: #f5f5f5;
  flex-shrink: 0;
  margin-left: 10px;
}

.history-tag.current {
  color: var(--primary);
  background-color: #e8f5e9;
  font-weight: 500;
}

/* ---------- 结果页：提示卡 ---------- */
.tip-card {
  background-color: #fff8e1;
  border: 1px solid #ffe082;
}

.tip-title {
  font-size: 14px;
  font-weight: 600;
  color: #f57f17;
  margin-bottom: 8px;
}

.tip-text {
  font-size: 12px;
  color: var(--text-mid);
  line-height: 1.8;
  display: block;
  margin-bottom: 4px;
}

.danger-card {
  background-color: #ffebee;
  border-color: #ef9a9a;
}

.danger-title {
  color: var(--danger);
  font-size: 16px;
}

.danger-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #ef9a9a;
}

.action-phone {
  display: inline-block;
  font-size: 14px;
  color: var(--danger);
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

.retry-btn {
  display: inline-block;
  width: auto;
  padding: 0 30px;
  font-size: 14px;
}

/* ---------- 结果页：底部操作 ---------- */
.bottom-actions {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  gap: 10px;
  padding: 10px 15px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  background: #ffffff;
  box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.06);
  z-index: 50;
}

.action-btn {
  flex: 1;
  height: 40px;
  line-height: 40px;
  background-color: var(--primary);
  color: #ffffff;
  font-size: 14px;
  border-radius: 20px;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.action-btn:active { opacity: 0.85; }

.action-btn.secondary {
  background-color: #f5f5f5;
  color: var(--text-mid);
}

/* ---------- 图片预览浮层 ---------- */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-overlay img {
  max-width: 92vw;
  max-height: 82vh;
  border-radius: 8px;
  object-fit: contain;
}

.preview-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.preview-prev { left: 12px; }
.preview-next { right: 12px; }

.preview-count {
  position: absolute;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}

/* ---------- 记录页 ---------- */
.sub-header {
  padding: 24px 15px 20px;
  color: #ffffff;
}

.sub-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sub-header-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.sub-header-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
}

.header-clear {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #ffffff;
  font-size: 13px;
  border-radius: 14px;
  padding: 5px 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.history-card {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.history-card:active { background: #fafafa; }

.history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.history-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-code {
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 6px;
  word-break: break-all;
}

.history-meta {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.7;
}

/* ---------- 记录页：空状态 ---------- */
.empty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 15px;
}

.empty-icon { font-size: 40px; margin-bottom: 12px; }

.empty-text {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 20px;
}

.empty-btn { width: 160px; }

/* ---------- 小屏适配 ---------- */
@media (max-width: 359px) {
  .product-image { width: 84px; height: 84px; }
  .scan-btn { width: 170px; }
}
