/* ============================================================
   雷恩二手 - 全站样式
   ============================================================ */
:root {
  --bg:        #f7f5f1;
  --surface:   #ffffff;
  --text:      #2a2622;
  --muted:     #8a857d;
  --line:      #e6e2db;
  --primary:   #c4673a;
  --primary-d: #a3522b;
  --ok:        #4a8a4a;
  --warn:      #c98a1e;
  --danger:    #c1474b;
  --radius:    10px;
  --shadow:    0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-d); }
img { max-width: 100%; display: block; }

/* ---- 顶栏 ---- */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; gap: 16px;
}
.brand { font-size: 18px; font-weight: 600; color: var(--text); }
.brand small { color: var(--muted); font-weight: normal; font-size: 13px; margin-left: 8px; }
.nav { display: flex; gap: 18px; align-items: center; }
.nav a { color: var(--text); font-size: 14px; }
.nav a:hover { color: var(--primary); }
.cart-badge {
  display: inline-block; background: var(--primary); color: #fff;
  font-size: 11px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; text-align: center; line-height: 18px; margin-left: 4px;
}

/* ---- 容器 ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }
.page-title { font-size: 24px; margin: 0 0 6px; font-weight: 600; }
.page-subtitle { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

/* ---- 商品网格 ---- */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-img {
  aspect-ratio: 4 / 3; background: #f0ebe2;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .placeholder { color: var(--muted); font-size: 13px; }
.card-body { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; }
.card-name { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.card-price { color: var(--primary); font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.card-price small { color: var(--muted); font-weight: normal; font-size: 12px; margin-left: 4px; }
.card-meta { color: var(--muted); font-size: 12px; margin-top: auto; }
.tag-soldout {
  background: #ddd; color: #555; font-size: 11px; padding: 2px 8px;
  border-radius: 4px; display: inline-block;
}
.tag-hidden {
  background: #fde2c8; color: var(--primary-d); font-size: 11px; padding: 2px 8px;
  border-radius: 4px; display: inline-block;
}

/* ---- 详情页 ---- */
.detail { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; }
@media (max-width: 720px) { .detail { grid-template-columns: 1fr; } }
.gallery .main-img {
  aspect-ratio: 4/3; background: #f0ebe2; border-radius: var(--radius);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.gallery .main-img img { width: 100%; height: 100%; object-fit: cover; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.thumbs img {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: 6px; border: 2px solid transparent; cursor: pointer;
}
.thumbs img.active { border-color: var(--primary); }

.detail h1 { margin: 0 0 8px; font-size: 22px; }
.detail .price { color: var(--primary); font-size: 26px; font-weight: 600; margin: 8px 0 4px; }
.detail .price small { color: var(--muted); font-size: 14px; font-weight: normal; margin-left: 8px; }
.detail .desc { white-space: pre-wrap; color: #4a443e; margin: 16px 0; }

/* ---- 按钮 ---- */
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 6px;
  border: 1px solid transparent; background: var(--primary); color: #fff;
  font-size: 14px; cursor: pointer; font-family: inherit;
  transition: background 0.15s;
}
.btn:hover { background: var(--primary-d); }
.btn:disabled { background: #c5beb3; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--line); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a13c40; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---- 表单 ---- */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.form-row input, .form-row textarea, .form-row select {
  width: 100%; padding: 9px 12px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  font-family: inherit; color: var(--text);
}
.form-row textarea { min-height: 80px; resize: vertical; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  outline: none; border-color: var(--primary);
}
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* ---- 卡片面板 ---- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px;
}
.panel h2 { margin: 0 0 14px; font-size: 17px; font-weight: 600; }

/* ---- 购物车 / 列表 ---- */
.cart-row {
  display: grid; grid-template-columns: 80px 1fr auto auto auto; gap: 14px;
  align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.cart-row:last-child { border-bottom: none; }
.cart-row .thumb { width: 80px; height: 60px; background: #f0ebe2; border-radius: 6px; overflow: hidden; }
.cart-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-row .qty { width: 60px; }
.cart-row .name { font-weight: 500; }
.cart-row .price { color: var(--primary); font-weight: 600; }
.cart-summary { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; }
.cart-total { font-size: 18px; font-weight: 600; }
.cart-total small { color: var(--muted); font-size: 13px; font-weight: normal; margin-left: 8px; }

/* ---- 支付方式选择 ---- */
.pay-options { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 600px) { .pay-options { grid-template-columns: 1fr; } }
.pay-opt {
  border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px; cursor: pointer; background: #fff; text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.pay-opt.active { border-color: var(--primary); background: #fff6ed; }
.pay-opt .name { font-weight: 600; margin-bottom: 4px; }
.pay-opt .hint { font-size: 12px; color: var(--muted); }

/* ---- 状态标签 ---- */
.status { font-size: 12px; padding: 3px 8px; border-radius: 4px; display: inline-block; }
.status-pending   { background: #fde9c8; color: var(--warn); }
.status-paid      { background: #cbe3ff; color: #2a5fa0; }
.status-completed { background: #d2e9d2; color: var(--ok); }
.status-cancelled { background: #f0d6d6; color: var(--danger); }

/* ---- 通用 ---- */
.muted { color: var(--muted); }
.center { text-align: center; }
.spacer { height: 16px; }
.empty {
  text-align: center; color: var(--muted);
  padding: 60px 20px; font-size: 14px;
}
.notice {
  background: #fff6ed; border: 1px solid #f5d9bf; color: #6b4520;
  padding: 12px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 16px;
}
.notice-error { background: #fdecec; border-color: #f3b9bb; color: #842126; }
.notice-ok    { background: #e9f3e9; border-color: #c2dec2; color: #2d5a2d; }
.qr-img { max-width: 240px; margin: 12px auto; display: block; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
