/* ── Layout ──────────────────────────────────────── */

.app-wrap {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────── */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: rgba(41,6,64,0.70);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-logo { height: 22px; }

.header-tag {
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--fg-subtle);
}

/* ── Main ────────────────────────────────────────── */

.main {
  flex: 1;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-5) var(--sp-9);
}

/* ── Hero ────────────────────────────────────────── */

.hero {
  margin-bottom: var(--sp-7);
}

.hero-eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-3);
}
.hero-eyebrow::before { content: '[ '; }
.hero-eyebrow::after  { content: ' ]'; }

.hero-title {
  font-size: var(--fs-display);
  font-weight: 400;
  letter-spacing: var(--ls-display);
  line-height: var(--lh-tight);
  color: var(--fg);
  margin-bottom: var(--sp-3);
}

.hero-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}

.hero-sub {
  font-size: var(--fs-body);
  color: var(--fg-muted);
  max-width: 50ch;
  line-height: var(--lh-body);
}

/* ── Quality Selector ────────────────────────────── */

.quality-bar {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.quality-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--sp-3) var(--sp-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

.quality-btn:hover {
  border-color: var(--border-cyan);
  background: rgba(0,255,255,0.04);
}

.quality-btn.active {
  border-color: var(--homium-cyan);
  background: rgba(0,255,255,0.08);
}

.quality-btn .q-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}

.quality-btn.active .q-label { color: var(--accent); }

.quality-btn .q-hint {
  font-size: var(--fs-caption);
  color: var(--fg-subtle);
}

/* ── Target size control ─────────────────────────── */

.target-size-wrap {
  background: var(--bg-elevated);
  border: 1px solid var(--border-cyan);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-5);
}

.target-size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.target-label {
  font-size: var(--fs-body-sm);
  font-weight: 500;
  color: var(--fg-muted);
}

.target-input-group {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.target-value {
  font-size: var(--fs-h3);
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
  min-width: 72px;
  text-align: center;
}

.target-step {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-cyan);
  background: transparent;
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease-out);
}
.target-step:hover { background: rgba(0,255,255,0.10); }

.target-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-sunken);
  outline: none;
  margin-bottom: var(--sp-2);
}
.target-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--homium-cyan);
  cursor: pointer;
  box-shadow: var(--glow-cyan);
}

.target-hints {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-caption);
  color: var(--fg-subtle);
  font-family: var(--font-mono);
}

.target-hint-note {
  font-family: var(--font-sans);
  color: var(--fg-subtle);
  font-size: 11px;
}

/* ── Drop Zone ───────────────────────────────────── */

.dropzone {
  border: 1.5px dashed var(--border-cyan);
  border-radius: var(--radius-xl);
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--dur-med) var(--ease-out),
    background   var(--dur-med) var(--ease-out);
  background: rgba(0,255,255,0.02);
  position: relative;
}

.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--homium-cyan);
  background: rgba(0,255,255,0.05);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--sp-4);
  color: var(--accent);
  opacity: 0.7;
}

.drop-title {
  font-size: var(--fs-h3);
  font-weight: 500;
  color: var(--fg);
  margin-bottom: var(--sp-2);
}

.drop-sub {
  font-size: var(--fs-body-sm);
  color: var(--fg-subtle);
}

.drop-formats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-1);
  margin-top: var(--sp-4);
}

.format-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: 0.04em;
  background: rgba(90,234,162,0.08);
  color: var(--accent-2);
  border: 1px solid rgba(90,234,162,0.18);
}

/* ── ZIP folder upload ───────────────────────────── */

.zip-upload-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
  font-size: var(--fs-body-sm);
  color: var(--fg-subtle);
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: var(--fs-body-sm);
  font-weight: 500;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
}

.zip-job {
  margin-top: var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}

.zip-job-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.zip-job-title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.zip-job-name {
  font-weight: 600;
  color: var(--fg);
  word-break: break-all;
}

.zip-file-list {
  margin-top: var(--sp-3);
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zip-file-row {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  font-size: var(--fs-body-sm);
}

.zip-file-row.zip-file-done {
  background: rgba(90,234,162,0.06);
}

.zip-file-row.zip-file-failed {
  background: rgba(255,95,95,0.06);
}

.zip-file-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: 4px;
}

.zip-file-name {
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.zip-file-sizes {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--fg-subtle);
}

.zip-file-sizes .zip-size-new {
  color: var(--accent-2);
  font-weight: 600;
}

.zip-file-sizes .zip-savings {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(90,234,162,0.12);
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 600;
}

.zip-file-status {
  flex-shrink: 0;
  color: var(--fg-subtle);
  font-size: 11px;
}

.zip-file-status.zip-file-error {
  color: #ff8080;
}

.zip-file-progress-track {
  height: 3px;
  background: var(--bg-sunken);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.zip-file-progress-fill {
  height: 100%;
  background: var(--homium-cyan);
  border-radius: var(--radius-pill);
  transition: width 0.3s var(--ease-out);
  width: 0%;
}

.zip-file-progress-fill.done {
  background: var(--homium-green);
}

.zip-file-progress-fill.error {
  background: #ff5f5f;
}

.zip-job-actions {
  margin-top: var(--sp-3);
  display: flex;
  justify-content: flex-end;
}

/* ── File Queue ──────────────────────────────────── */

.queue {
  margin-top: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}

.queue-header-left,
.queue-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.queue-title {
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--fg-subtle);
}

.queue-summary {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-2);
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-value {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--fg);
}

.summary-value.summary-savings {
  color: var(--accent-2);
}

.summary-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-subtle);
}

.summary-arrow {
  color: var(--fg-subtle);
  font-size: 14px;
}

.queue-counter {
  font-size: var(--fs-eyebrow);
  color: var(--fg-muted);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
}

/* ── File Card ───────────────────────────────────── */

.file-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  transition: border-color var(--dur-fast) var(--ease-out);
}

.file-card.state-done {
  border-color: rgba(90,234,162,0.30);
}

.file-card.state-error {
  border-color: rgba(255,95,95,0.30);
}

.file-card-top {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.file-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: rgba(0,255,255,0.08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.file-meta { flex: 1; min-width: 0; }

.file-name {
  font-size: var(--fs-body);
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.file-sizes {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-caption);
  color: var(--fg-subtle);
  font-family: var(--font-mono);
}

.file-sizes .arrow {
  color: var(--fg-subtle);
  font-size: 10px;
}

.file-sizes .size-new {
  color: var(--accent-2);
  font-weight: 600;
}

.file-sizes .savings-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: rgba(90,234,162,0.12);
  color: var(--accent-2);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.file-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ── Progress ────────────────────────────────────── */

.progress-wrap {
  margin-top: var(--sp-3);
}

.progress-bar-track {
  height: 4px;
  background: var(--bg-sunken);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--homium-cyan);
  border-radius: var(--radius-pill);
  transition: width 0.3s var(--ease-out);
  box-shadow: var(--glow-cyan);
  width: 0%;
}

.progress-bar-fill.done {
  background: var(--homium-green);
  box-shadow: var(--glow-green);
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-caption);
  color: var(--fg-subtle);
  font-family: var(--font-mono);
}

.progress-label {
  font-size: var(--fs-caption);
  color: var(--fg-subtle);
}

/* ── Status badges ───────────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.status-badge.waiting  { background: rgba(255,255,255,0.06); color: var(--fg-subtle); }
.status-badge.running  { background: rgba(0,255,255,0.10);   color: var(--accent);    }
.status-badge.done     { background: rgba(90,234,162,0.12);  color: var(--accent-2);  }
.status-badge.error    { background: rgba(255,95,95,0.12);   color: #ff7070;          }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.running .status-dot {
  animation: pulse 1.2s ease-in-out infinite;
}

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

/* ── Buttons ─────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 38px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition:
    background    var(--dur-fast) var(--ease-out),
    border-color  var(--dur-fast) var(--ease-out),
    box-shadow    var(--dur-fast) var(--ease-out),
    color         var(--dur-fast) var(--ease-out),
    transform     var(--dur-fast) var(--ease-out);
}

.btn:active  { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }

.btn-primary {
  background: var(--homium-cyan);
  color: var(--homium-purple);
  border-color: var(--homium-cyan);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--cyan-300);
  border-color: var(--cyan-300);
  box-shadow: var(--glow-cyan);
  color: var(--homium-purple);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--surface-overlay);
  border-color: var(--homium-cyan);
  color: var(--homium-cyan);
}

.btn-danger {
  background: transparent;
  color: #ff7070;
  border-color: rgba(255,95,95,0.30);
}
.btn-danger:hover {
  background: rgba(255,95,95,0.10);
  border-color: rgba(255,95,95,0.60);
}

.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ── Empty / error states ────────────────────────── */

.empty-state {
  text-align: center;
  padding: var(--sp-7) 0;
  color: var(--fg-subtle);
}

.alert {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-body-sm);
  margin-top: var(--sp-3);
}

.alert-error   { background: rgba(255,95,95,0.10); border: 1px solid rgba(255,95,95,0.28); color: #ff8080; }
.alert-success { background: rgba(90,234,162,0.10); border: 1px solid rgba(90,234,162,0.28); color: var(--accent-2); }

/* ── Footer ──────────────────────────────────────── */

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: var(--sp-5);
  border-top: 1px solid var(--border);
  font-size: var(--fs-caption);
  color: var(--fg-subtle);
  letter-spacing: 0.04em;
}

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 600px) {
  .header { padding: var(--sp-3) var(--sp-4); }
  .main   { padding: var(--sp-6) var(--sp-4) var(--sp-8); }
  .quality-bar { flex-direction: column; }
  .file-card-top { flex-wrap: wrap; }
}
