/* Rookery — themed to match wren.digital tool pages (video-trimmer / audio-joiner).
   Pull DM Mono + DM Sans from Google Fonts in base.html. */

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

:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --border: #d8d4cb;
  --text: #1a1916;
  --muted: #8a8680;
  --accent: #2d6a4f;
  --accent-light: #e8f4ef;
  --mono: 'DM Mono', monospace;
  --sans: 'DM Sans', sans-serif;

  /* Status colours */
  --ok: #2d6a4f;
  --ok-light: #e8f4ef;
  --warn: #b45309;
  --warn-light: #fef3c7;
  --err: #c0392b;
  --err-light: #fdf0ee;
  --err-border: #f0c8c0;

  /* Node states */
  --state-capturing: #2d6a4f;
  --state-syncing: #1d4ed8;
  --state-done: #6b7280;
  --state-failed: #c0392b;
  --state-pending: #b45309;
  --state-offline: #d8d4cb;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.25rem 4rem;
}

/* ── Header ───────────────────────────────────────────────────────────────── */

header {
  text-align: center;
  margin-bottom: 2.5rem;
  width: 100%;
  max-width: 780px;
}

header h1 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

header h1 span { color: var(--accent); font-weight: 900; }

header p {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 300;
  letter-spacing: 0.02em;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 780px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card + .card { margin-top: 1.25rem; }

.card-narrow { max-width: 580px; }

/* ── Section labels ───────────────────────────────────────────────────────── */

.section-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
  display: inline-block;
}

.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.99); }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn-sm {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  text-decoration: none;
}

.btn-sm:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.btn-sm:disabled { opacity: 0.4; cursor: default; pointer-events: none; }

.btn-danger {
  background: none;
  border: 1px solid var(--err-border);
  color: var(--err);
}
.btn-danger:hover { background: var(--err-light); border-color: var(--err); color: var(--err); opacity: 1; }

.btn-full { width: 100%; text-align: center; }

/* ── Inputs ───────────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 0.35rem; }

.field label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  transition: border-color 0.15s;
}

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

.input-wrap input,
.input-wrap select {
  font-family: var(--mono);
  font-size: 0.82rem;
  flex: 1;
  padding: 0.65rem 0.9rem;
  border: none;
  background: transparent;
  color: var(--text);
  outline: none;
  width: 100%;
}

input, select, textarea {
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

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

select { cursor: pointer; }

.input-hint {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  opacity: 0.8;
}

/* ── Checkboxes ───────────────────────────────────────────────────────────── */

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.checkbox-row input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

/* ── Node picker ──────────────────────────────────────────────────────────── */

.node-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.node-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  transition: border-color 0.12s, background 0.12s;
  cursor: pointer;
}

.node-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
}

.node-item input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}


/* ── Node status card (dashboard) ─────────────────────────────────────────── */

.node-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.node-row-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.node-row-top .node-name { flex: 1; }

.node-badges {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
}

.badge-method {
  background: #f1f0ed;
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.04em;
}

.node-row-disk {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 1.1rem; /* indent under dot */
}

.node-row-disk .disk-bar-wrap { flex: 1; }

.spool-badge {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--warn);
  background: var(--warn-light);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.node-name {
  font-family: var(--mono);
  font-size: 0.82rem;
  flex: 1;
}

.node-meta {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.node-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-ready    { background: var(--ok); }
.dot-online   { background: var(--warn); }
.dot-offline  { background: var(--state-offline); }

/* ── Status badges ────────────────────────────────────────────────────────── */

.badge {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}

.badge-capturing { background: var(--ok-light);   color: var(--ok);   }
.badge-syncing   { background: #eff6ff;            color: #1d4ed8;     }
.badge-done      { background: #f3f4f6;            color: #6b7280;     }
.badge-failed    { background: var(--err-light);   color: var(--err);  }
.badge-pending   { background: var(--warn-light);  color: var(--warn); }
.badge-finalizing{ background: #f0fdf4;            color: #166534;     }
.badge-stopped   { background: #f3f4f6;            color: #6b7280;     }
.badge-offline   { background: #f3f4f6;            color: #9ca3af;     }
.badge-reencoded { background: var(--warn-light);  color: var(--warn); font-size: 0.58rem; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */

.progress-wrap { display: flex; flex-direction: column; gap: 0.45rem; }
.progress-label { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.progress-detail { font-family: var(--mono); font-size: 0.72rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 0.9rem; }
.progress-track { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: 2px; width: 0%; transition: width 0.4s ease; }
.progress-bar.pulse { animation: pulse-bar 1.5s ease-in-out infinite; width: 35%; }

@keyframes pulse-bar {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(400%); }
}

/* ── Tables ───────────────────────────────────────────────────────────────── */

.tbl { width: 100%; border-collapse: collapse; }

.tbl th {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 0 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-weight: 400;
}

.tbl td {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--bg); }

.tbl-url {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

/* ── Alert / error / success banners ─────────────────────────────────────── */

.alert {
  font-family: var(--mono);
  font-size: 0.75rem;
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  position: relative;
}

.alert-err {
  color: var(--err);
  background: var(--err-light);
  border: 1px solid var(--err-border);
}

.alert-warn {
  color: var(--warn);
  background: var(--warn-light);
  border: 1px solid #fde68a;
}

.alert-ok {
  color: var(--ok);
  background: var(--ok-light);
  border: 1px solid var(--accent);
}

.alert-badge {
  position: absolute;
  top: -0.7rem;
  left: 0.75rem;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}

.alert-ok   .alert-badge { background: var(--accent); color: #fff; }
.alert-err  .alert-badge { background: var(--err);    color: #fff; }
.alert-warn .alert-badge { background: var(--warn);   color: #fff; }

/* ── Disk usage bar ───────────────────────────────────────────────────────── */

.disk-bar-wrap { display: flex; align-items: center; gap: 0.5rem; }
.disk-bar-track { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.disk-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s; }
.disk-bar-fill.warn { background: var(--warn); }
.disk-bar-fill.floor { background: var(--err); }
.disk-bar-label { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); white-space: nowrap; }

/* ── Stale indicator ──────────────────────────────────────────────────────── */

.stale { opacity: 0.45; font-style: italic; }
.stale-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Animations ───────────────────────────────────────────────────────────── */

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

.fade-up { animation: fadeUp 0.2s ease; }

/* ── Footer ───────────────────────────────────────────────────────────────── */

footer {
  margin-top: 2rem;
  font-size: 0.7rem;
  color: var(--muted);
  font-family: var(--mono);
  text-align: center;
}

footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); }
.footer-sep { margin: 0 0.4rem; }
.footer-colon { margin-right: 0.4rem; }

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  body { padding: 1.5rem 0.75rem 3rem; }
  .card { padding: 1.25rem; }
}
