/* Job Queue Dashboard — no framework, plain CSS. */

:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1e2230;
  --border: #2a2f3f;
  --text: #e6e9f0;
  --text-dim: #8b93a7;
  --accent: #5b8cff;
  --accent-hover: #729aff;

  --c-pending: #d9a441;
  --c-processing: #5b8cff;
  --c-done: #3fb96b;
  --c-failed: #e05b5b;

  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

/* ===== Top bar ===== */
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand h1 { font-size: 1.15rem; margin: 0; font-weight: 650; }
.brand-sub { color: var(--text-dim); font-size: 0.85rem; }

/* health indicator dot */
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.3s;
}
.brand-dot.ok { background: var(--c-done); box-shadow: 0 0 6px var(--c-done); }
.brand-dot.down { background: var(--c-failed); box-shadow: 0 0 6px var(--c-failed); }

/* ===== Layout ===== */
.layout {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
}
.panel h2 { margin: 0 0 0.35rem; font-size: 1rem; font-weight: 650; }
.hint { color: var(--text-dim); font-size: 0.82rem; margin: 0 0 0.75rem; }

/* ===== Submit form ===== */
#payload {
  width: 100%;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem;
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}
#payload:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

.form-row {
  margin-top: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
button[type="submit"]:hover { background: var(--accent-hover); }
button[type="submit"]:disabled { opacity: 0.6; cursor: default; }

.msg { font-size: 0.82rem; }
.msg.ok { color: var(--c-done); }
.msg.err { color: var(--c-failed); }

/* ===== Stats ===== */
.stats {
  margin-top: 1.1rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.stat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.stat-num { font-size: 1.1rem; font-weight: 700; }
.stat-label { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }

/* ===== Jobs panel ===== */
.jobs-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.jobs-controls { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }

.filters { display: flex; gap: 0.3rem; }
.filter {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}
.filter:hover { color: var(--text); border-color: var(--text-dim); }
.filter.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.auto-refresh {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; color: var(--text-dim); cursor: pointer;
  user-select: none;
}

/* ===== Job list ===== */
.job-list { display: flex; flex-direction: column; gap: 0.5rem; }
.empty { color: var(--text-dim); font-size: 0.85rem; text-align: center; padding: 2rem 0; }

.job-card {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.9rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.job-card:hover { border-color: var(--accent); }

.job-id {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--text);
}
.job-payload {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-time { font-size: 0.72rem; color: var(--text-dim); white-space: nowrap; }

/* status badge */
.badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
}
.badge.pending    { color: var(--c-pending);    background: color-mix(in srgb, var(--c-pending) 15%, transparent); }
.badge.processing { color: var(--c-processing); background: color-mix(in srgb, var(--c-processing) 15%, transparent); }
.badge.done       { color: var(--c-done);       background: color-mix(in srgb, var(--c-done) 15%, transparent); }
.badge.failed     { color: var(--c-failed);     background: color-mix(in srgb, var(--c-failed) 15%, transparent); }

/* pulse animation while processing */
.badge.processing { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  z-index: 50;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(640px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  margin: 0; font-size: 0.9rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.modal-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.modal-close:hover { color: var(--text); }

#modal-body {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow: auto;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text);
}
