/* IdleCompute Dashboard — Dark theme matching demo page */

:root {
  --bg: #0a0a0f;
  --card-bg: #13131a;
  --border: #1e1e2e;
  --accent: #6366f1;
  --accent-dim: #4f46e5;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --text: #e0e0e0;
  --text-dim: #888;
  --text-dimmer: #666;
  --text-dimmest: #444;
  --code-bg: #0d0d14;
  --code-text: #a5b4fc;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- Navigation ---- */

nav {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  margin-right: 32px;
}

.nav-brand span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover { background: rgba(99, 102, 241, 0.1); color: var(--text); }
.nav-links a.active { background: rgba(99, 102, 241, 0.15); color: var(--accent); }

.nav-stats {
  margin-left: auto;
  display: flex;
  gap: 20px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.nav-stats .val { color: #fff; font-weight: 600; }

/* ---- Main Content ---- */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

h2 {
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 20px;
}

/* ---- Metric Cards ---- */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

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

.metric-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
}

/* ---- Cards / Panels ---- */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.card h3 {
  font-size: 1rem;
  color: #fff;
  margin-bottom: 16px;
}

/* ---- Tables ---- */

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

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

td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(30, 30, 46, 0.5);
  color: var(--text);
}

tr:hover td { background: rgba(99, 102, 241, 0.04); }

.clickable-row { cursor: pointer; }

/* ---- Status Badges ---- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-queued { background: rgba(234, 179, 8, 0.15); color: var(--yellow); }
.badge-running { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
.badge-completed { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.badge-failed { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.badge-cancelled { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.badge-pending { background: rgba(136, 136, 136, 0.15); color: var(--text-dim); }
.badge-assigned { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
.badge-verifying { background: rgba(234, 179, 8, 0.15); color: var(--yellow); }
.badge-expired { background: rgba(239, 68, 68, 0.15); color: var(--red); }

/* ---- Filter Tabs ---- */

.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.filter-tabs button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}

.filter-tabs button:hover { border-color: var(--accent); color: var(--text); }
.filter-tabs button.active { background: rgba(99, 102, 241, 0.15); border-color: var(--accent); color: var(--accent); }

/* ---- Forms ---- */

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width { grid-column: 1 / -1; }

label {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
}

input, select {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s;
}

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

select option { background: var(--card-bg); color: var(--text); }

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.15s;
}

.btn:hover { background: var(--accent-dim); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { opacity: 0.85; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover { background: rgba(99, 102, 241, 0.1); }

/* ---- Progress Bar ---- */

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}

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

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

/* ---- Stats Grid (job detail) ---- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-item {
  text-align: center;
}

.stat-item .value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

.stat-item .label {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ---- Misc ---- */

.mono { font-family: var(--mono); font-size: 0.8rem; }
.truncate { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-dim { color: var(--text-dim); }
.text-right { text-align: right; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-dim); }

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.alert-success { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); color: var(--green); }
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--red); }

/* ---- Login ---- */

.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 80px);
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.login-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin-bottom: 8px;
}

.login-brand span { color: var(--accent); }

.login-subtitle {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 28px;
}

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

.login-card .alert {
  margin-top: 12px;
  margin-bottom: 0;
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .nav-stats { display: none; }
}

@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
}
