/* ============================================================================
   shop.css —— 商城 / 会员区**特有组件**样式（执行方案 §9 §12–§24 §35）
   ============================================================================
   现在它是品牌设计系统的一部分，而不是"另一个网站"：
     · 颜色/表面/动作/链接 全部读 assets/css/tokens.css（禁止在这里另立 --accent 之类）
     · 页头 / 页脚 / 按钮 / 卡片 / 表单底座 由 assets/css/style.css 提供（统一视觉）
     · 本文件只保留"商业区域"特有的东西：商品网格与卡片、规格与价格、筛选栏、
       购物车/表单页的少量布局、空状态与提示条。
   注意：类名必须保持与 templates/*.html 一致（page-title/page-sub/section/row/
        product-card/media/body/product-name/product-sub/price/cross/actions/num/
        msg/empty/auth-wrap/field/badge-n/btn-danger），只改样式不改名。
   ============================================================================ */

/* ---------------- 页面壳 ---------------- */
.shop-main { padding: 34px 0 72px; min-height: 60vh; }

/* 页面标题区（§13）：保留原有文字，视觉统一为官网 page hero 的排版语气 */
.page-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 2.4vw, 34px);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
  letter-spacing: .01em;
}
.page-sub {
  color: var(--text-secondary);
  font-size: 15px;
  margin: 0 0 24px;
}
.section { margin-bottom: 34px; }
.section h2 { font-size: 18px; color: var(--text-primary); margin: 0 0 14px; }

/* ---------------- 筛选栏（§14）---------------- */
.shop-filters,
form.filters {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.shop-filters select,
form.filters select { max-width: 280px; min-height: 48px; }
.shop-filters input[type="search"],
form.filters input[type="search"],
.shop-filters input[type="text"] { min-height: 48px; }

/* 表单控件统一到品牌令牌（§14：同高度、同边框、同圆角、品牌绿 focus ring） */
input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  padding: 11px 13px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text-primary);
  width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--green-700);
  outline: 2px solid rgba(42, 92, 69, .28);
  outline-offset: 1px;
}
label { display: block; font-size: 13.5px; color: var(--text-secondary); margin: 0 0 6px; }
.field { margin-bottom: 16px; }

/* ---------------- 商品网格与卡片（§15–§21）---------------- */
.row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}
.product-card {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform .28s ease, box-shadow .28s ease;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.product-card .media {
  aspect-ratio: 1 / 1;                 /* §16：同一网格统一比例，避免三张图各自原始高度 */
  overflow: hidden;
  background: var(--mist);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 13px;
}
.product-card .media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.product-card:hover .media img { transform: scale(1.02); }
.product-card .body {
  padding: 22px 24px 24px;             /* §17：Desktop 22–26px，禁止文字贴边 */
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.product-name {
  font-size: 19px;                     /* §18：18–20px */
  font-weight: 600;
  line-height: 1.45;
  margin: 0;
  color: var(--text-primary);
}
.product-sub {
  color: var(--text-secondary);        /* §18：14–15px muted，仍须可读 */
  font-size: 14.5px;
  margin: 0;
  line-height: 1.6;
}
.price {
  color: var(--green-900);             /* §19：不用刺眼红色做视觉中心 */
  font-weight: 700;
  font-size: 21px;
  letter-spacing: .01em;
}
.price .cross,
.cross {
  color: var(--text-secondary);
  text-decoration: line-through;
  font-weight: 400;
  font-size: 14.5px;
  margin-left: 8px;
}
.product-card .actions {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}
.product-card .actions .btn { min-height: 44px; }   /* §20：按钮 44–48px */

/* 购物袋数量徽标（Utility 区） */
.badge-n {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: var(--radius-pill);
  background: var(--gold-400);
  color: var(--amber-ink);
  font-size: 11.5px;
  font-weight: 700;
  margin-left: 6px;
  padding: 0 5px;
}

/* ---------------- 危险操作按钮（品牌令牌化，保留 .btn-danger 类名）---------------- */
.btn-danger {
  background: var(--surface-card);
  color: var(--action-danger-bg);
  border-color: rgba(155, 59, 49, .34);
}
.btn-danger:hover { background: rgba(155, 59, 49, .06); color: var(--action-danger-bg); }

/* ---------------- 表格（购物车等，§23）---------------- */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
th { font-size: 13px; color: var(--text-secondary); font-weight: 600; background: var(--mist); }
td.num, th.num { text-align: right; font-family: var(--mono); }
td.ops, .ops { white-space: nowrap; }      /* 与 admin.css 一致：操作列不换行 */

/* ---------------- 提示条 / 空状态 ---------------- */
.msg {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  margin: 14px 0;
  display: none;
}
.msg.show { display: block; }
.msg.ok { background: var(--mist); border: 1px solid rgba(42, 92, 69, .28); color: var(--green-900); }
.msg.err { background: #FBF1F0; border: 1px solid rgba(155, 59, 49, .28); color: var(--action-danger-bg); }
.empty {
  padding: 40px 18px;
  text-align: center;
  color: var(--text-secondary);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-card);
  background: var(--surface-card);
}

/* ---------------- 登录 / 注册 ---------------- */
.auth-wrap { max-width: 420px; margin: 44px auto; }

/* ---------------- 响应式（§14 §17 §20）---------------- */
@media (max-width: 1023px) {
  .row { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
  .product-card .body { padding: 19px 20px 20px; }   /* §17：Mobile 18–20px */
}
@media (max-width: 640px) {
  .row { grid-template-columns: minmax(0, 1fr); }
  .shop-filters, form.filters { flex-direction: column; align-items: stretch; }
  .shop-filters select, form.filters select { max-width: none; }
  .product-card .actions { display: grid; grid-template-columns: 1fr 1fr; }  /* §20 */
  .page-title { font-size: 24px; }
}
