/* ============================================================
   VibeSeller UX 体验优化层（追加于 styles.css 之后，只做覆盖增强）
   1) 全局排版：卡片、按钮、表单、表格、通知条
   2) 侧边导航：分组信息架构
   3) WB 竞品风格再创作：分步流程（stepper + flow-step）
   ============================================================ */

/* ---------- 1. 全局排版 ---------- */

body {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* 卡片：圆角 + 柔和阴影，弱化生硬边框 */
.panel {
  border-radius: 14px !important;
  box-shadow: 0 6px 24px rgba(14, 34, 62, .06);
  border: 1px solid #e3eaf3 !important;
}

.panel-head {
  padding-bottom: 14px;
  border-bottom: 1px solid #edf1f7;
  margin-bottom: 16px;
}

/* 按钮：圆角 + 过渡 */
.btn {
  border-radius: 9px;
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary:hover {
  background: #1e5be0;
  box-shadow: 0 6px 16px rgba(40, 108, 255, .28);
}

.btn.secondary:hover {
  border-color: #b9c9de;
  background: #f7fafd;
}

.btn.danger:hover {
  box-shadow: 0 6px 16px rgba(231, 90, 97, .25);
}

/* 表单控件：统一圆角与聚焦态 */
input, select, textarea {
  border-radius: 8px !important;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px rgba(40, 108, 255, .12);
}

/* 页头：更紧凑、层级更清晰 */
header h1 {
  letter-spacing: .01em;
}

.header-actions {
  align-items: center;
  flex-wrap: wrap;
}

/* 顶部通知条：更轻量的呈现 */
.notice {
  border-radius: 10px;
  border: 1px solid #dbe7f5;
  background: #f2f7fd;
  padding: 12px 16px;
}

/* 表格：行 hover 反馈 + 更舒适的行距 */
.table-wrap {
  border-radius: 10px;
}

tbody tr {
  transition: background .12s ease;
}

tbody tr:hover {
  background: #f6f9fd;
}

/* 上传区：更明确的可点击感 */
.upload-zone {
  border-radius: 12px;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.upload-zone:hover {
  border-color: var(--blue);
  background: #f5f9ff;
}

/* 状态徽章 */
.chip {
  border-radius: 999px;
}

.quality-score {
  border-radius: 999px;
}

/* ---------- 2. 侧边导航分组 ---------- */

.sidebar nav {
  gap: 18px;
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-group-label {
  margin: 0 0 2px;
  padding: 0 14px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .14em;
  color: #5c6f88;
  text-transform: uppercase;
}

.nav-item {
  border-radius: 9px;
  padding: 11px 14px;
  transition: background .15s ease, color .15s ease;
}

.nav-item.active {
  background: linear-gradient(90deg, #173a5e, #142c47);
  box-shadow: inset 3px 0 0 var(--cyan);
}

/* 窄屏下隐藏分组标题，与原有折叠逻辑保持一致 */
@media (max-width: 1100px) {
  .nav-group-label {
    display: none;
  }

  .sidebar nav {
    gap: 6px;
  }
}

/* ---------- 3. WB 再创作 · 分步流程 ---------- */

/* 顶部步骤指示条 */
.flow-stepper {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
}

.flow-stepper li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e3eaf3;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--muted);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.flow-stepper .step-num {
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e8eef6;
  color: #62738a;
  font-size: 12px;
  font-weight: 900;
}

.flow-stepper li strong {
  display: block;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.3;
}

.flow-stepper li small {
  display: block;
  font-size: 10px;
  margin-top: 2px;
  color: var(--muted);
}

.flow-stepper li.current {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 108, 255, .10);
}

.flow-stepper li.current .step-num {
  background: var(--blue);
  color: #fff;
}

.flow-stepper li.done {
  background: #f2fbf8;
  border-color: #bfe6da;
}

.flow-stepper li.done .step-num {
  background: #168878;
  color: #fff;
}

/* 表单列内的分步卡片 */
.flow-step {
  position: relative;
  border: 1px solid #e3eaf3;
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  margin-bottom: 16px;
  display: grid;
  gap: 12px;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.flow-step.current {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 108, 255, .08);
}

.flow-step.done {
  border-color: #bfe6da;
  background: #fbfefd;
}

.flow-step-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.flow-step-num {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e8eef6;
  color: #62738a;
  font-size: 12px;
  font-weight: 900;
  margin-top: 1px;
}

.flow-step.current .flow-step-num {
  background: var(--blue);
  color: #fff;
}

.flow-step.done .flow-step-num {
  background: #168878;
  color: #fff;
}

.flow-step-head strong {
  display: block;
  font-size: 14px;
}

.flow-step-head small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

/* 第 5 步发布区保留原有 publish-box 的底色，但去掉双重边框的拥挤感 */
.flow-step.publish-box {
  background: #f8fafc;
}

/* 生成工作区展开时与上方步骤自然衔接 */
#wbAssetWorkPanel {
  display: grid;
  gap: 0;
}

#wbAssetWorkPanel.hidden {
  display: none;
}

/* 步骤条在小屏下落为两列 */
@media (max-width: 1200px) {
  .flow-stepper {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .flow-stepper {
    grid-template-columns: 1fr;
  }
}

/* ---------- 4. WB 再创作 · 深度优化组件 ---------- */

/* 产品原图预览：首图标识 + 单张移除 */
.own-preview-item {
  position: relative;
  margin: 0;
  display: inline-block;
}

.own-preview-item img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f3f6fa;
  display: block;
}

.own-preview-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  background: rgba(11, 20, 36, .82);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  pointer-events: none;
}

.own-preview-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--red);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  box-shadow: 0 2px 6px rgba(14, 34, 62, .15);
}

.own-preview-remove:hover {
  background: var(--red);
  color: #fff;
}

.image-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* 详情数据特征表 */
.wb-charc-block {
  display: grid;
  gap: 10px;
  border: 1px dashed #c9d6e6;
  border-radius: 10px;
  padding: 12px;
  background: #fbfcfe;
}

.wb-charc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
}

.wb-charc-head .btn {
  padding: 7px 12px;
  font-size: 11px;
}

.wb-charc-wrap {
  max-height: 280px;
  overflow: auto;
}

.wb-charc-table {
  width: 100%;
  border-collapse: collapse;
}

.wb-charc-table th {
  text-align: left;
  font-size: 10px;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fbfcfe;
}

.wb-charc-table td {
  padding: 4px 6px;
  vertical-align: middle;
}

.wb-charc-table input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 7px 9px;
  font-size: 11px;
}

/* 生图控制条：数量选择 + 提示词生成 */
.wb-image-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.wb-image-controls label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  min-width: 150px;
}

/* 提示词编辑器 */
.wb-prompt-editor {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.wb-prompt-card {
  border: 1px solid #e3eaf3;
  border-radius: 10px;
  background: #fbfcfe;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.wb-prompt-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wb-prompt-card-head .step-num {
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e8eef6;
  color: #62738a;
  font-size: 11px;
  font-weight: 900;
}

.wb-prompt-card-head input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.wb-prompt-card textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.6;
  font-family: inherit;
  resize: vertical;
}

.wb-prompt-override summary {
  cursor: pointer;
  font-size: 10px;
  color: var(--muted);
  font-weight: 800;
}

.wb-prompt-override textarea {
  margin-top: 8px;
  width: 100%;
  font-family: Consolas, monospace;
  font-size: 10px;
}

/* 右侧参考面板：公开详情数据与描述 */
.wb-ref-charcs, .wb-ref-desc {
  border: 1px solid #e3eaf3;
  border-radius: 10px;
  background: #fbfcfe;
  padding: 10px 12px;
  margin: 10px 0;
}

.wb-ref-charcs summary, .wb-ref-desc summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  color: var(--ink);
}

.wb-ref-charcs dl {
  margin: 10px 0 2px;
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
}

.wb-ref-charcs dl > div {
  display: grid;
  grid-template-columns: minmax(120px, .9fr) 1.1fr;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px dashed #edf1f7;
  font-size: 11px;
}

.wb-ref-charcs dt {
  color: var(--muted);
  font-weight: 700;
}

.wb-ref-charcs dd {
  margin: 0;
  color: var(--ink);
}

.wb-ref-desc p {
  margin: 8px 0 2px;
  font-size: 11px;
  line-height: 1.7;
  color: #526479;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
}

/* ---- 后台发布任务面板 ---- */
.wb-task-panel {
  margin-top: 16px;
}
#wbPublishTaskList {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wb-task-item {
  border: 1px solid #e3e9f2;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fbfcfe;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wb-task-item.running { border-color: #7aa7ff; background: #f5f8ff; }
.wb-task-item.failed { border-color: #f0a8a8; background: #fff7f7; }
.wb-task-item.success { border-color: #a4d9b4; background: #f6fbf7; }
.wb-task-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.wb-task-head small { color: #8a97a8; margin-left: auto; }
.wb-task-title { font-size: 14px; }
.wb-task-badge {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.wb-task-badge.queued { background: #eef1f6; color: #5b6b80; }
.wb-task-badge.running { background: #dbe7ff; color: #2b5fd9; }
.wb-task-badge.success { background: #d9f0e1; color: #1c7a3d; }
.wb-task-badge.failed { background: #fbdede; color: #b3261e; }
.wb-task-track {
  height: 8px;
  background: #e8edf4;
  border-radius: 999px;
  overflow: hidden;
}
.wb-task-track > div {
  height: 100%;
  background: linear-gradient(90deg, #4a7dff, #6aa1ff);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.wb-task-phase { color: #526479; }
.wb-task-result {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #33445c;
}
.wb-task-media { color: #1c7a3d; font-weight: 600; }
.wb-task-error {
  border-top: 1px dashed #f0c1c1;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wb-task-error strong { color: #b3261e; }
.wb-task-error p { margin: 0; color: #5c4141; font-size: 13px; }
.wb-task-hint { color: #7a5c00 !important; background: #fff7dd; border-radius: 8px; padding: 6px 10px; }
.wb-task-retry { align-self: flex-start; }

/* ---- WB 多店铺 ---- */
.wb-store-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 8px;
  padding: 12px 14px;
  border: 1px solid #e3e9f2;
  border-radius: 12px;
  background: #fbfcfe;
}
.wb-store-select > strong { font-size: 13px; color: #33445c; }
.wb-store-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
.wb-store-option small { color: #8a97a8; margin-left: auto; }
.wb-store-default {
  font-style: normal;
  font-size: 11px;
  color: #1c7a3d;
  background: #d9f0e1;
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 6px;
}
.wb-store-empty { font-size: 13px; color: #8a97a8; }
.wb-task-store {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  background: #efe7fb;
  color: #6a3fb5;
}
.wb-account-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.wb-account-list > strong { font-size: 13px; color: #33445c; }
.wb-account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #e3e9f2;
  border-radius: 10px;
  background: #fbfcfe;
  font-size: 13px;
}
.wb-account-item small { color: #8a97a8; }
.wb-account-actions { margin-left: auto; display: flex; gap: 10px; }
.wb-account-actions .danger { color: #b3261e; }

/* ---- WB 店铺商品与价格 ---- */
.wb-store-toolbar { display: flex; gap: 10px; align-items: center; }
.wb-store-summary { margin-top: 14px; }
.wb-store-filters {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 10px;
}
.wb-store-filters input {
  flex: 0 1 340px;
  padding: 9px 12px;
  border: 1px solid var(--line, #dde5ee);
  border-radius: 8px;
  font: inherit;
}
.wb-store-filters span { color: var(--muted, #7a8899); font-size: 13px; }
.wb-store-actions {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px solid #e3e9f2;
  border-radius: 12px;
  background: #fbfcfe;
  margin-bottom: 14px;
}
.wb-store-action { display: flex; align-items: flex-end; gap: 8px; }
.wb-store-action label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: #55677e; font-weight: 600; }
.wb-store-action input {
  width: 130px;
  padding: 8px 10px;
  border: 1px solid var(--line, #dde5ee);
  border-radius: 8px;
  font: inherit;
}
.wb-store-table-wrap { max-height: 640px; overflow: auto; border: 1px solid var(--line, #dde5ee); border-radius: 10px; }
.wb-store-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wb-store-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3f6fa;
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  color: #55677e;
  white-space: nowrap;
}
.wb-store-table td { padding: 8px 12px; border-top: 1px solid #eef2f7; vertical-align: middle; }
.wb-store-table tbody tr:hover { background: #f7fbff; }
.wb-store-title { max-width: 320px; }
