:root {
    --accent: #00e673;
    --accent-dark: #00e673;
    --accent-soft: #00e673ab;

    --navy: #0B1020;
    --navy-mid: #12192B;
    --navy-card: #161F35;
    --navy-border: #263247;

    --text: #F8FAFC;
    --text-muted: #94A3B8;
    --text-dim: #64748B;

    --green: #22C55E;
    --red: #EF4444;

    --radius: 12px;
    --radius-sm: 7px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--navy);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background star/grid effect ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(94,234,212,0.06), transparent 30%),
    radial-gradient(circle at bottom left, rgba(255,255,255,0.02), transparent 25%);
  pointer-events: none;
  z-index: 0;
}

.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(232,197,71,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,197,71,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ── Header ── */
header {
  position: relative;
  z-index: 10;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--navy-border);
  backdrop-filter: blur(10px);
  background: rgba(10,14,26,0.85);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
}

.logo-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}

.logo-icon svg { width: 18px; height: 18px; }

.logo span { color: var(--accent); }

.header-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--navy-border);
  color: var(--text-muted);
  background: var(--navy-card);
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.3px;
}

/* ── Main layout ── */
main {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}

/* ── Hero ── */
.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
  padding: 6px 14px;
  border: 1px solid rgba(232,197,71,0.3);
  border-radius: 20px;
  background: rgba(232,197,71,0.06);
}

.hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 1rem;
  color: var(--text);
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ── Pipeline steps bar ── */
.pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 2.5rem;
  overflow-x: auto;
  padding: 0.5rem;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  transition: all 0.3s ease;
  white-space: nowrap;
  cursor: default;
}

.step .step-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--navy-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: all 0.3s;
}

.step-arrow {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 -4px;
  opacity: 0.4;
}

.step.active {
  color: var(--text);
  background: rgba(232,197,71,0.08);
}

.step.active .step-num {
  background: var(--accent);
  color: var(--navy);
}

.step.done {
  color: var(--green);
}

.step.done .step-num {
  background: rgba(46,204,143,0.15);
  color: var(--green);
}

/* ── Main two-column layout ── */
.workspace {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .workspace { grid-template-columns: 1fr; }
}

/* ── Upload zone ── */
.card {
  background: linear-gradient(
    180deg,
    rgba(22,31,53,0.92),
    rgba(15,23,42,0.96)
  );

  border: 1px solid rgba(255,255,255,0.05);

  border-radius: var(--radius);

  overflow: hidden;

  box-shadow:
    0 10px 30px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.03);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--navy-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: rgba(232,197,71,0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 13px;
}

.upload-area {
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.upload-area::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 2px dashed var(--navy-border);
  border-radius: 10px;
  pointer-events: none;
  transition: border-color 0.25s;
}

.upload-area:hover::before,
.upload-area.dragover::before {
  border-color: rgba(232,197,71,0.4);
}

.upload-area.dragover {
  background: rgba(232,197,71,0.03);
}

.upload-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(232,197,71,0.1);
  border: 1px solid rgba(232,197,71,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-icon svg { width: 24px; height: 24px; color: var(--accent); }

.upload-area h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.upload-area p {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.upload-area input[type="file"] {
  display: none;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--navy-border);
  background: transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232,197,71,0.05);
}

/* ── Preview area ── */
.preview-wrap {
  padding: 1.25rem;
}

.image-preview-container {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #0a0d14;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-container img {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: contain;
  display: block;
}

.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem;
  color: var(--text-dim);
  text-align: center;
}

.preview-placeholder svg { opacity: 0.3; }

.preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,14,26,0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  backdrop-filter: blur(4px);
}

.preview-overlay.hidden { display: none; }

/* ── Progress ── */
.progress-ring-wrap {
  position: relative;
  width: 80px; height: 80px;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: var(--navy-border);
  stroke-width: 4;
}

.progress-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  transition: stroke-dashoffset 0.5s ease;
}

.progress-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.processing-label {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  max-width: 220px;
  line-height: 1.5;
}

/* ── Result tabs ── */
.result-tabs {
  display: flex;
  gap: 4px;
  padding: 0.75rem 1.25rem 0;
}

.tab-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: rgba(232,197,71,0.12);
  color: var(--accent);
}

.tab-btn:hover:not(.active) {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Video player ── */
.video-result {
  padding: 1.25rem;
}

.video-result video {
  width: 100%;
  border-radius: 10px;
  background: #000;
}

.video-actions {
  display: flex;
  gap: 8px;
  margin-top: 0.75rem;
}

.btn-primary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--navy);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--navy-border);
  background: transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ── Right panel ── */
.panel-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--navy-border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  transition: border-color 0.2s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(232,197,71,0.5);
}

.field select option {
  background: var(--navy-card);
}

.field textarea {
  resize: vertical;
  min-height: 70px;
  line-height: 1.5;
}

/* ── API key section ── */
.api-section {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.api-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.api-row label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.api-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(46,204,143,0.1);
  color: var(--green);
  border: 1px solid rgba(46,204,143,0.2);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.api-input-wrap {
  position: relative;
}

.api-input-wrap input {
  width: 100%;
  padding: 9px 36px 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--navy-border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-family: monospace;
  outline: none;
  transition: border-color 0.2s;
}

.api-input-wrap input:focus {
  border-color: rgba(232,197,71,0.4);
}

.api-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 14px;
  padding: 2px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.api-toggle:hover { color: var(--text-muted); }

.api-note {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

.api-note a {
  color: var(--accent);
  text-decoration: none;
}

.api-note a:hover { text-decoration: underline; }

/* ── Generate button ── */
.generate-wrap {
  padding: 1.25rem;
  border-top: 1px solid var(--navy-border);
}

#generateBtn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--navy);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: all 0.25s;
}

#generateBtn:hover:not(:disabled) {
  background: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(232,197,71,0.25);
}

#generateBtn:active:not(:disabled) {
  transform: scale(0.99);
}

#generateBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

#generateBtn .btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(10,14,26,0.3);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

#generateBtn.loading .btn-spinner { display: block; }
#generateBtn.loading .btn-icon { display: none; }

/* ── Status log ── */
.status-log {
  padding: 1rem 1.25rem;
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-log:empty { display: none; }

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.5;
  animation: fadeSlide 0.3s ease;
}

.log-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.log-dot.pending { background: var(--text-dim); }
.log-dot.active { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.log-dot.done { background: var(--green); }
.log-dot.error { background: var(--red); }

.log-text { color: var(--text-muted); }
.log-entry.active .log-text { color: var(--text); }
.log-entry.done .log-text { color: var(--green); }
.log-entry.error .log-text { color: var(--red); }

/* ── Info stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 1.25rem 1.25rem;
}

.stat-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--navy-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.stat-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.stat-value.gold { color: var(--accent); }
.stat-value.green { color: var(--green); }

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--navy-border);
  margin: 0;
}

/* ── Section label ── */
.section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding: 0.75rem 1.25rem 0.5rem;
}

/* ── Toast notification ── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--navy-card);
  border: 1px solid var(--navy-border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  z-index: 100;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 320px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success { border-color: rgba(46,204,143,0.3); }
.toast.error { border-color: rgba(226,92,92,0.3); }

.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-msg { color: var(--text-muted); line-height: 1.4; }

/* ── Animation ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse { animation: pulse 1.5s ease-in-out infinite; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-border); border-radius: 4px; }

/* ── Error state ── */
.error-box {
  background: rgba(226,92,92,0.07);
  border: 1px solid rgba(226,92,92,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: #e87f7f;
  display: none;
  margin: 0 1.25rem 1rem;
  line-height: 1.5;
}

.error-box.show { display: block; }

.file-info-bar {
  padding: 8px 1.25rem;
  display: none;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--navy-border);
  background: rgba(232,197,71,0.03);
}

.file-info-bar.show { display: flex; }

.file-info-name {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.file-info-size {
  font-size: 11px;
  color: var(--text-dim);
}

.btn-xs {
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--navy-border);
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-xs:hover {
  color: var(--red);
  border-color: rgba(226,92,92,0.3);
}
