/* ============================================
   Music Separator – Global Styles
   ============================================ */

:root {
  --bg: #0f0f13;
  --bg2: #17171f;
  --bg3: #1e1e28;
  --border: #2a2a3a;
  --accent: #6c63ff;
  --accent-hover: #7c74ff;
  --accent-dim: rgba(108, 99, 255, 0.15);
  --text: #e8e8f0;
  --text-muted: #888899;
  --text-dim: #555566;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ---- Header ---- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 19, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
}
.settings-btn:hover { color: var(--text); background: var(--bg3); }

/* ---- Main layout ---- */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ---- Submit section ---- */
.submit-section { margin-bottom: 32px; }

.submit-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.submit-card h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 13px;
}

.submit-form .input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.submit-form input[type="url"] {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}
.submit-form input[type="url"]:focus { border-color: var(--accent); }
.submit-form input[type="url"]::placeholder { color: var(--text-dim); }

.model-select-wrap select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.submit-form button[type="submit"] {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}
.submit-form button[type="submit"]:hover { background: var(--accent-hover); }
.submit-form button[type="submit"]:active { transform: scale(0.97); }
.submit-form button[type="submit"]:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Error / Success messages ---- */
.error-msg {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 13px;
}
.success-msg {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 13px;
}

/* ---- Jobs list ---- */
.jobs-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.jobs-header h3 { font-size: 16px; font-weight: 600; }

.badge {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 20px;
}

.jobs-list { display: flex; flex-direction: column; gap: 12px; }

/* ---- Job card ---- */
.job-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 0.2s;
  animation: fadeSlideIn 0.3s ease;
}
.job-card:hover { border-color: #3a3a4a; }

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

.job-card.status-processing { border-color: rgba(108, 99, 255, 0.4); }
.job-card.status-done { border-color: rgba(34, 197, 94, 0.3); }
.job-card.status-error { border-color: rgba(239, 68, 68, 0.3); }

.job-top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.job-thumb-wrap { flex-shrink: 0; }

.job-thumb {
  width: 120px;
  height: 68px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg3);
  display: block;
}
.job-thumb-placeholder {
  width: 120px;
  height: 68px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

.job-info { flex: 1; min-width: 0; }

.job-title {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
  line-height: 1.3;
}

.job-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.meta-icon { font-size: 11px; }

.job-url {
  margin: 8px 0 0;
  font-size: 11px;
}
.url-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s;
}
.url-link:hover { color: var(--accent); }

.job-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-pct {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.done-check {
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
}

/* Stems section */
.stems-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.stems-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  margin-bottom: 7px;
}
.stems-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.stem-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ALS version downloads */
.als-downloads {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.als-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.btn-als-10 { background: rgba(99,102,241,0.12); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.25); }
.btn-als-10:hover { background: rgba(99,102,241,0.22); }
.btn-als-11 { background: rgba(139,92,246,0.12); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.25); }
.btn-als-11:hover { background: rgba(139,92,246,0.22); }
.btn-als-12 { background: rgba(168,85,247,0.15); color: #e879f9; border: 1px solid rgba(168,85,247,0.3); }
.btn-als-12:hover { background: rgba(168,85,247,0.25); }

.status-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-queued { background: rgba(100,100,120,0.2); color: #aaa; }
.status-downloading { background: rgba(245,158,11,0.15); color: #fbbf24; }
.status-separating { background: rgba(108,99,255,0.2); color: #a5b4fc; }
.status-generating { background: rgba(108,99,255,0.15); color: #c4b5fd; }
.status-done { background: rgba(34,197,94,0.15); color: #86efac; }
.status-error { background: rgba(239,68,68,0.15); color: #fca5a5; }

.progress-bar-wrap {
  margin-top: 12px;
  background: var(--bg3);
  border-radius: 4px;
  height: 4px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.progress-msg {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.job-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.btn-sm {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s;
  text-decoration: none;
}
.btn-sm:active { transform: scale(0.96); }

.btn-als {
  background: var(--accent-dim);
  color: #a5b4fc;
  border: 1px solid rgba(108,99,255,0.3);
}
.btn-als:hover { background: rgba(108,99,255,0.25); }

.btn-stems {
  background: rgba(34,197,94,0.1);
  color: #86efac;
  border: 1px solid rgba(34,197,94,0.2);
}
.btn-stems:hover { background: rgba(34,197,94,0.18); }

.btn-delete {
  background: rgba(239,68,68,0.08);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.15);
}
.btn-delete:hover { background: rgba(239,68,68,0.15); }

.stems-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.stem-tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.error-detail {
  font-size: 12px;
  color: #fca5a5;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(239,68,68,0.07);
  border-radius: var(--radius-sm);
  word-break: break-all;
}

/* ---- Loading / empty ---- */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

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

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 9999;
  max-width: 400px;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Settings page ---- */
.settings-page { max-width: 700px; }
.settings-page h2 { font-size: 22px; font-weight: 700; margin-bottom: 24px; }

.settings-group {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}

.settings-group h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--text);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .settings-grid { grid-template-columns: 1fr; }
  .submit-form .input-row { flex-direction: column; }
}

.setting-item label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.setting-item input,
.setting-item select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.setting-item input:focus,
.setting-item select:focus { border-color: var(--accent); }

.setting-item small {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--text-dim);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-secondary:hover { background: #252530; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(239,68,68,0.1);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-danger:hover { background: rgba(239,68,68,0.18); }

.save-btn { margin-bottom: 24px; }

.docker-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.docker-container-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}
.docker-container-name { font-weight: 500; font-size: 13px; }
.docker-container-status { font-size: 12px; color: var(--success); }
.docker-container-status.stopped { color: var(--error); }

.docker-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

.docker-output {
  background: #0a0a0e;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #9ca3af;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 10px;
}

/* ============================================
   Tab Navigation
   ============================================ */

/* Tab content: hidden by default, shown when .active */
.tab-content          { display: none; }
.tab-content.active   { display: block; }

.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--border);
  position: relative;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -2px;
  white-space: nowrap;
}
.tab-btn svg { opacity: 0.6; transition: opacity 0.2s; }
.tab-btn:hover { color: var(--text); }
.tab-btn:hover svg { opacity: 1; }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab-btn.active svg { opacity: 1; }

/* ============================================
   Hardware – System Metrics
   ============================================ */
.hw-system-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .hw-system-grid { grid-template-columns: 1fr; } }

.hw-metric { display: flex; flex-direction: column; gap: 5px; }
.hw-metric-uptime { grid-column: span 2; }
@media (max-width: 600px) { .hw-metric-uptime { grid-column: span 1; } }

.hw-metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.hw-bar-wrap {
  background: var(--bg3);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}
.hw-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.hw-bar-cpu  { background: linear-gradient(90deg, #6c63ff, #a78bfa); }
.hw-bar-mem  { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.hw-bar-disk { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.hw-metric-val {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.hw-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; }

/* ============================================
   Hardware – Service Cards
   ============================================ */
.svc-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.svc-card:last-child { margin-bottom: 0; }
.svc-running { border-color: rgba(34,197,94,0.25); }
.svc-stopped { border-color: rgba(239,68,68,0.2); }

.svc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.svc-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.svc-icon { font-size: 22px; line-height: 1; }
.svc-name { font-weight: 600; font-size: 14px; }
.svc-id   { font-size: 11px; color: var(--text-dim); font-family: monospace; margin-top: 2px; }

.svc-status-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}
.svc-active   { background: rgba(34,197,94,0.15);  color: #86efac; }
.svc-inactive { background: rgba(239,68,68,0.12);  color: #fca5a5; }

.svc-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.svc-stat { flex: 1; min-width: 80px; display: flex; flex-direction: column; gap: 4px; }
.svc-stat-pids { flex: 0 0 60px; }
.svc-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}
.svc-stat-bar-wrap {
  background: var(--bg3);
  border-radius: 3px;
  height: 4px;
  overflow: hidden;
}
.svc-stat-bar       { height: 100%; border-radius: 3px; background: linear-gradient(90deg,#6c63ff,#a78bfa); transition: width 0.5s; }
.svc-stat-bar-mem   { background: linear-gradient(90deg,#3b82f6,#60a5fa); }
.svc-stat-val       { font-size: 12px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }

.svc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.svc-btn { padding: 7px 14px; font-size: 12px; }

.svc-output {
  margin-top: 10px;
  background: #0a0a0e;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #9ca3af;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================
   Resource Limits Editor
   ============================================ */
.limits-editor {
  margin: 12px 0;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.limits-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.limits-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}
@media (max-width: 640px) { .limits-row { grid-template-columns: 1fr; } }

.limit-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.limit-field small {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}
.limit-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.limit-input-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  height: 4px;
}
.limit-input-wrap input[type="number"] {
  width: 72px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  text-align: right;
  outline: none;
}
.limit-input-wrap input[type="number"]:focus { border-color: var(--accent); }
.limit-unit {
  font-size: 12px;
  color: var(--text-dim);
  width: 24px;
}
.limit-badge {
  display: inline-block;
  background: rgba(108,99,255,0.15);
  color: #a5b4fc;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 500;
  margin-left: 4px;
  text-transform: none;
  letter-spacing: 0;
  vertical-align: middle;
}
.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary-sm:hover { background: var(--accent-hover); }
