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

:root {
  --bg:            #0f172a;
  --sidebar-bg:    #1e293b;
  --card-bg:       #1e293b;
  --border:        #334155;
  --input-bg:      #0f172a;

  --primary:       #3b82f6;
  --primary-hover: #2563eb;
  --success:       #22c55e;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --processing:    #a78bfa;

  --text:          #f1f5f9;
  --text-muted:    #94a3b8;

  --radius:        8px;
  --sidebar-w:     220px;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
  flex-shrink: 0;
}

.btn-logout:hover {
  color: var(--danger);
}

/* ── Hoofdinhoud ─────────────────────────────────────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 28px 32px;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* ── Live badge ─────────────────────────────────────────────────────────── */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

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

/* ── Statistieken ───────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  border-left: 3px solid var(--border);
}

.stat-card--uploading  { border-left-color: var(--warning); }
.stat-card--processing { border-left-color: var(--processing); }
.stat-card--success    { border-left-color: var(--success); }
.stat-card--error      { border-left-color: var(--danger); }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Kaarten ────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

/* ── Tabel ──────────────────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  vertical-align: middle;
}

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

.table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.job-filename {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

/* ── Voortgangsbalk ─────────────────────────────────────────────────────── */
.progress-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  background: var(--primary);
}

.progress-fill--uploading  { background: var(--warning); }
.progress-fill--completed { background: var(--success); }
.progress-fill--failed    { background: var(--danger); }
.progress-fill--pending   { background: var(--text-muted); }
.progress-fill--processing { background: var(--primary); }

.progress-pct {
  color: var(--text-muted);
  font-size: 12px;
  min-width: 34px;
  text-align: right;
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge--uploading  { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge--pending    { background: rgba(148,163,184,0.15); color: var(--text-muted); }
.badge--processing { background: rgba(167,139,250,0.15); color: var(--processing); }
.badge--completed  { background: rgba(34,197,94,0.15);  color: var(--success); }
.badge--failed     { background: rgba(239,68,68,0.15);  color: var(--danger); }

/* ── Methode badges ────────────────────────────────────────────────────── */
.method-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.method--hw {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.method--sw {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.speed-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 13px;
}

/* ── Lege staat ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p {
  margin-bottom: 4px;
}

/* ── Formulieren ────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 13px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-range {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

.form-hint {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ── Formulier rij (twee kolommen) ──────────────────────────────────────── */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.form-group--half {
  flex: 1;
  margin-bottom: 0;
}

/* ── Checkbox label ────────────────────────────────────────────────────── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

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

/* ── Instellingen grid ──────────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ── Knoppen ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.12);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ── Meldingen ──────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 14px;
}

.alert-error   { background: rgba(239,68,68,0.12);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
.alert-success { background: rgba(34,197,94,0.12);  color: #86efac; border: 1px solid rgba(34,197,94,0.25); }

/* ── Hulpklassen ────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }

/* ── Loginpagina ────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-wrapper {
  width: 100%;
  max-width: 380px;
  padding: 24px;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 28px;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
}

.login-form .form-group {
  margin-bottom: 16px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .sidebar {
    width: 60px;
  }

  .sidebar-logo span,
  .nav-item span,
  .sidebar-user span,
  .sidebar-footer .sidebar-user {
    display: none;
  }

  .main {
    margin-left: 60px;
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
