/* ==================================================================
   管理后台样式（沿用前台的颜色变量）
   原则：手机上也能改产品，所以所有表单都是单列自适应。
   ================================================================== */

.admin-body { background: #f2efe9; padding-bottom: 60px; }

/* ---------------------------------------------------------- 登录 */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(90% 70% at 75% 0%, #2f4438 0%, transparent 60%),
    linear-gradient(160deg, #14201b, #23332b);
}
.login-card {
  width: min(100%, 390px);
  padding: 38px 32px 32px;
  background: var(--paper);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-mark { font-size: 34px; margin-bottom: 10px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.login-sub { margin: 0 0 26px; font-size: 13.5px; color: var(--ink-mute); line-height: 1.6; }
.login-card .field { text-align: start; }
.login-card .btn { margin-top: 6px; }
.login-error {
  margin: 14px 0 0;
  padding: 10px 14px;
  font-size: 13.5px;
  color: #8c2f42;
  background: #fbe9ed;
  border-radius: 10px;
}
.login-tip {
  margin: 14px 0 0;
  padding: 10px 14px;
  font-size: 13px;
  color: #7a5a1f;
  background: #fdf3df;
  border-radius: 10px;
  text-align: start;
  line-height: 1.6;
}

/* ---------------------------------------------------------- 头部 */

.admin-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px max(20px, calc((100% - 1080px) / 2));
  background: #1d2b24;
  color: #f4efe8;
}
.admin-brand { font-size: 15.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.admin-head-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid rgba(244, 239, 232, 0.26);
  border-radius: 999px;
  background: transparent;
  color: #f4efe8;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.btn-mini:hover { background: rgba(244, 239, 232, 0.12); }
.btn-mini.ghost { border-color: transparent; opacity: 0.78; }
.btn-mini.ghost:hover { opacity: 1; background: rgba(244, 239, 232, 0.1); }
.btn-mini.btn-primary { border-color: transparent; }
.btn-mini:disabled { opacity: 0.5; cursor: not-allowed; }

.save-state { font-size: 13px; color: rgba(244, 239, 232, 0.72); min-width: 0; }
.save-state.dirty { color: #f0c274; }
.save-state.saved { color: #9fd6b0; }

/* ---------------------------------------------------------- 标签页 */

.admin-tabs {
  position: sticky;
  top: 57px;
  z-index: 30;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px max(20px, calc((100% - 1080px) / 2));
  background: #f2efe9;
  border-bottom: 1px solid var(--line);
}
.admin-tabs button {
  padding: 9px 17px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: all 0.2s;
}
.admin-tabs button:hover { background: rgba(27, 38, 33, 0.06); }
.admin-tabs button.is-active { background: var(--ink); color: #fff; }

.admin-main {
  width: min(100% - 40px, 1080px);
  margin: 26px auto 0;
}
.tab-panel[hidden] { display: none; }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
}
.panel-head h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; }
.panel-sub { margin: 0; font-size: 13.5px; color: var(--ink-mute); line-height: 1.6; }

/* ---------------------------------------------------------- 表单 */

.form-card {
  padding: 24px;
  margin-bottom: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.form-card h3 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.form-card h3 + .panel-sub { margin-top: -10px; margin-bottom: 16px; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 13px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  background: var(--paper);
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(194, 96, 122, 0.14);
}

/* 语言切换小标签 */

.lang-tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  margin-bottom: 16px;
  background: rgba(27, 38, 33, 0.06);
  border-radius: 999px;
}
.lang-tabs button {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}
.lang-tabs button.is-active { background: var(--paper); color: var(--rose-deep); box-shadow: var(--shadow-sm); }
.lang-tabs button .filled { color: var(--sage); margin-inline-start: 4px; }

/* ---------------------------------------------------------- 产品列表 */

.product-list { display: grid; gap: 12px; }

.product-row {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 12px 16px 12px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, transform 0.2s;
}
.product-row:hover { border-color: var(--line-strong); transform: translateY(-1px); }

.product-thumb {
  width: 84px; height: 84px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--rose-soft);
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }

.product-info { min-width: 0; }
.product-info h4 { margin: 0 0 4px; font-size: 15px; font-weight: 650; }
.product-info p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tag {
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(27, 38, 33, 0.06);
  color: var(--ink-soft);
}
.tag.rose { background: var(--rose-soft); color: var(--rose-deep); }
.tag.warn { background: #fdf3df; color: #8a6520; }

.product-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.act {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink-soft);
  transition: all 0.18s;
}
.act:hover { border-color: var(--ink); color: var(--ink); }
.act.danger:hover { border-color: #b8465f; color: #b8465f; background: #fbe9ed; }

.empty-hint { text-align: center; color: var(--ink-mute); padding: 40px 0; font-size: 14px; }

/* ---------------------------------------------------------- 分类列表 */

.cat-list { display: grid; gap: 10px; }
.cat-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.cat-row input {
  width: 100%;
  padding: 8px 12px;
  font: inherit;
  font-size: 14px;
  background: var(--cream);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.cat-row input:focus { outline: none; border-color: var(--rose); background: var(--paper); }
.cat-row .cat-key { font-size: 12px; color: var(--ink-mute); font-family: ui-monospace, Consolas, monospace; }

/* ---------------------------------------------------------- 首屏数字编辑 */

/* 微信二维码上传 */
.qr-editor { display: flex; gap: 18px; align-items: flex-start; }
.qr-preview {
  flex: 0 0 auto;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--cream);
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
}
.qr-preview img { width: 100%; height: 100%; object-fit: contain; }
.qr-empty { font-size: 12px; color: var(--ink-mute); }
.qr-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
/* 后台顶栏是深色的，这里的按钮落在浅色卡片上，要单独给一套配色 */
.qr-actions .btn-mini { border-color: var(--line-strong); color: var(--ink-soft); }
.qr-actions .btn-mini:hover { background: rgba(27, 38, 33, 0.06); }

.stats-editor { display: grid; gap: 10px; }
.stat-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 12px;
  align-items: center;
}
.stat-row input {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  background: var(--cream);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.stat-row input:focus { outline: none; border-color: var(--rose); background: var(--paper); }

/* ---------------------------------------------------------- 图片上传 */

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  padding: 26px;
  margin-bottom: 16px;
  text-align: center;
  background: var(--cream);
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover,
.dropzone.is-over { border-color: var(--rose); background: var(--rose-soft); }
.dz-inner { display: flex; flex-direction: column; gap: 4px; }
.dz-inner strong { font-size: 14.5px; color: var(--rose-deep); }
.dz-inner span { font-size: 12.5px; color: var(--ink-mute); }

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--rose-soft);
  border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .thumb-main {
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  padding: 3px;
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
  color: #fff;
  background: rgba(194, 96, 122, 0.88);
}
.thumb .thumb-del {
  position: absolute;
  inset-block-start: 5px;
  inset-inline-end: 5px;
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 28, 24, 0.68);
  color: #fff;
  font-size: 15px;
  line-height: 1;
}
.thumb .thumb-del:hover { background: #b8465f; }

/* ---------------------------------------------------------- 编辑器抽屉 */

.editor {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 26, 22, 0.6);
  backdrop-filter: blur(3px);
}
.editor[hidden] { display: none; }
.editor-panel {
  width: min(100%, 820px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #f2efe9;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  background: #1d2b24;
  color: #f4efe8;
}
.editor-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.editor-head-tools { display: flex; gap: 8px; }
.editor-body { padding: 20px 22px 26px; overflow-y: auto; }
.editor-body .form-card { background: var(--paper); }

.spec-editor { display: grid; gap: 14px; }
.spec-pair { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 12px; align-items: center; }
.spec-pair > label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.spec-pair input {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  background: var(--cream);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.spec-pair input:focus { outline: none; border-color: var(--rose); background: var(--paper); }
.spec-hint { font-size: 11.5px; color: var(--ink-mute); text-align: center; }

/* ---------------------------------------------------------- 提示条 */

.toast {
  position: fixed;
  inset-block-end: 26px;
  inset-inline: 0;
  z-index: 200;
  width: fit-content;
  max-width: min(90vw, 460px);
  margin-inline: auto;
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 550;
  color: #fff;
  background: #1d2b24;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.26s ease;
}
.toast.err { background: #a4384f; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------------------------------------------------------- 响应式 */

@media (max-width: 700px) {
  .admin-tabs { top: 0; position: static; }
  .admin-main { width: calc(100% - 28px); }
  .form-card { padding: 18px; }
  .product-row { grid-template-columns: 64px 1fr; }
  .product-thumb { width: 64px; height: 64px; }
  .product-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .cat-row { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .spec-pair { grid-template-columns: 1fr; }
  .spec-pair > label { margin-bottom: -6px; }
  .editor-panel { max-height: 94vh; }
}
