/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #060611;
  --bg2:         #0c0c1e;
  --bg3:         #12122a;
  --card:        rgba(255,255,255,0.035);
  --card-border: rgba(255,255,255,0.08);
  --card-hover:  rgba(255,255,255,0.06);
  --accent:      #8b5cf6;
  --accent-2:    #7c3aed;
  --accent-glow: rgba(139,92,246,0.3);
  --success:     #10b981;
  --success-bg:  rgba(16,185,129,0.1);
  --error:       #f87171;
  --error-bg:    rgba(248,113,113,0.1);
  --warn:        #fbbf24;
  --text:        #f1f5f9;
  --text2:       #94a3b8;
  --text3:       #475569;
  --border:      rgba(255,255,255,0.07);
  --radius:      14px;
  --radius-sm:   8px;
  --radius-lg:   20px;
  --font:        'Inter', -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background ───────────────────────────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(139,92,246,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139,92,246,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}
.bg-orb {
  position: fixed; border-radius: 50%; pointer-events: none; filter: blur(80px); z-index: 0;
}
.bg-orb-1 { width: 600px; height: 600px; top: -200px; right: -200px; background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 70%); }
.bg-orb-2 { width: 500px; height: 500px; bottom: -100px; left: -150px; background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%); }

/* ── Header ───────────────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(6,6,17,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}
.logo-name { font-weight: 700; font-size: 16px; display: block; }
.logo-sub  { font-size: 11px; color: var(--text3); display: block; }
.store-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  font-size: 12px; color: var(--text2);
}
.store-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); flex-shrink: 0; }

/* ── Container ────────────────────────────────────────────────────── */
.container {
  max-width: 1100px; margin: 0 auto;
  padding: 32px 24px 80px;
  position: relative; z-index: 1;
}

/* ── Hero / URL Section ───────────────────────────────────────────── */
.hero-section { text-align: center; padding: 48px 0 40px; }
.hero-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800; letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 0%, rgba(139,92,246,0.9) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
}
.hero-sub { color: var(--text2); font-size: 15px; margin-bottom: 32px; }
.url-row {
  display: flex; gap: 10px; max-width: 780px; margin: 0 auto 16px;
}
.url-input-wrap {
  flex: 1; position: relative; display: flex; align-items: center;
}
.url-icon {
  position: absolute; left: 16px; width: 18px; height: 18px;
  color: var(--text3); pointer-events: none; flex-shrink: 0;
}
.url-input {
  width: 100%; padding: 16px 20px 16px 44px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  color: var(--text); font-family: var(--font); font-size: 14px;
  outline: none; transition: all 0.2s;
}
.url-input::placeholder { color: var(--text3); }
.url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(139,92,246,0.05);
}
.btn-import {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; border-radius: var(--radius);
  color: #fff; font-weight: 600; font-size: 15px;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 4px 24px var(--accent-glow);
  transition: all 0.2s;
}
.btn-import:hover { transform: translateY(-1px); box-shadow: 0 8px 32px var(--accent-glow); }
.btn-import:active { transform: translateY(0); }
.btn-import:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.url-hints { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hint-chip {
  padding: 5px 12px; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; font-size: 12px; color: var(--text2);
}

/* ── Progress Stepper ─────────────────────────────────────────────── */
.progress-section {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); padding: 36px 40px; margin-bottom: 24px;
}
.stepper {
  display: flex; align-items: flex-start; justify-content: center; gap: 0;
}
.step-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; min-width: 120px; text-align: center;
}
.step-circle {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--bg3); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  position: relative; transition: all 0.3s;
}
.step-item.active  .step-circle { border-color: var(--accent); background: rgba(139,92,246,0.15); box-shadow: 0 0 20px var(--accent-glow); }
.step-item.done    .step-circle { border-color: var(--success); background: rgba(16,185,129,0.15); }
.step-item.error   .step-circle { border-color: var(--error);   background: rgba(248,113,113,0.15); }
.s-icon { width: 20px; height: 20px; color: var(--text3); transition: all 0.2s; }
.step-item.active  .s-icon-idle { color: var(--accent); }
.step-item.done    .s-icon-done { color: var(--success); }
.step-label { font-weight: 600; font-size: 13px; transition: color 0.2s; }
.step-item.active  .step-label { color: var(--accent); }
.step-item.done    .step-label { color: var(--success); }
.step-desc { font-size: 11px; color: var(--text3); }
.step-connector {
  flex: 1; height: 2px; background: var(--border);
  margin-top: 26px; margin-bottom: auto;
  transition: background 0.3s; max-width: 80px;
}
.step-connector.active { background: linear-gradient(90deg, var(--success), var(--accent)); }
.step-connector.done   { background: var(--success); }
.step-status {
  text-align: center; margin-top: 24px;
  font-size: 13px; color: var(--text2);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Spinner */
.s-spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(139,92,246,0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Product Preview Card ─────────────────────────────────────────── */
.preview-card {
  display: grid; grid-template-columns: 340px 1fr;
  gap: 32px; align-items: start;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: 20px;
}
.preview-img-wrap {
  position: relative; aspect-ratio: 3/4;
  background: var(--bg3); overflow: hidden;
}
.preview-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.preview-img-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--text3);
}
.preview-badge {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 10px;
  background: rgba(139,92,246,0.9); backdrop-filter: blur(8px);
  border-radius: 999px; font-size: 11px; font-weight: 600; color: #fff;
}
.preview-body { padding: 32px 32px 32px 0; display: flex; flex-direction: column; gap: 20px; }
.preview-title { font-size: 20px; font-weight: 700; line-height: 1.3; }
.preview-price { display: flex; align-items: baseline; gap: 12px; }
.price-main { font-size: 28px; font-weight: 800; color: var(--accent); }
.price-compare { font-size: 16px; color: var(--text3); text-decoration: line-through; }
.preview-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip {
  padding: 4px 12px; background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 999px; font-size: 12px; color: var(--accent);
}
.preview-divider { height: 1px; background: var(--border); }
.preview-section-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }
.variants-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.variant-chip {
  padding: 5px 12px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text2);
}
.desc-preview {
  font-size: 13px; color: var(--text2); line-height: 1.7;
  max-height: 200px; overflow-y: auto;
}
.desc-preview::-webkit-scrollbar { width: 4px; }
.desc-preview::-webkit-scrollbar-track { background: var(--bg3); border-radius: 2px; }
.desc-preview::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }
.desc-preview h3 { font-size: 13px; font-weight: 700; color: var(--text); margin: 12px 0 6px; }
.desc-preview p  { margin-bottom: 8px; }
.desc-preview strong { color: var(--text); }
.desc-preview em { color: var(--accent); font-style: italic; }

/* ── Collection Grid ──────────────────────────────────────────────── */
.collection-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.collection-title { font-size: 18px; font-weight: 700; }
.collection-meta { font-size: 13px; color: var(--text2); }
.collection-controls { display: flex; gap: 10px; align-items: center; }
.btn-ghost {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text2);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.btn-ghost:hover { border-color: var(--text2); color: var(--text); }
.btn-select-all {
  padding: 9px 18px; background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); color: var(--text2);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.btn-select-all:hover { border-color: var(--accent); color: var(--accent); }
.btn-import-selected {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; border-radius: var(--radius-sm);
  color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 16px var(--accent-glow); transition: all 0.2s;
}
.btn-import-selected:hover { transform: translateY(-1px); }
.btn-import-selected:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.selected-count { font-size: 12px; color: var(--accent); font-weight: 600; }
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.product-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: all 0.2s; position: relative;
}
.product-card:hover { border-color: rgba(139,92,246,0.35); transform: translateY(-2px); }
.product-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.product-card.processing { border-color: var(--warn); }
.product-card.imported   { border-color: var(--success); }
.product-card.import-error { border-color: var(--error); }
.card-checkbox {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  width: 22px; height: 22px;
  background: rgba(6,6,17,0.8); backdrop-filter: blur(4px);
  border: 2px solid var(--border); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.product-card.selected .card-checkbox {
  background: var(--accent); border-color: var(--accent);
}
.card-checkbox svg { width: 12px; height: 12px; color: #fff; }
.card-status-overlay {
  position: absolute; inset: 0; z-index: 3;
  background: rgba(6,6,17,0.85); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
}
.card-img-wrap { aspect-ratio: 1; overflow: hidden; background: var(--bg3); }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.product-card:hover .card-img-wrap img { transform: scale(1.04); }
.card-body { padding: 12px; }
.card-title { font-size: 12px; font-weight: 500; color: var(--text); line-height: 1.4; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-price { font-size: 13px; font-weight: 700; color: var(--accent); }
.card-meta  { font-size: 11px; color: var(--text3); margin-top: 3px; }
.batch-progress {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 20px 24px; margin-top: 20px;
}
.batch-bar-wrap { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.batch-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--success)); transition: width 0.4s ease; border-radius: 3px; }
.batch-text { font-size: 13px; color: var(--text2); margin-bottom: 10px; }

/* ── Action Bar ───────────────────────────────────────────────────── */
.action-bar {
  display: flex; gap: 12px; justify-content: flex-end;
  padding: 20px 0; margin-bottom: 8px;
}
.btn-confirm {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none; border-radius: var(--radius);
  color: #fff; font-weight: 600; font-size: 15px; cursor: pointer;
  box-shadow: 0 4px 24px var(--accent-glow); transition: all 0.2s;
}
.btn-confirm:hover { transform: translateY(-1px); box-shadow: 0 8px 32px var(--accent-glow); }
.btn-confirm:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Result Messages ──────────────────────────────────────────────── */
.result-msg {
  padding: 20px 24px; border-radius: var(--radius);
  margin-bottom: 24px; animation: slideIn 0.3s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.result-success {
  background: var(--success-bg); border: 1px solid rgba(16,185,129,0.3);
}
.result-error {
  background: var(--error-bg); border: 1px solid rgba(248,113,113,0.3);
}
.result-msg-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.result-success .result-msg-title { color: var(--success); }
.result-error   .result-msg-title { color: var(--error); }
.result-msg-sub { font-size: 13px; color: var(--text2); }
.result-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 8px 16px;
  background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3);
  border-radius: var(--radius-sm); color: var(--success);
  font-size: 13px; font-weight: 600; text-decoration: none; transition: all 0.2s;
}
.result-link:hover { background: rgba(16,185,129,0.25); }

/* ── History Section ──────────────────────────────────────────────── */
.history-section {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}
.history-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
}
.history-title { font-size: 18px; font-weight: 700; }
.history-count {
  padding: 2px 10px; background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; font-size: 12px; color: var(--text2);
}
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 40px; color: var(--text3); text-align: center;
}
.history-item {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 14px 18px;
  transition: border-color 0.2s;
}
.history-item:hover { border-color: rgba(255,255,255,0.12); }
.history-thumb {
  width: 48px; height: 48px; border-radius: 8px; overflow: hidden;
  background: var(--bg3); flex-shrink: 0;
}
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.history-info { flex: 1; min-width: 0; }
.history-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
.history-status {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.status-badge {
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.status-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.status-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid rgba(248,113,113,0.3); }
.history-link {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text2); text-decoration: none;
  transition: all 0.2s;
}
.history-link:hover { border-color: var(--accent); color: var(--accent); }

/* ── Utility ──────────────────────────────────────────────────────── */
.hidden { display: none !important; }
@media (max-width: 700px) {
  .preview-card { grid-template-columns: 1fr; }
  .preview-img-wrap { aspect-ratio: 16/9; }
  .preview-body { padding: 20px; }
  .url-row { flex-direction: column; }
  .action-bar { flex-direction: column-reverse; }
  .btn-confirm, .btn-ghost { width: 100%; justify-content: center; }
}
