/* V2.2 模块样式（owner: frontend-organize；不改公共 CSS）
   内容：
   1) 配饰信息页重复提醒横幅 / 行徽标
   2) 重复配饰合并面板（modal）
   3) 详情表单：新建品牌 / 类目与识别建议、分享按钮
   4) 批量编辑：新建品牌 / 类目输入
   所有类名以 dedupe- / detail- / batch- 前缀限定，避免影响其它视图。 */

/* ============================================================
   1. 配饰信息页：重复提醒
   ============================================================ */
.dedupe-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
}

.dedupe-slot:empty {
  display: none;
}

.dedupe-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid rgba(178, 80, 0, 0.28);
  border-radius: var(--r-3);
  background: var(--warning-soft);
  color: var(--text);
}

.dedupe-banner-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: rgba(178, 80, 0, 0.14);
  color: var(--warning);
}

.dedupe-banner-text {
  flex: 1;
  min-width: 180px;
}

.dedupe-banner-title {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.dedupe-banner-title strong {
  font-weight: 600;
}

.dedupe-banner-meta {
  margin: 2px 0 0;
  font-size: var(--fs-xs);
  color: var(--text-2);
  line-height: 1.5;
}

.dedupe-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.dedupe-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 10px;
  border-radius: var(--r-2);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
}

.dedupe-status.is-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.dedupe-status-icon {
  display: inline-flex;
  align-items: center;
}

.dedupe-status-text {
  min-width: 0;
}

.info-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.dedupe-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid rgba(178, 80, 0, 0.32);
  border-radius: var(--r-pill);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.dedupe-badge:hover {
  background: rgba(178, 80, 0, 0.16);
}

.dedupe-badge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dedupe-badge-icon {
  display: inline-flex;
  align-items: center;
}

/* ============================================================
   2. 合并面板
   ============================================================ */
.muse-modal.dedupe-modal {
  width: min(880px, 100%);
}

.dedupe-modal .muse-modal-body {
  padding-top: 8px;
}

.dedupe-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dedupe-loading {
  padding: 28px 0;
}

.dedupe-summary {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-2);
  line-height: 1.6;
}

.dedupe-notice-slot,
.dedupe-action-error {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dedupe-notice-slot:empty,
.dedupe-action-error:empty {
  display: none;
}

.dedupe-notice {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--r-2);
  background: var(--success-soft);
  color: var(--success);
  font-size: var(--fs-xs);
  line-height: 1.6;
}

.dedupe-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dedupe-group {
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  background: var(--surface-2);
  overflow: hidden;
  transition: box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.dedupe-group.is-focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* 忽略分组后焦点会移到下一组 section（tabindex=-1），保证键盘用户有明确落点。 */
.dedupe-group:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dedupe-group-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 8px;
}

.dedupe-group-title-wrap {
  min-width: 0;
  flex: 1;
}

.dedupe-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin-left: auto;
}

.dedupe-compare-btn {
  white-space: nowrap;
}

.dedupe-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.dedupe-group-index {
  color: var(--text);
}

.dedupe-kind {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}

.dedupe-kind.is-exact {
  background: var(--accent-soft);
  color: var(--accent);
}

.dedupe-kind.is-similar {
  background: var(--warning-soft);
  color: var(--warning);
}

.dedupe-group-count {
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 400;
}

.dedupe-group-meta {
  margin: 4px 0 0;
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.5;
}

/* 明确的确认提问：比 meta 更醒目，避免用户把「疑似重复」当成确定结论。 */
.dedupe-group-ask {
  margin: 4px 0 0;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

.dedupe-items {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}

.dedupe-item {
  display: grid;
  grid-template-columns: 134px 64px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
}

.dedupe-item.is-primary {
  background: var(--accent-soft);
}

.dedupe-item.is-merged {
  background: var(--surface);
}

.dedupe-item-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dedupe-pick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  font-size: var(--fs-xs);
  color: var(--text-2);
  cursor: pointer;
}

.dedupe-pick input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: none;
  margin: 0;
}

.dedupe-pick-keep {
  color: var(--text);
  font-weight: 600;
}

.dedupe-pick input:disabled + .dedupe-pick-text {
  color: var(--text-3);
}

.dedupe-thumb-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  background: var(--surface-3);
  overflow: hidden;
}

.dedupe-thumb-btn {
  cursor: zoom-in;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.dedupe-thumb-btn:hover {
  border-color: var(--accent);
}

.dedupe-thumb-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dedupe-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dedupe-thumb-empty {
  color: var(--text-3);
}

.dedupe-item-info {
  min-width: 0;
}

.dedupe-item-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dedupe-item-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.dedupe-item-role {
  flex: none;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.7;
}

.dedupe-item-role.is-primary {
  background: var(--accent-solid);
  color: #fff;
}

.dedupe-item-role.is-merged {
  background: var(--warning-soft);
  color: var(--warning);
}

.dedupe-item-meta {
  margin: 4px 0 0;
  font-size: var(--fs-xs);
  color: var(--text-2);
  line-height: 1.5;
}

.dedupe-item-fields {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.55;
}

.dedupe-group-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

.dedupe-selection-summary {
  flex: 1;
  min-width: 180px;
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-2);
}

.dedupe-group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.dedupe-ignore-btn,
.dedupe-merge-btn {
  min-height: var(--control-h-sm);
}

.dedupe-empty,
.dedupe-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 12px 24px;
  text-align: center;
}

.dedupe-error-state {
  align-items: stretch;
  text-align: left;
}

.dedupe-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-3);
}

.dedupe-empty-title {
  margin: 0;
  font-size: var(--fs-body);
  font-weight: 600;
}

.dedupe-empty-desc {
  max-width: 520px;
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-2);
  line-height: 1.7;
}

.dedupe-empty-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}

/* ---- 并排对比弹层（每组图片以大尺寸并排展示，方便确认是否同一款） ---- */
.muse-modal.dedupe-compare-modal {
  width: min(1080px, 100%);
}

.dedupe-compare-ask {
  margin: 4px 0 10px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

.dedupe-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.dedupe-compare-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  background: var(--surface-2);
}

.dedupe-compare-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  max-height: 46vh;
  padding: 8px;
  border-radius: var(--r-2);
  background: var(--surface-3);
  overflow: hidden;
}

.dedupe-compare-img {
  display: block;
  max-width: 100%;
  max-height: 42vh;
  object-fit: contain;
}

.dedupe-compare-missing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

.dedupe-compare-index {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  line-height: 1.7;
}

.dedupe-compare-caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dedupe-compare-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.dedupe-compare-meta {
  font-size: var(--fs-xs);
  color: var(--text-2);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.dedupe-compare-note {
  margin: 12px 0 0;
  font-size: var(--fs-xs);
  color: var(--text-3);
  line-height: 1.6;
}

/* ============================================================
   3. 详情表单：新建品牌 / 类目 + 识别建议 + 分享
   ============================================================ */
.detail-custom-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.detail-custom-field[hidden] {
  display: none;
}

.detail-custom-input {
  width: 100%;
}

.detail-custom-hint {
  margin: 0;
}

.detail-suggest-slot {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding: 7px 9px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-2);
  background: var(--surface-2);
}

.detail-suggest-slot[hidden] {
  display: none;
}

.detail-suggest-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 140px;
}

.detail-suggest-label {
  font-size: var(--fs-xs);
  color: var(--text-2);
  line-height: 1.5;
}

.detail-suggest-meta {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.4;
}

.detail-suggest-adopt {
  flex: none;
  min-height: var(--control-h-sm);
}

.detail-share-btn {
  flex: none;
}

/* ============================================================
   4. 批量编辑：新建品牌 / 类目
   ============================================================ */
.batch-new-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.batch-new-field[hidden] {
  display: none;
}

.batch-new-input {
  width: 100%;
}

/* ============================================================
   5. 窄屏 / 触摸
   ============================================================ */
@media (max-width: 767px) {
  .dedupe-banner {
    align-items: flex-start;
    padding: 10px 12px;
  }

  .dedupe-banner-actions {
    width: 100%;
    margin-left: 0;
  }

  .dedupe-banner-actions .btn {
    width: 100%;
    min-height: var(--control-h);
  }

  .dedupe-badge {
    min-height: 26px;
  }

  .muse-modal.dedupe-modal {
    width: 100%;
  }

  .dedupe-groups {
    gap: 10px;
  }

  .dedupe-item {
    grid-template-columns: minmax(0, 1fr) 56px;
    grid-template-rows: auto auto;
    gap: 8px 10px;
    padding: 10px 12px;
  }

  .dedupe-item-pick {
    grid-column: 1;
    grid-row: 1;
    flex-direction: row;
    gap: 14px;
    align-items: center;
  }

  .dedupe-pick {
    min-height: 32px;
  }

  .dedupe-thumb-wrap {
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 56px;
    height: 56px;
  }

  .dedupe-item-info {
    grid-column: 1;
    grid-row: 2;
  }

  .dedupe-group-head {
    flex-wrap: wrap;
  }

  .dedupe-head-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }

  .dedupe-compare-btn {
    min-height: var(--control-h-sm);
  }

  .dedupe-group-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .dedupe-group-actions {
    width: 100%;
    margin-left: 0;
  }

  .dedupe-ignore-btn,
  .dedupe-merge-btn {
    flex: 1 1 auto;
    width: auto;
    min-height: var(--control-h);
  }

  .dedupe-compare-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dedupe-compare-frame {
    min-height: 180px;
    max-height: 34vh;
  }

  .dedupe-compare-img {
    max-height: 30vh;
  }

  .detail-suggest-slot {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-suggest-adopt {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dedupe-group,
  .dedupe-thumb-btn {
    transition: none;
  }
}
