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

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #222637;
  --border:    #2d3148;
  --text:      #e2e8f0;
  --muted:     #7c859e;
  --accent:    #6366f1;
  --accent-h:  #818cf8;
  --green:     #22c55e;
  --yellow:    #eab308;
  --red:       #ef4444;
  --blue:      #3b82f6;
  --radius:    10px;
  --font:      'Inter', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

/* ── Login overlay ──────────────────────────────────────────────────────────── */
#login-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-card .logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}

.login-card .subtitle {
  color: var(--muted);
  margin-bottom: 1.75rem;
  font-size: 0.875rem;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.25rem;
  display: block;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.15s;
}

input:focus { border-color: var(--accent); }

/* ── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:not(:disabled):hover { background: var(--accent-h); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); background: var(--surface2); }

.btn-sm { font-size: 0.8rem; padding: 0.4rem 0.85rem; }

.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}
.btn-icon:hover { color: var(--text); background: var(--border); }

/* ── Dashboard layout ───────────────────────────────────────────────────────── */
#dashboard { min-height: 100vh; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

header .logo { font-weight: 700; font-size: 1.1rem; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

/* ── Drop zone ──────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 1rem;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
}

.drop-zone-inner svg { color: var(--muted); opacity: 0.7; }

.drop-zone-inner p { font-size: 0.9375rem; }

.drop-zone-inner .hint { font-size: 0.8rem; }

/* ── File selected row ──────────────────────────────────────────────────────── */
.file-selected {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.875rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.file-selected svg { flex-shrink: 0; color: var(--accent); }

.file-selected span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Quality toggle ─────────────────────────────────────────────────────────── */
.quality-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.quality-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.pill-group {
  display: flex;
  gap: 0.5rem;
}

.pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8125rem;
  padding: 0.35rem 0.9rem;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pill small { font-size: 0.7rem; opacity: 0.75; }

.pill:hover { border-color: var(--accent); color: var(--text); }

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Timelapse toggle ───────────────────────────────────────────────────────── */
.timelapse-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

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

.timelapse-hint {
  font-size: 0.775rem;
  color: var(--muted);
}

/* ── Upload progress ────────────────────────────────────────────────────────── */
.upload-progress {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.progress-bar {
  height: 4px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  width: 0%;
  transition: width 0.3s ease;
}

#upload-status-text {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Jobs table ─────────────────────────────────────────────────────────────── */
.jobs-card { overflow: hidden; }

.jobs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.jobs-header h2 { margin-bottom: 0; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--surface2); }

.td-date  { color: var(--muted); white-space: nowrap; font-size: 0.8rem; }
.td-file  { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Status badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
}

.badge-queued   { background: rgba(124,133,158,0.15); color: var(--muted); }
.badge-processing { background: rgba(59,130,246,0.15); color: var(--blue); }
.badge-complete { background: rgba(34,197,94,0.15);   color: var(--green); }
.badge-error    { background: rgba(239,68,68,0.15);   color: var(--red); }
.badge-preview  { background: rgba(234,179,8,0.12);   color: var(--yellow); }
.badge-final    { background: rgba(99,102,241,0.15);  color: var(--accent-h); }

/* spinner inside badge */
.spinner {
  width: 8px; height: 8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc ───────────────────────────────────────────────────────────────────── */
.error-msg {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.empty-state {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 2rem 0;
  text-align: center;
}

.hidden { display: none !important; }

#submit-btn { width: 100%; margin-top: 0.25rem; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  main { padding: 1rem; }
  .card { padding: 1.25rem; }
  .quality-row { flex-direction: column; align-items: flex-start; }
}
