/* ===== CSS 变量 ===== */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-hover: 0 4px 12px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.08);
}

/* ===== 全局 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.12), transparent 28%),
    linear-gradient(180deg, #f5f9ff 0%, #edf3f9 42%, #f0f4f8 100%);
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== Header ===== */
header {
  padding: 1.2rem 1rem .35rem;
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  color: #fff;
  background: linear-gradient(135deg, #143a8c 0%, #2563eb 58%, #4f8dfd 100%);
  border-radius: 28px;
  padding: 1.5rem 1.6rem 1.35rem;
  box-shadow: 0 18px 40px rgba(26, 65, 147, .18);
  position: relative;
  overflow: hidden;
}

.header-inner::before {
  content: "";
  position: absolute;
  inset: -30% auto auto 58%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,.22) 0%, rgba(255,255,255,0) 68%);
  pointer-events: none;
}

.header-inner::after {
  content: "";
  position: absolute;
  inset: auto auto -58px -38px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,216,77,.18) 0%, rgba(255,216,77,0) 72%);
  pointer-events: none;
}

.logo {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-bottom: .4rem;
  position: relative;
  z-index: 1;
}

.logo-mark {
  width: 46px;
  height: 46px;
  display: block;
  filter: drop-shadow(0 8px 18px rgba(4, 14, 37, 0.28));
}

.logo-text { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }

.header-sub {
  font-size: .95rem;
  opacity: .9;
  margin-left: 3.8rem;
  max-width: 560px;
  position: relative;
  z-index: 1;
}

/* ===== Main ===== */
main {
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ===== Step Card ===== */
.step-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s;
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.4rem 1.6rem;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.step-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .3s;
}

.step-badge.done {
  background: var(--success);
}

.step-title-group { flex: 1; }
.step-title-group h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: .15rem; }
.step-desc { font-size: .875rem; color: var(--gray-600); }

.step-status {
  font-size: .85rem;
  font-weight: 500;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-shrink: 0;
}

.step-body {
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

/* ===== Tab ===== */
.tab-group {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: .45rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--gray-600);
  font-size: .875rem;
  cursor: pointer;
  transition: all .15s;
}

.tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tab-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* ===== Upload Zone ===== */
.upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--gray-50);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-icon { font-size: 2.5rem; margin-bottom: .6rem; }
.upload-label { font-size: .95rem; font-weight: 500; color: var(--gray-800); }
.upload-hint { font-size: .82rem; color: var(--gray-400); margin-top: .3rem; }

/* ===== Textarea ===== */
.asin-textarea {
  width: 100%;
  height: 160px;
  padding: .75rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: .875rem;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
  line-height: 1.7;
}

.asin-textarea:focus { border-color: var(--primary); }

/* ===== Result Box ===== */
.result-box {
  background: var(--success-light);
  border: 1.5px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
}

.result-summary {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  margin-bottom: .6rem;
}

.result-count {
  font-size: 2rem;
  font-weight: 700;
  color: var(--success);
  line-height: 1;
}

.result-label { font-size: .95rem; color: var(--gray-600); }

.asin-preview {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.asin-tag {
  background: #fff;
  border: 1px solid #bbf7d0;
  border-radius: 4px;
  padding: .15rem .5rem;
  font-size: .8rem;
  font-family: "SF Mono", monospace;
  color: var(--gray-600);
}

.asin-tag.more {
  background: var(--gray-100);
  border-color: var(--gray-200);
  font-style: italic;
}

/* ===== Image Result ===== */
.img-result {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.img-preview {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
}

.img-info {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding-top: .25rem;
}

.img-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .875rem;
}

.info-label { color: var(--gray-600); }
.info-value { font-weight: 600; }

.info-badge {
  font-size: .8rem;
  font-weight: 600;
  padding: .25rem .7rem;
  border-radius: 20px;
}

.info-badge.warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid #fde68a;
}

/* ===== Generate ===== */
.generate-info {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.info-chip {
  background: var(--gray-100);
  border-radius: 20px;
  padding: .35rem .9rem;
  font-size: .875rem;
  color: var(--gray-600);
}

.info-chip strong { color: var(--primary); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-800);
  border: 1.5px solid var(--gray-200);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-large {
  padding: .8rem 2rem;
  font-size: 1rem;
  align-self: flex-start;
}

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

/* ===== Progress ===== */
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .5rem;
}

.progress-bar-track {
  height: 10px;
  background: var(--gray-100);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 5px;
  width: 0%;
  transition: width .3s ease;
}

.progress-sub {
  font-size: .82rem;
  color: var(--gray-400);
  margin-top: .4rem;
}

/* ===== Download ===== */
.download-placeholder {
  background: var(--gray-50);
  border: 1.5px dashed var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 2rem;
  text-align: center;
  font-size: .9rem;
  color: var(--gray-400);
}

.download-summary {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: .8rem 1.2rem;
  font-size: .9rem;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 1rem;
}

.zip-list {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: 1.2rem;
}

.zip-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
  gap: .5rem;
}

.zip-item-name {
  font-family: "SF Mono", monospace;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-800);
}

.zip-item-info {
  font-size: .82rem;
  color: var(--gray-400);
}

/* ===== Error ===== */
.error-msg {
  background: var(--danger-light);
  border: 1.5px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .875rem;
  color: var(--danger);
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: .82rem;
  color: var(--gray-400);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .step-header { padding: 1rem 1.2rem; }
  .step-body { padding: 1.2rem; }
  .logo-text { font-size: 1.2rem; }
  .img-result { flex-direction: column; }
  .img-preview { width: 100%; height: auto; max-height: 220px; }
}
