/* =========================================================
 *  云集商城 · 商家后台样式（商品管理）
 *  依赖 style.css 的 :root 变量与 .btn/.input/.form-row/.mask/.modal 等基础组件
 * ========================================================= */

/* ---------- 顶栏 ---------- */
.ad-topbar {
  background: linear-gradient(120deg, #2b2f36, #3a3f47);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(20, 24, 34, .18);
}
.ad-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.ad-logo { display: flex; align-items: center; gap: 11px; cursor: pointer; }
.ad-logo .mark {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--brand), #ff7a45);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff;
  flex: none;
}
.ad-logo .name { font-size: 15.5px; font-weight: 700; letter-spacing: .5px; }
.ad-logo .slogan { font-size: 10px; letter-spacing: 2.5px; color: rgba(255,255,255,.45); margin-top: 2px; }

.ad-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,.85); min-width: 0; }
.ad-user .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #ff7a45);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff; flex: none;
}
.ad-user .nm { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-link {
  color: rgba(255,255,255,.85); text-decoration: none; font-size: 13px;
  padding: 6px 12px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  transition: all .18s; white-space: nowrap;
}
.ad-link:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ---------- 主区 ---------- */
.ad-main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }

/* 登录门 */
.ad-login {
  max-width: 420px; margin: 60px auto 0;
  background: var(--bg-card); border-radius: 16px;
  box-shadow: var(--shadow); padding: 34px 32px 28px;
}
.ad-login .lg-icon { font-size: 40px; text-align: center; margin-bottom: 8px; }
.ad-login h2 { font-size: 19px; text-align: center; margin-bottom: 6px; }
.ad-login .lg-sub { font-size: 13px; color: var(--text-3); text-align: center; margin-bottom: 22px; }

/* 统计卡 */
.ad-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-card); border-radius: 13px;
  padding: 15px 17px; box-shadow: var(--shadow-s);
  display: flex; flex-direction: column; gap: 5px;
}
.stat-card .k { font-size: 12.5px; color: var(--text-3); }
.stat-card .v { font-size: 22px; font-weight: 800; color: var(--text-1); line-height: 1.2; }
.stat-card .v small { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.stat-card.hot .v { color: var(--brand); }
.stat-card.warn .v { color: var(--gold); }

/* 工具栏 */
.ad-toolbar {
  background: var(--bg-card); border-radius: 13px;
  padding: 14px 16px; box-shadow: var(--shadow-s);
  margin-bottom: 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.ad-search {
  display: flex; align-items: center; gap: 8px;
  background: #f5f6f8; border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 8px 7px 14px;
  flex: 1 1 220px; min-width: 0; max-width: 360px;
}
.ad-search input {
  border: none; outline: none; background: transparent;
  font-size: 13.5px; flex: 1; min-width: 0; color: var(--text-1);
}
.ad-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 13px; border-radius: 999px;
  font-size: 12.5px; color: var(--text-2);
  background: #f5f6f8; border: 1px solid transparent;
  cursor: pointer; user-select: none; transition: all .15s; white-space: nowrap;
}
.chip:hover { color: var(--brand); background: var(--brand-light); }
.chip.active { background: var(--brand); color: #fff; font-weight: 600; }
.chip.lite.active { background: var(--brand-light); color: var(--brand); border-color: var(--brand-soft); }
.ad-tools { display: flex; gap: 8px; margin-left: auto; }

/* ---------- 商品表格 ---------- */
.ptable {
  background: var(--bg-card); border-radius: 13px;
  box-shadow: var(--shadow-s); overflow: hidden;
}
.ptable-head, .prow {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 96px 118px 92px 76px 96px 132px;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
}
.ptable-head {
  font-size: 12px; color: var(--text-3);
  background: #fafbfc; border-bottom: 1px solid var(--line);
  padding-top: 11px; padding-bottom: 11px;
}
.prow { border-bottom: 1px solid var(--line); transition: background .15s; }
.prow:last-child { border-bottom: none; }
.prow:hover { background: #fffafa; }

.pc-img { width: 54px; height: 54px; border-radius: 9px; overflow: hidden; background: #f5f6f8; }
.pc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc-name {
  font-size: 13.5px; font-weight: 600; color: var(--text-1); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.pc-brand { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.pc-cat { font-size: 12.5px; color: var(--text-2); }
.pc-price { font-size: 13.5px; font-weight: 800; color: var(--brand); }
.pc-price s { display: block; font-weight: 400; font-size: 11px; color: var(--text-4); }
.pc-stock { font-size: 13px; font-weight: 600; color: var(--text-1); }
.pc-stock.low { color: var(--gold); }
.pc-stock.zero { color: var(--brand); }
.pc-sales, .pc-rating { font-size: 12.5px; color: var(--text-2); }
.pc-rating { color: var(--gold); letter-spacing: 1px; }
.pc-ops { display: flex; gap: 6px; justify-content: flex-end; }

.btn-danger { background: #fff1f0; color: var(--brand); }
.btn-danger:hover { background: var(--brand); color: #fff; }

.pc-mmeta { display: none; }

/* ---------- 弹窗表单 ---------- */
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.fgrid .full { grid-column: 1 / -1; }

.ip-box {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px; border: 1px dashed var(--line-strong);
  border-radius: 11px; background: #fafbfc;
}
.ip-preview {
  width: 84px; height: 84px; border-radius: 9px; overflow: hidden;
  background: #f0f1f3; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-4); font-size: 12px;
}
.ip-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ip-side { flex: 1; min-width: 0; }
.ip-tip { font-size: 12px; color: var(--text-3); line-height: 1.6; margin-bottom: 8px; }
.ip-gal {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 6px; max-height: 118px; overflow-y: auto;
}
.ip-tile {
  aspect-ratio: 1; border-radius: 7px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer;
  background: #f0f1f3; transition: border-color .15s;
}
.ip-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ip-tile:hover { border-color: var(--brand-soft); }
.ip-tile.active { border-color: var(--brand); }
.ip-upload {
  margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--brand); cursor: pointer;
  padding: 5px 10px; border: 1px dashed var(--brand); border-radius: 8px;
  background: var(--brand-light);
}
.ip-upload:hover { background: var(--brand-soft); }

.spec-row { display: grid; grid-template-columns: 96px 1fr 34px; gap: 8px; margin-bottom: 8px; align-items: center; }
.spec-row .input { font-size: 13px; }
.spec-del {
  height: 36px; border-radius: 8px; border: none; cursor: pointer;
  background: #f2f3f5; color: var(--text-3); font-size: 15px;
}
.spec-del:hover { background: var(--brand-light); color: var(--brand); }

/* 空态与登录提示 */
.ad-empty { padding: 44px 20px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.ad-empty .ic { font-size: 38px; display: block; margin-bottom: 10px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .ad-stats { grid-template-columns: repeat(3, 1fr); }
  .ptable-head, .prow {
    grid-template-columns: 60px minmax(0, 1fr) 90px 100px 80px 76px 118px;
  }
  .ptable-head .h-rating, .pc-rating { display: none; }
}

@media (max-width: 820px) {
  .ad-inner { padding: 10px 14px; }
  .ad-logo .name { font-size: 13.5px; }
  .ad-main { padding: 14px 12px 46px; }
  .ad-stats { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .stat-card { padding: 12px 14px; }
  .stat-card .v { font-size: 19px; }
  .ad-toolbar { padding: 12px; }
  .ad-tools { margin-left: 0; width: 100%; }
  .ad-tools .btn { flex: 1; }

  /* 表格 → 卡片 */
  .ptable-head { display: none; }
  .ptable-head .h-rating { display: block; }
  .prow {
    grid-template-columns: 74px minmax(0, 1fr) auto;
    grid-template-areas: "img main ops";
    gap: 12px; padding: 13px 14px;
  }
  .pc-img { width: 74px; height: 74px; grid-area: img; }
  .pc-main { grid-area: main; min-width: 0; }
  .pc-name { -webkit-line-clamp: 2; }
  .pc-ops { grid-area: ops; flex-direction: column; }
  .pc-cat, .pc-price, .pc-stock, .pc-sales, .pc-rating { display: none; }
  .pc-mmeta {
    display: flex; flex-wrap: wrap; gap: 5px 12px;
    margin-top: 7px; font-size: 12px; color: var(--text-3);
  }
  .pc-mmeta b { color: var(--brand); font-weight: 800; }
  .pc-mmeta .low { color: var(--gold); }
  .pc-mmeta .zero { color: var(--brand); }

  .fgrid { grid-template-columns: 1fr; }
  .ad-login { margin: 26px auto 0; padding: 26px 22px 22px; }
}

@media (max-width: 420px) {
  .ad-user .nm, .ad-user .avatar { display: none; }
}
