/* ─────────────────────────────────────────────
   Video Manipulator — Dark Minimalista (v3)
   ───────────────────────────────────────────── */

:root {
  --bg:          #0e0e0f;
  --card:        #17171a;
  --field:       #1e1e22;
  --rule:        #27272c;
  --rule-strong: #3a3a42;
  --ink:         #ececec;
  --ink-soft:    #8a8a92;
  --ink-mute:    #5a5a62;
  --coral:       #00b3ff;
  --coral-soft:  rgba(0, 179, 255, 0.18);
  --success:     #4ade80;
  --error:       #f87171;

  --serif: 'Fraunces', Georgia, serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 28px 64px;
}

/* ── Header ─────────────────────────────── */
.masthead { margin-bottom: 32px; }

.masthead h1.logo-mark {
  margin: 0 0 12px;
  line-height: 0;
}
.masthead h1.logo-mark svg {
  width: 100%;
  max-width: 360px;
  height: auto;
  display: block;
}

.masthead .subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 20px;
}

.rule {
  border: none;
  border-top: 1px solid var(--rule-strong);
  margin: 0;
}

/* ── Card ───────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 24px 28px;
  margin-bottom: 20px;
  position: relative;
}

.card.hidden { display: none; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}

.eyebrow {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  color: var(--coral);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.card h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

.card h3 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 12px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 10px;
}

/* ── Drop zone ──────────────────────────── */
.drop-zone {
  border: 1px dashed var(--rule-strong);
  background: var(--field);
  border-radius: 4px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.drop-zone:hover,
.drop-zone.dragover {
  background: #232329;
  border-color: var(--coral);
}

.drop-zone-content svg {
  color: var(--coral);
  stroke-width: 1.5;
  margin-bottom: 8px;
}

.drop-zone-content p {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 4px;
  color: var(--ink);
}

.drop-zone-content .hint {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

/* ── File list ──────────────────────────── */
.file-list { margin: 16px 0 0; }

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.file-item:last-child { border-bottom: none; }

.file-item .name {
  flex: 1;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item .size {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.file-item .remove {
  min-width: 28px;
  min-height: 28px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: all 0.15s;
}
.file-item .remove:hover {
  background: var(--coral);
  color: var(--bg);
  border-color: var(--coral);
}

.file-item .upload-status {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  min-width: 100px;
  text-align: right;
}
.file-item[data-status="done"] .upload-status { color: #2a9d3a; }
.file-item[data-status="failed"] .upload-status { color: var(--coral); }
.file-item[data-status="retrying"] .upload-status { color: #d68a00; }

/* ── Buttons ────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 10px 20px;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 16px;
  text-transform: uppercase;
}

.btn-primary {
  background: var(--coral);
  color: var(--bg);
  border-color: var(--coral);
}
.btn-primary:hover:not(:disabled) { background: #38c9ff; border-color: #38c9ff; }
.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-success {
  background: var(--coral);
  color: var(--bg);
  border-color: var(--coral);
}
.btn-success:hover:not(:disabled) { background: #38c9ff; }
.btn-success:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  margin-left: 8px;
}
.btn-secondary:hover { border-color: var(--ink); }

.hint-disabled {
  display: none;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-mute);
  margin: 8px 0 0;
}
.card:has(.btn-primary:disabled) .hint-disabled { display: block; }

/* ── Presets ────────────────────────────── */
.presets { margin-bottom: 18px; }

.preset-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.btn-preset {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 6px 12px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 0;
  transition: all 0.15s;
}
.btn-preset:hover { border-color: var(--ink-soft); color: var(--ink); }
.btn-preset.active {
  background: var(--coral);
  color: var(--bg);
  border-color: var(--coral);
}

.preset-description {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-soft);
  margin: 6px 0 0;
  min-height: 1.2em;
}

/* ── Variation count + params ───────────── */
.variation-count {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  margin: 14px 0 6px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.variation-count label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input[type="number"] {
  font-family: var(--sans);
  font-size: 13px;
  background: var(--field);
  border: 1px solid var(--rule);
  color: var(--ink);
  border-radius: 3px;
  padding: 6px 10px;
  width: 78px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="number"]:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 2px var(--coral-soft);
}

.params-grid { margin-top: 4px; }

.param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.param-row:last-child { border-bottom: none; }

.param-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

input[type="checkbox"] {
  accent-color: var(--coral);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s;
}
.range-inputs span {
  color: var(--ink-mute);
  font-size: 12px;
  font-family: var(--sans);
}
.range-inputs input { width: 70px; }
.range-inputs.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ── Progress ───────────────────────────── */
.overall-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.progress-bar {
  flex: 1;
  height: 2px;
  background: var(--rule);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--coral);
  transition: width 0.3s ease;
}

.progress-bar.indeterminate .progress-fill {
  width: 35% !important;
  animation: shimmer 1.4s infinite ease-in-out;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(340%); }
}

#overall-text {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}

.conn-state {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--error);
  white-space: nowrap;
}

.job-id {
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.job-id code {
  font-family: var(--mono);
  user-select: all;
}

/* ── Log ────────────────────────────────── */
.progress-log {
  font-family: var(--mono);
  font-size: 11px;
  background: #0a0a0b;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 12px 14px;
  max-height: 220px;
  overflow-y: auto;
  color: var(--ink-soft);
}

.log-entry {
  padding: 2px 0 2px 16px;
  position: relative;
  line-height: 1.5;
}
.log-entry::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--ink-mute);
}
.log-entry.processing { color: var(--ink); }
.log-entry.processing::before {
  content: '●';
  color: var(--coral);
  animation: pulse 1.2s infinite ease-in-out;
}
@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}
.log-entry.complete {
  color: var(--success);
  font-weight: 500;
}
.log-entry.complete::before { content: '✓'; color: var(--success); }
.log-entry.error {
  color: var(--error);
  font-weight: 500;
}
.log-entry.error::before { content: '✗'; color: var(--error); }

/* ── Download ───────────────────────────── */
#download-info {
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  color: var(--ink-soft);
  margin: 0;
}

/* ── Focus visible ──────────────────────── */
*:focus-visible {
  outline: 1.5px solid var(--coral);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Scrollbar ──────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--rule-strong); }

/* ── Mobile ─────────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 32px 18px 56px; }
  .masthead h1.logo-mark svg { max-width: 280px; }
  .card { padding: 20px 20px; }
  .card h2 { font-size: 18px; }
}

@media (max-width: 520px) {
  .param-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .range-inputs {
    width: 100%;
    justify-content: flex-start;
  }
  .range-inputs input { flex: 1; min-width: 0; }
  .btn-secondary { margin-left: 0; margin-top: 10px; }
}
