/* ===========================================================
   鑫懋五金商城 · 基础样式（PC / 手机 / 后台共用设计令牌）
   =========================================================== */
:root {
  --brand: #ff6a00;
  --brand-dark: #e85c00;
  --brand-light: #fff3e9;
  --ink: #1b2330;
  --ink-2: #2b3646;
  --gray-9: #1f2937;
  --gray-7: #4b5563;
  --gray-5: #8a94a6;
  --gray-3: #c8cfdb;
  --gray-2: #e6eaf0;
  --gray-1: #f2f4f7;
  --bg: #f5f6f8;
  --price: #e4322b;
  --green: #12a150;
  --blue: #1677ff;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 4px 16px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --max: 1240px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; border: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; }
p { margin: 0; }
table { border-collapse: collapse; width: 100%; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.hide { display: none !important; }
.muted { color: var(--gray-5); }
.small { font-size: 12px; }
.center { text-align: center; }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 18px; border: 1px solid var(--gray-2); background: #fff;
  border-radius: var(--radius); font-size: 14px; font-weight: 500; color: var(--ink-2);
  transition: all .16s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #0f1620; border-color: #0f1620; color: #fff; }
.btn-ghost { background: transparent; border-color: var(--gray-3); }
.btn-lg { height: 46px; padding: 0 34px; font-size: 16px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 顶部通栏 ---------- */
.topbar { background: var(--ink); color: #b9c2d0; font-size: 12px; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 34px; }
.topbar a { color: #b9c2d0; }
.topbar a:hover { color: #fff; }
.topbar .tb-left { display: flex; align-items: center; gap: 16px; }
.topbar .tb-right { display: flex; align-items: center; gap: 18px; }
.topbar .tb-right .sep { width: 1px; height: 12px; background: #3a4557; }
.topbar .tb-phone { color: #ffb27a; font-weight: 600; }

/* ---------- 主头部 ---------- */
.header { background: #fff; box-shadow: var(--shadow-sm); position: relative; z-index: 30; }
.header .wrap { display: flex; align-items: center; gap: 32px; height: 92px; }
.logo { display: flex; align-items: center; gap: 10px; flex: none; }
.logo-mark {
  width: 46px; height: 46px; border-radius: 10px; flex: none;
  background: linear-gradient(145deg, #ff8a3d, #e85c00);
  color: #fff; font-size: 20px; font-weight: 800; letter-spacing: -1px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(255, 106, 0, .28);
}
.logo-text b { display: block; font-size: 20px; letter-spacing: .5px; line-height: 1.2; }
.logo-text span { display: block; font-size: 11px; color: var(--gray-5); letter-spacing: 2px; }

.search { flex: 1; max-width: 620px; }
.search-box { display: flex; height: 44px; border: 2px solid var(--brand); border-radius: var(--radius); overflow: hidden; background: #fff; }
.search-box input { flex: 1; border: 0; outline: 0; padding: 0 14px; font-size: 14px; }
.search-box button { width: 92px; border: 0; background: var(--brand); color: #fff; font-size: 15px; font-weight: 600; }
.search-box button:hover { background: var(--brand-dark); }
.search-hot { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; color: var(--gray-5); overflow: hidden; white-space: nowrap; }
.search-hot a:hover { color: var(--brand); }

.header-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.cart-btn {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px;
  border: 1px solid var(--gray-2); border-radius: var(--radius); background: #fff; font-weight: 600;
}
.cart-btn:hover { border-color: var(--brand); color: var(--brand); }
.cart-btn .badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--price);
  color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}

/* ---------- 导航 ---------- */
.nav { border-top: 1px solid var(--gray-2); background: #fff; }
.nav .wrap { display: flex; align-items: center; gap: 4px; height: 46px; }
.nav-all {
  position: relative; width: 200px; height: 46px; margin-right: 8px;
  background: var(--brand); color: #fff; font-weight: 600;
  display: flex; align-items: center; gap: 8px; padding: 0 16px; border-radius: 0 0 0 0;
  cursor: default;
}
.nav-all .bars { display: inline-flex; flex-direction: column; gap: 3px; }
.nav-all .bars i { display: block; width: 14px; height: 2px; background: #fff; border-radius: 1px; }
.nav-links { display: flex; align-items: center; gap: 26px; font-size: 15px; font-weight: 500; }
.nav-links a { padding: 12px 0; border-bottom: 2px solid transparent; }
.nav-links a:hover, .nav-links a.on { color: var(--brand); border-bottom-color: var(--brand); }
.nav-extra { margin-left: auto; display: flex; gap: 18px; font-size: 12px; color: var(--gray-5); }
.nav-extra i { color: var(--brand); font-style: normal; }

/* 全部分类面板 */
.cat-panel {
  position: absolute; left: 0; top: 46px; width: 880px; min-height: 420px;
  background: #fff; box-shadow: var(--shadow-lg); border: 1px solid var(--gray-2); border-top: 0;
  display: none; z-index: 40; padding: 18px 22px;
}
.nav-all:hover .cat-panel, .cat-panel:hover { display: block; }
.cat-panel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 18px; }
.cat-panel-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); }
.cat-panel-item:hover { background: var(--brand-light); color: var(--brand); }
.cat-panel-item img { width: 26px; height: 26px; }
.cat-panel-item .n { font-weight: 600; font-size: 14px; }
.cat-panel-item .e { font-size: 11px; color: var(--gray-5); }

/* ---------- 通用卡片 ---------- */
.card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.section-head .t { display: flex; align-items: baseline; gap: 10px; }
.section-head h2 { font-size: 22px; letter-spacing: .5px; }
.section-head .sub { font-size: 12px; color: var(--gray-5); letter-spacing: 1px; text-transform: uppercase; }
.section-head .more { font-size: 13px; color: var(--gray-5); }
.section-head .more:hover { color: var(--brand); }

/* ---------- 商品卡 ---------- */
.plist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.product-card {
  background: #fff; border-radius: var(--radius-lg); overflow: hidden; transition: all .2s ease;
  border: 1px solid transparent; display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); }
.pc-img { position: relative; aspect-ratio: 1 / 1; background: #fff; overflow: hidden; padding: 10px; }
.pc-img img { width: 100%; height: 100%; object-fit: contain; transition: transform .35s ease; }
.product-card:hover .pc-img img { transform: scale(1.05); }
.pc-badge {
  position: absolute; left: 10px; top: 10px; padding: 2px 7px; border-radius: 4px;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 600;
}
.pc-badge.new { background: var(--green); }
.pc-body { padding: 10px 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.pc-name { font-size: 13px; line-height: 1.5; height: 39px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pc-sub { font-size: 12px; color: var(--gray-5); height: 18px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pc-foot { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.price { color: var(--price); font-weight: 700; }
.price .sym { font-size: 12px; margin-right: 1px; }
.price .num { font-size: 20px; letter-spacing: -.5px; }
.price .dec { font-size: 13px; }
.price-old { color: var(--gray-3); font-size: 12px; text-decoration: line-through; }
.pc-sales { margin-left: auto; font-size: 11px; color: var(--gray-5); }
.pc-tags { display: flex; gap: 4px; flex-wrap: wrap; height: 18px; overflow: hidden; }
.tag { display: inline-block; padding: 0 6px; height: 18px; line-height: 18px; border-radius: 3px; font-size: 11px; background: var(--brand-light); color: var(--brand-dark); }
.tag.gray { background: var(--gray-1); color: var(--gray-7); }
.tag.green { background: #e8f7ee; color: var(--green); }

/* ---------- 表单 ---------- */
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--gray-2);
  border-radius: var(--radius); background: #fff; outline: 0; transition: border-color .15s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 76px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 106, 0, .1); }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--gray-7); margin-bottom: 6px; }
.field > label .req { color: var(--price); }

/* ---------- 分页 ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin: 26px 0 10px; }
.pager button, .pager a {
  min-width: 34px; height: 34px; padding: 0 10px; border: 1px solid var(--gray-2); background: #fff;
  border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.pager .on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager button:hover:not([disabled]) { border-color: var(--brand); color: var(--brand); }

/* ---------- 空态 / 加载 ---------- */
.empty { padding: 60px 20px; text-align: center; color: var(--gray-5); }
.empty .ico { font-size: 40px; opacity: .35; margin-bottom: 10px; }
.skeleton { background: linear-gradient(90deg, #f0f2f5 25%, #e6e9ee 37%, #f0f2f5 63%); background-size: 400% 100%; animation: sk 1.2s ease infinite; border-radius: 6px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- 轻提示 ---------- */
#toast-wrap { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 10px 18px; border-radius: 8px; background: rgba(27, 35, 48, .92); color: #fff;
  font-size: 13px; box-shadow: var(--shadow); animation: tin .2s ease; max-width: 70vw;
}
.toast.ok { background: #0f9d58; }
.toast.err { background: #d93025; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 弹窗 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(17, 24, 39, .5); z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 480px; background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; max-height: 90vh; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--gray-2); }
.modal-head h3 { font-size: 16px; }
.modal-head .x { border: 0; background: none; font-size: 20px; line-height: 1; color: var(--gray-5); }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--gray-2); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 页脚 ---------- */
.footer { background: var(--ink); color: #9aa5b6; margin-top: 40px; }
.footer-main { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 30px; padding: 40px 0 28px; }
.footer h4 { color: #fff; font-size: 14px; margin-bottom: 14px; }
.footer a { display: block; font-size: 13px; line-height: 2; color: #9aa5b6; }
.footer a:hover { color: var(--brand); }
.footer-brand .logo-text b { color: #fff; }
.footer-brand p { font-size: 13px; line-height: 1.9; margin-top: 10px; }
.footer-bottom { border-top: 1px solid #2b3546; padding: 16px 0; font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray-5); padding: 14px 0; }
.breadcrumb a:hover { color: var(--brand); }

@media (max-width: 1180px) {
  .plist { grid-template-columns: repeat(3, 1fr); }
  .header .wrap { gap: 18px; }
}
@media (max-width: 900px) {
  .nav-links, .nav-extra { display: none; }
  .header .wrap { height: 76px; flex-wrap: wrap; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .plist { grid-template-columns: repeat(2, 1fr); }
  .footer-main { grid-template-columns: 1fr 1fr; }
}
