/**
 * 查重检测页面组 — V21 设计系统样式
 * 上传页 / 结果列表 / 详情报告
 * 统一使用 CSS 变量，支持深色/浅色主题
 */
@import "../../styles/global.css";

/* ============================================================
   通用页面容器
   ============================================================ */
.dup-page {
  padding: var(--space-2xl) var(--space-lg);
  max-width: 1100px;
  margin: 0 auto;
}

.dup-page-header {
  margin-bottom: var(--space-lg);
}

.dup-page-header h2 {
  margin: 0 0 6px;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dup-page-header p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* ============================================================
   上传页面 — 左右分栏
   ============================================================ */
.dup-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

/* 上传区域 */
.dup-upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  background: var(--bg-primary);
  transition: var(--transition-all);
  cursor: pointer;
}

.dup-upload-zone:hover,
.dup-upload-zone.dragging {
  border-color: var(--primary-color);
  background: var(--primary-soft);
}

.dup-upload-zone.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dup-upload-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  margin: 0 auto var(--space-md);
  display: grid;
  place-items: center;
  font-size: 28px;
}

.dup-upload-zone h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.dup-upload-zone p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.dup-upload-formats {
  margin-top: var(--space-sm);
  font-size: 12px;
  color: var(--text-secondary);
}

.dup-upload-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.dup-upload-actions .xx-btn-primary {
  flex: 1;
}

/* 上传进度 */
.dup-progress {
  margin-top: var(--space-lg);
  text-align: center;
}

.dup-progress-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--primary-soft);
  margin: 0 auto var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.dup-progress-circle .dup-progress-icon {
  font-size: 28px;
}

.dup-progress-circle .dup-progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
}

.dup-progress p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* 上传结果 */
.dup-result {
  margin-top: var(--space-lg);
  text-align: center;
}

.dup-result-icon {
  font-size: 48px;
  margin-bottom: var(--space-sm);
}

.dup-result h3 {
  margin: 0 0 8px;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.dup-result p {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.dup-result-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

/* 右侧：格式说明 + 提示 */
.dup-info-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.dup-info-card h3 {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dup-info-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dup-info-list li {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.dup-info-list li::before {
  content: "•";
  color: var(--primary-color);
  font-weight: bold;
  flex-shrink: 0;
}

.dup-format-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: var(--space-md);
}

/* ============================================================
   结果列表页面
   ============================================================ */
.dup-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.dup-results-header h2 {
  margin: 0;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

/* 筛选胶囊 */
.dup-filter {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: 999px;
  border: 1px solid var(--border-color);
}

.dup-filter-btn {
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-all);
  white-space: nowrap;
  user-select: none;
}

.dup-filter-btn:hover {
  color: var(--primary-color);
  background: var(--primary-soft);
}

.dup-filter-btn.active {
  background: var(--primary-soft);
  border-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 600;
}

/* 结果卡片列表 */
.dup-results-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.dup-results-empty {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
}

.dup-results-empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-sm);
  opacity: 0.5;
}

.dup-results-empty p {
  margin: 0;
  font-size: var(--font-size-sm);
}

/* 结果卡片 */
.dup-result-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  cursor: pointer;
  transition: var(--transition-all);
}

.dup-result-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.dup-result-card-thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  display: grid;
  place-items: center;
  font-size: 28px;
  flex-shrink: 0;
}

.dup-result-card-body {
  flex: 1;
  min-width: 0;
}

.dup-result-card-body h4 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dup-result-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 12px;
  color: var(--text-secondary);
}

.dup-result-card-score {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.dup-score-bar {
  width: 60px;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  overflow: hidden;
}

.dup-score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.dup-score-bar-fill.low {
  background: var(--success-color);
}

.dup-score-bar-fill.medium {
  background: var(--warning-color);
}

.dup-score-bar-fill.high {
  background: var(--error-color);
}

.dup-score-value {
  font-size: 14px;
  font-weight: 700;
  min-width: 36px;
  text-align: right;
}

.dup-score-value.low {
  color: var(--success-color);
}

.dup-score-value.medium {
  color: var(--warning-color);
}

.dup-score-value.high {
  color: var(--error-color);
}

/* ============================================================
   详情/报告页面
   ============================================================ */
.dup-detail-back {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-all);
  background: none;
  border: none;
  padding: 0;
}

.dup-detail-back:hover {
  color: var(--primary-color);
}

.dup-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  gap: var(--space-md);
  flex-wrap: wrap;
}

.dup-detail-header h2 {
  margin: 0 0 6px;
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
}

.dup-detail-header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.dup-detail-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* 详情内容网格 */
.dup-detail-grid {
  display: grid;
  gridtemplatecolumns: 1fr 1fr;
  gap: var(--space-lg);
}

/* 风险评估卡片 */
.dup-risk-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}

.dup-risk-card h3 {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.dup-risk-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 0 auto var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.dup-risk-circle.low {
  background: var(--success-soft);
  color: var(--success-color);
}

.dup-risk-circle.medium {
  background: var(--warning-soft);
  color: var(--warning-color);
}

.dup-risk-circle.high {
  background: var(--error-soft);
  color: var(--error-color);
}

.dup-risk-circle .dup-risk-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
}

.dup-risk-circle .dup-risk-label {
  font-size: 14px;
  opacity: 0.8;
}

.dup-risk-desc {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* 基本信息卡片 */
.dup-info-detail-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.dup-info-detail-card h3 {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.dup-info-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dup-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--font-size-sm);
}

.dup-info-row-label {
  color: var(--text-secondary);
}

.dup-info-row-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* 检测项列表 */
.dup-checks-section {
  grid-column: 1 / -1;
}

.dup-checks-section h3 {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.dup-checks-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.dup-check-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  transition: var(--transition-all);
}

.dup-check-item:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.dup-check-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.dup-check-body {
  flex: 1;
  min-width: 0;
}

.dup-check-body h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.dup-check-body p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.dup-check-bar {
  width: 100px;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  overflow: hidden;
  flex-shrink: 0;
}

.dup-check-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.dup-check-bar-fill.low {
  background: var(--success-color);
}

.dup-check-bar-fill.medium {
  background: var(--warning-color);
}

.dup-check-bar-fill.high {
  background: var(--error-color);
}

.dup-check-value {
  font-size: 14px;
  font-weight: 700;
  min-width: 40px;
  text-align: right;
  flex-shrink: 0;
}

.dup-check-value.low {
  color: var(--success-color);
}

.dup-check-value.medium {
  color: var(--warning-color);
}

.dup-check-value.high {
  color: var(--error-color);
}

/* 匹配片段列表 */
.dup-matches-section {
  grid-column: 1 / -1;
}

.dup-matches-section h3 {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.dup-match-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: var(--space-sm);
}

.dup-match-item:last-child {
  margin-bottom: 0;
}

.dup-match-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.dup-match-body {
  flex: 1;
  min-width: 0;
}

.dup-match-body h4 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.dup-match-body p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================================
   简易 Toast 提示
   ============================================================ */
.dup-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  z-index: 1000;
  animation: dup-toast-in 0.3s ease;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

.dup-toast--success {
  background: var(--success-soft);
  color: var(--success-color);
  border: 1px solid var(--success-border);
}

.dup-toast--error {
  background: var(--error-soft);
  color: var(--error-color);
  border: 1px solid var(--error-border);
}

.dup-toast--warning {
  background: var(--warning-soft);
  color: var(--warning-color);
  border: 1px solid var(--warning-border);
}

@keyframes dup-toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
  .dup-upload-grid {
    grid-template-columns: 1fr;
  }

  .dup-detail-grid {
    grid-template-columns: 1fr;
  }

  .dup-checks-section,
  .dup-matches-section {
    grid-column: auto;
  }

  .dup-results-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dup-detail-header {
    flex-direction: column;
  }

  .dup-upload-zone {
    padding: 32px 16px;
  }

  .dup-result-card {
    flex-direction: column;
    text-align: center;
  }

  .dup-result-card-meta {
    justify-content: center;
  }

  .dup-check-item {
    flex-wrap: wrap;
  }

  .dup-check-bar {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .dup-upload-zone {
    padding: 24px 12px;
  }

  .dup-match-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .dup-match-thumb {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}
