/* style.css — the operator's page.
   Dark, because it is often read in a darkened production room, and sized for
   a phone first: the person who needs it is usually standing up. */

:root {
  --bg: #12151a;
  --card: #1a1f27;
  --line: #2a323e;
  --text: #e6eaf0;
  --dim: #97a3b4;
  --accent: #4a9eff;
  --good: #35c46b;
  --warn: #e8a33d;
  --bad: #e5484d;
}

* { box-sizing: border-box; }

/* Any author `display` rule beats the browser's own [hidden] styling, however
   specific each one is. So `#gate { display: flex }` silently defeated
   `gate.hidden = true`, and the sign-in form stayed on screen above a signed-in
   page. Anything given a display rule below needs this, so it is stated once
   here rather than remembered at each one. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 3rem;
}

#banner {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
}
#banner .state { font-size: 1.25rem; font-weight: 600; }
#banner .room { color: var(--dim); font-size: 0.9rem; }

.warning {
  margin: 0.75rem 1rem 0;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  background: rgba(232, 163, 61, 0.12);
  border: 1px solid rgba(232, 163, 61, 0.4);
  color: #f0c47a;
  font-size: 0.9rem;
}

#tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem 1rem 0;
}
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--dim);
  font: inherit;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}
.tab.is-on { color: var(--text); border-bottom-color: var(--accent); }

main { padding: 1rem; max-width: 720px; }
.panel { display: none; }
.panel.is-on { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.85rem;
}

/* ── a destination ─────────────────────────────────────────────────────── */
.dest-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.dest-name { font-weight: 600; font-size: 1.05rem; }
.pill {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--dim);
}
.pill.streaming { color: var(--good); border-color: var(--good); }
.pill.stalled, .pill.reconnecting { color: var(--warn); border-color: var(--warn); }
.pill.blocked  { color: var(--bad);  border-color: var(--bad); }
.pill.ending   { color: var(--accent); border-color: var(--accent); }
/* Connected up and healthy, with nobody attached to it yet. Deliberately not
   the warning colour: an SRT listener sits here as its resting state, and
   colouring a normal condition as a problem teaches an operator to ignore
   the colour that means one. */
.pill.awaiting { color: var(--accent); border-color: var(--accent); }

.dest-detail { color: var(--dim); font-size: 0.88rem; margin-top: 0.35rem; }
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  margin-top: 0.7rem;
  font-size: 0.85rem;
}
.stats div span { display: block; color: var(--dim); font-size: 0.75rem; }

.row { display: flex; gap: 0.5rem; margin-top: 0.85rem; flex-wrap: wrap; }

button {
  font: inherit;
  border-radius: 7px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #232a34;
  color: var(--text);
}
button.primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }
button.stop    { background: none; border-color: var(--bad); color: var(--bad); }
button.ghost   { background: none; color: var(--dim); }
button.danger  { background: none; border-color: var(--line); color: var(--bad); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.add {
  width: 100%;
  padding: 0.7rem;
  border-style: dashed;
  color: var(--dim);
}

/* ── forms ─────────────────────────────────────────────────────────────── */
.form h2 { font-size: 0.95rem; margin: 1.1rem 0 0.6rem; color: var(--dim);
           text-transform: uppercase; letter-spacing: 0.05em; }
.form h2:first-child { margin-top: 0; }
label { display: block; margin-bottom: 0.85rem; font-size: 0.9rem; }
input, select {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.5rem 0.6rem;
  background: #10141a;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  font: inherit;
}
.hint { display: block; color: var(--dim); font-size: 0.8rem; margin-top: 0.25rem; }

.error, .good {
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 7px;
  font-size: 0.88rem;
}
.error { background: rgba(229, 72, 77, 0.12); border: 1px solid rgba(229,72,77,0.4); color: #ff9a9d; }
.good  { background: rgba(53, 196, 107, 0.12); border: 1px solid rgba(53,196,107,0.4); color: #7ee2a4; }

.dest-error {
  margin-top: 0.7rem;
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  background: rgba(229, 72, 77, 0.1);
  border: 1px solid rgba(229, 72, 77, 0.3);
  color: #ff9a9d;
  font-size: 0.85rem;
}

.totals { color: var(--dim); font-size: 0.88rem; margin: 0.5rem 0 1rem; }
.totals b { color: var(--text); }

.empty { color: var(--dim); text-align: center; padding: 1.5rem 0; }

#log {
  background: #0d1015;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 65vh;
  overflow-y: auto;
  color: var(--dim);
}

label.check { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
label.check input { width: auto; margin: 0; }
label.check .hint { flex-basis: 100%; margin-top: 0.15rem; }

/* ── title bar ─────────────────────────────────────────────────────────── */
#titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: #0e1116;
  border-bottom: 1px solid var(--line);
}
#titlebar .brand { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
#titlebar .mark {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.18);
  flex: none;
}
#titlebar .name {
  color: var(--dim);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#titlebar .name b { color: var(--text); font-weight: 600; }
.bar-right { display: flex; align-items: center; gap: 0.75rem; flex: none; }
.who { color: var(--dim); font-size: 0.85rem; }

button.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
button.link:hover { text-decoration: underline; }

/* ── sign in ───────────────────────────────────────────────────────────── */
#gate { padding: 2rem 1rem; display: flex; justify-content: center; }
.gate-card { max-width: 380px; width: 100%; margin: 0; }
.gate-intro { color: var(--dim); font-size: 0.9rem; margin: 0 0 1rem; }
button.wide { width: 100%; }

/* ── past events ─────────────────────────────────────────────────────── */
.lead {
  color: var(--dim);
  font-size: 0.9rem;
  margin: 0 0 0.9rem;
}
.card.event .row { margin-top: 0.75rem; align-items: center; }
select.inline { width: auto; margin: 0; min-width: 9rem; }

/* A download is a link, not a button, so the browser handles it — but it
   should not look like a different kind of control because of that. */
a.button {
  display: inline-block;
  font: inherit;
  text-decoration: none;
  border-radius: 7px;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  background: #232a34;
  color: var(--text);
}
a.button:hover { border-color: var(--accent); }

/* ── the advanced corner of a form ──────────────────────────────────────── */
/* Somewhere to put a setting that has a sensible default and a real reason to
   be changed, without it being the fourth thing a volunteer reads. Closed by
   default, and it stays closed across a form being reopened, because anyone
   who needs it will open it again in less time than it costs everyone else to
   scroll past it. */
details.advanced { margin: 0 0 0.85rem; }
details.advanced > summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--dim);
  padding: 0.25rem 0;
  user-select: none;
}
details.advanced > summary:hover { color: var(--text); }
details.advanced[open] > summary { margin-bottom: 0.5rem; }

/* Footer: the version and where this came from. Quiet — it is reference
   material for a bug report, not something to compete with the controls. */
.foot {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--dim);
}
.foot a { color: inherit; }

/* Where this came from, and who made it. The mark is the same one the project
   website uses in its own footer, copied into this page's root rather than
   linked: a relay on a church's own network is often the only thing on it that
   can reach the internet, and a broken image is worse branding than none. */
.foot .brandline { display: flex; align-items: center; gap: 10px; min-width: 0;
  flex-wrap: wrap; }
.foot .brandline .quiet { opacity: 0.72; }
.foot .brandline .quiet:hover { opacity: 1; }
.foot .saw { display: flex; align-items: center; opacity: 0.75; }
.foot .saw:hover { opacity: 1; }
.foot .saw img { display: block; width: auto; }

/* A pairing code is read aloud across a room, or typed on a phone held in the
   other hand. Big, spaced, and unambiguous matters more here than elegance. */
.pair-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 2rem;
  letter-spacing: 0.22em;
  text-align: center;
  padding: 0.9rem 0.5rem;
  margin: 0.6rem 0;
  background: #10141a;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  user-select: all;
}

/* A stat's value and its label are separate elements: writing the value must
   never be able to delete the label, which is what one container holding both
   allowed. */
.stats div b { font-weight: 600; display: block; }
