/* ============================================================
   BG Remover — Stylesheet
   Theme: Dark glass-morphism with electric cyan accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-base:    #080c12;
  --bg-panel:   #0e1420;
  --bg-card:    #131b28;
  --bg-card-h:  #192135;
  --border:     rgba(255,255,255,.07);
  --border-h:   rgba(255,255,255,.14);
  --accent:     #00d9c0;
  --accent-dim: rgba(0,217,192,.12);
  --accent-glo: rgba(0,217,192,.35);
  --danger:     #ff4f6b;
  --warn:       #ffb547;
  --success:    #4ade80;
  --text-1:     #f0f6ff;
  --text-2:     #8fa4c0;
  --text-3:     #4d647e;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 4px 30px rgba(0,0,0,.45);
  --trans:      .2s ease;
  --font-head:  'Syne', sans-serif;
  --font-body:  'DM Sans', sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-1);
  min-height: 100vh;
  overflow-x: hidden;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
img { max-width: 100%; display: block; }

/* ── Background mesh ────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% -10%, rgba(0,217,192,.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 100%, rgba(82,130,255,.07) 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative; z-index: 1;
}

/* ── Header ─────────────────────────────────────────────────── */
header {
  padding: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: rgba(8,12,18,.85);
  backdrop-filter: blur(20px);
  z-index: 100;
}
.logo {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-head);
  font-weight: 800; font-size: 1.35rem;
}
.logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.logo-icon svg { width: 20px; height: 20px; fill: #000; }
.logo-sub { color: var(--accent); }
.header-actions { display: flex; gap: 10px; align-items: center; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-weight: 500; font-size: .875rem;
  transition: var(--trans);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover { background: #00f0d4; transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glo); }
.btn-ghost {
  background: var(--bg-card);
  color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--border-h); background: var(--bg-card-h); }
.btn-danger { background: rgba(255,79,107,.15); color: var(--danger); border: 1px solid rgba(255,79,107,.3); }
.btn-danger:hover { background: rgba(255,79,107,.25); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 72px 0 48px;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(0,217,192,.25);
  color: var(--accent);
  padding: 5px 14px; border-radius: 100px;
  font-size: .78rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 24px;
}
.hero h1 {
  font-family: var(--font-head);
  font-weight: 800; font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1.1; letter-spacing: -.02em;
  margin-bottom: 16px;
}
.hero h1 span { color: var(--accent); }
.hero p {
  color: var(--text-2); font-size: 1.05rem;
  max-width: 540px; margin: 0 auto 36px;
}
.hero-stats {
  display: flex; justify-content: center; gap: 40px;
  flex-wrap: wrap;
}
.stat { text-align: center; }
.stat-val { font-family: var(--font-head); font-weight: 700; font-size: 1.5rem; color: var(--accent); }
.stat-label { font-size: .78rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }

/* ── Drop Zone ──────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-h);
  border-radius: var(--radius);
  padding: 64px 32px;
  text-align: center;
  background: var(--bg-panel);
  cursor: pointer;
  transition: var(--trans);
  position: relative; overflow: hidden;
  margin-bottom: 32px;
}
.drop-zone::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 50%, var(--accent-dim), transparent 70%);
  opacity: 0; transition: opacity .3s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: #0d1824;
}
.drop-zone:hover::before, .drop-zone.drag-over::before { opacity: 1; }
.drop-icon {
  width: 64px; height: 64px; margin: 0 auto 16px;
  background: var(--bg-card);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.drop-icon svg { width: 28px; height: 28px; stroke: var(--accent); }
.drop-title {
  font-family: var(--font-head); font-weight: 700; font-size: 1.2rem;
  margin-bottom: 8px;
}
.drop-sub { color: var(--text-2); font-size: .9rem; margin-bottom: 20px; }
.drop-limits { color: var(--text-3); font-size: .8rem; }

/* ── Toolbar ────────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  padding: 16px 20px;
  background: var(--bg-panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 10px; flex-wrap: wrap; }
.count-badge {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 4px 12px; border-radius: 100px;
  font-size: .8rem; font-weight: 600;
}
.progress-global {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-2); font-size: .85rem;
}
.progress-global .bar {
  width: 120px; height: 6px;
  background: var(--bg-card);
  border-radius: 99px; overflow: hidden;
}
.progress-global .bar-fill {
  height: 100%; background: var(--accent);
  border-radius: 99px; transition: width .4s ease;
}

/* ── Image Grid ─────────────────────────────────────────────── */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

/* ── Image Card ─────────────────────────────────────────────── */
.img-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--trans);
  display: flex; flex-direction: column;
  animation: cardIn .35s ease both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.img-card:hover {
  border-color: var(--border-h);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

/* Card preview area */
.img-preview {
  position: relative;
  aspect-ratio: 1 / 1;
  background: repeating-conic-gradient(#1a2535 0% 25%, #0e1724 0% 50%) 0 0 / 20px 20px;
  overflow: hidden;
}
.img-preview img {
  width: 100%; height: 100%; object-fit: contain;
  transition: opacity .3s;
}
.img-preview .overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8,12,18,.7);
  backdrop-filter: blur(4px);
  flex-direction: column; gap: 8px;
  opacity: 0; transition: opacity .3s;
}
.img-card:hover .overlay { opacity: 1; }
.overlay-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.1);
  color: #fff; font-size: .78rem;
  padding: 6px 14px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.15);
  transition: var(--trans);
}
.overlay-btn:hover { background: rgba(255,255,255,.2); }
.overlay-btn svg { width: 14px; height: 14px; }

/* Status badge on card */
.status-badge {
  position: absolute; top: 10px; right: 10px;
  padding: 3px 10px; border-radius: 100px;
  font-size: .7rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
}
.status-pending   { background: rgba(143,164,192,.15); color: var(--text-2); }
.status-processing{ background: rgba(255,181,71,.15);  color: var(--warn); }
.status-done      { background: rgba(74,222,128,.15);  color: var(--success); }
.status-failed    { background: rgba(255,79,107,.15);  color: var(--danger); }

/* Card body */
.img-info {
  padding: 14px 16px;
  flex: 1; display: flex; flex-direction: column; gap: 6px;
}
.img-name {
  font-weight: 500; font-size: .85rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text-1);
}
.img-meta { color: var(--text-3); font-size: .75rem; }

/* Progress bar inside card */
.card-progress {
  height: 3px; background: var(--bg-panel);
  border-radius: 0; overflow: hidden;
}
.card-progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 0; transition: width .5s ease;
}

/* Card actions */
.card-actions {
  display: flex; gap: 6px; padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.card-actions .btn { flex: 1; justify-content: center; padding: 8px 12px; font-size: .78rem; }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  display: none;
}
.empty-state.visible { display: block; }
.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-title { font-family: var(--font-head); font-size: 1.2rem; margin-bottom: 8px; }
.empty-sub { color: var(--text-2); font-size: .9rem; }

/* ── History Panel ───────────────────────────────────────────── */
.history-section {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}
.section-title {
  font-family: var(--font-head); font-weight: 700; font-size: 1.4rem;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.section-title svg { width: 20px; height: 20px; stroke: var(--accent); }

/* ── Toast ───────────────────────────────────────────────────── */
.toast-wrap {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: .85rem;
  box-shadow: var(--shadow);
  animation: toastIn .3s ease both;
  max-width: 340px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast.fadeout { animation: toastOut .3s ease both; }
@keyframes toastOut {
  to { opacity: 0; transform: translateX(24px); }
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger);  }
.toast-info    { border-left: 3px solid var(--accent);  }

/* ── Loading spinner ─────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Compare Slider (hover reveal) ──────────────────────────── */
.compare-wrap {
  position: relative; overflow: hidden;
  width: 100%; height: 100%;
}
.compare-wrap .after-img {
  position: absolute; inset: 0;
  clip-path: inset(0 50% 0 0);
  transition: clip-path .4s ease;
}
.compare-wrap:hover .after-img { clip-path: inset(0 0 0 0); }

/* ── Model Loading Banner ────────────────────────────────────── */
.model-banner {
  display: flex; align-items: center; gap: 14px;
  background: rgba(0,217,192,.06);
  border: 1px solid rgba(0,217,192,.2);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 24px;
  color: var(--text-2); font-size: .875rem;
}
.model-banner .spinner { width: 20px; height: 20px; border-width: 2px; }
.model-banner.hidden { display: none; }
.model-banner.ready {
  background: rgba(74,222,128,.06);
  border-color: rgba(74,222,128,.2);
  color: var(--success);
}

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-3); font-size: .82rem;
  margin-top: 60px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 48px 0 32px; }
  .drop-zone { padding: 40px 20px; }
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .toolbar { padding: 12px 14px; }
  .hero-stats { gap: 24px; }
}
