/* NyxRP Staff Logs — third palette in the empirecourt / lscso family.
   Courts are near-black + gold, LSCSO is warm brown + brass, this is violet-black + lilac.
   Same conventions throughout: CSS custom properties, Georgia serif, 3px radius,
   uppercase letterspaced labels, no emojis anywhere user-facing. */

:root {
  color-scheme: dark;

  --bg: #0d0a13;
  --nyx: #a98fd0;
  --nyx-bright: #c9b3e8;
  --nyx-dim: rgba(169, 143, 208, 0.18);
  --text: #ece7f2;
  --muted: #968ca8;
  --faint: #4a4256;
  --line: rgba(169, 143, 208, 0.16);
  --card-bg: rgba(255, 255, 255, 0.035);
  --panel-head: rgba(255, 255, 255, 0.02);

  --ok: #8fbf9f;
  --warn: #e3b551;
  --danger: #e08b7b;
  --info: #9db8dd;

  --r: 3px;
}

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

html { background-color: var(--bg); scroll-behavior: smooth; }

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(169, 143, 208, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% 85%, rgba(96, 72, 132, 0.10) 0%, transparent 50%);
  background-color: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  min-height: 100vh;
}

h1, h2 { font-weight: 600; }
a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; }

/* ── Header ── */
header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 0 22px; min-height: 57px;
  background: rgba(13, 10, 19, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
header h1 {
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--nyx-bright);
  font-weight: 600;
}
#userInfo {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
#userInfo:empty { display: none; }

/* ── Filters ── */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  max-width: 1400px; margin: 0 auto;
  padding: 26px 24px 0;
}
.filters select,
.filters input[type="search"] {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  font-size: 0.84rem;
  padding: 9px 12px;
  min-width: 190px;
  transition: border-color 0.18s ease;
}
.filters input[type="search"] { flex: 1 1 260px; }
.filters select:focus,
.filters input[type="search"]:focus {
  outline: none;
  border-color: var(--nyx);
}
.filters input::placeholder { color: var(--faint); }

.filters button {
  background: var(--nyx-dim);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--nyx-bright);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.filters button:hover { background: rgba(169, 143, 208, 0.28); border-color: var(--nyx); }
.filters button:focus-visible { outline: 2px solid var(--nyx); outline-offset: 2px; }

/* ── Table, treated as a panel like the sister sites ── */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 24px 80px;
}

#logsTable {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.82rem;
  animation: fadeUp 0.35s ease both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

#logsTable thead th {
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--nyx);
  font-weight: 600;
  padding: 12px 14px;
  background: var(--panel-head);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

#logsTable tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(169, 143, 208, 0.07);
  vertical-align: top;
  color: var(--text);
}
#logsTable tbody tr:last-child td { border-bottom: none; }
#logsTable tbody tr:hover td { background: rgba(169, 143, 208, 0.05); }

/* Timestamps and identifiers line up better in a mono face with tabular figures. */
#logsTable tbody td:nth-child(1),
#logsTable tbody td:nth-child(4),
#logsTable tbody td:nth-child(5),
#logsTable tbody td:nth-child(6),
#logsTable tbody td:nth-child(7) {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

/* Category reads as a label rather than loose text. */
#logsTable tbody td:nth-child(2) {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--nyx-bright);
  white-space: nowrap;
}

/* Redacted fields come from redact.js — they are a deliberate absence, not an error,
   so they read as quiet and italic rather than as a warning. */
.redacted {
  color: var(--faint);
  font-style: italic;
  letter-spacing: 0.04em;
}

/* Payload JSON. Wraps rather than stretching the table, and scrolls if a single
   line is enormous. */
.details {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--muted);
  max-width: 460px;
  max-height: 6.5em;
  overflow: auto;
  word-break: break-word;
  line-height: 1.5;
}

/* ── Login ── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 44px 48px;
  text-align: center;
  max-width: 420px;
  animation: fadeUp 0.35s ease both;
}
.card .overline {
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--nyx);
  margin-bottom: 12px;
}
.card h1 {
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.card p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
  margin-bottom: 26px;
}
a.btn {
  display: inline-block;
  background: var(--nyx-dim);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--nyx-bright);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 12px 26px;
  transition: background 0.18s ease, border-color 0.18s ease;
}
a.btn:hover { background: rgba(169, 143, 208, 0.28); border-color: var(--nyx); }
a.btn:focus-visible { outline: 2px solid var(--nyx); outline-offset: 2px; }

/* ── Narrow screens: the table is wide, so let it scroll rather than crush it ── */
@media (max-width: 900px) {
  main { padding: 18px 12px 60px; overflow-x: auto; }
  #logsTable { min-width: 860px; }
  .filters { padding: 20px 12px 0; }
  header { padding: 10px 14px; }
}

/* ── Dashboard ───────────────────────────────────────────────────────────────
   Added 2026-08-31: the site now opens on a picker rather than straight into the
   table. Reuses the tokens above so this stays one visual system. */

.dash {
  max-width: 1000px;
  margin: 0 auto;
  padding: 34px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.panel {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  animation: fadeUp 0.35s ease both;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-head);
}
.panel-title {
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--nyx); font-weight: 600;
}
.panel-body { padding: 20px 18px; }

/* Status pill. Colour carries the state, but the word says it too - never colour alone. */
.state {
  font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line);
}
.state-on      { color: var(--ok);     border-color: rgba(143, 191, 159, 0.35); }
.state-off     { color: var(--danger); border-color: rgba(224, 139, 123, 0.35); }
.state-unknown { color: var(--muted); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.015);
}
.stat-val {
  font-size: 1.5rem; line-height: 1.1; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-key {
  margin-top: 6px;
  font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}

.meta { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; font-size: 0.82rem; }
.meta dt {
  font-size: 0.66rem; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--muted); padding-top: 3px;
}
.meta dd { color: var(--text); word-break: break-word; }
.meta-note { color: var(--muted); font-size: 0.84rem; font-style: italic; }

.section-head { margin-bottom: 18px; }
.page-overline { font-size: 0.66rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--nyx); margin-bottom: 8px; }
.page-title { font-size: 1.5rem; letter-spacing: 0.03em; margin-bottom: 6px; }
.page-sub { color: var(--muted); font-size: 0.85rem; line-height: 1.6; max-width: 60ch; }

/* ── Category tiles ── */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.tile {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
  animation: fadeUp 0.35s ease both;
}
.tile:hover {
  border-color: var(--nyx);
  background: rgba(169, 143, 208, 0.06);
  transform: translateY(-1px);
}
.tile:focus-visible { outline: 2px solid var(--nyx); outline-offset: 2px; }
.tile-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tile-label { font-size: 1rem; color: var(--text); }
.tile-count {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9rem; color: var(--nyx-bright); font-variant-numeric: tabular-nums;
}
.tile-blurb { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.tile-foot {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 4px; padding-top: 10px; border-top: 1px solid rgba(169, 143, 208, 0.09);
  font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint);
}

.empty { color: var(--muted); font-size: 0.86rem; font-style: italic; padding: 18px 2px; }

.back {
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); padding: 9px 14px;
  border: 1px solid var(--line); border-radius: var(--r);
  transition: color 0.18s ease, border-color 0.18s ease;
}
.back:hover { color: var(--nyx-bright); border-color: var(--nyx); }

@media (max-width: 900px) {
  .dash { padding: 24px 12px 60px; gap: 28px; }
}

/* ── Detail cells ────────────────────────────────────────────────────────────
   2026-08-31: payloads used to render as raw JSON. Now key/value chips, formatted
   by value type in logs.js. Wider column since details are the point of the row. */

.details {
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
  max-width: 520px;
  max-height: none;
  overflow: visible;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
}

.kv {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.02);
  max-width: 100%;
}
.kv-k {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.kv-v {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

/* An empty column means the FiveM side never sent that field -- absent, not withheld.
   Deliberately quiet: it should not draw the eye the way a redaction notice would. */
.novalue { color: var(--faint); }

/* Kept for when a tier with fields:["default"] exists again -- redaction is currently
   off for every tier that can log in. */
.redacted { color: var(--warn); font-style: italic; letter-spacing: 0.04em; }

/* ── Copy for Discord ── */
.copy-th { width: 1%; }
.copy-cell { white-space: nowrap; vertical-align: top; }
.copy-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--muted);
  font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 6px 12px; cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.copy-btn:hover { color: var(--nyx-bright); border-color: var(--nyx); background: rgba(169,143,208,0.08); }
.copy-btn:focus-visible { outline: 2px solid var(--nyx); outline-offset: 2px; }
.copy-btn.copied { color: var(--ok); border-color: rgba(143,191,159,0.45); }

/* ── Attached media ── */
.media-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; width: 100%; }
.media-thumb {
  display: block; width: 64px; height: 64px;
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  background: rgba(255,255,255,0.02);
  transition: border-color 0.18s ease;
}
.media-thumb:hover { border-color: var(--nyx); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-file {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: var(--r);
  padding: 6px 12px; color: var(--nyx-bright);
  font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase;
}
.media-file:hover { border-color: var(--nyx); }

/* ── Event tone ───────────────────────────────────────────────────────────────
   2026-08-31 (DrReki): joins green, leaves red. A left rail plus a tinted category
   reads at a glance while scrolling, without shouting. The action word is still in
   the detail chips, so colour is reinforcement rather than the only signal. */

.log-row td:first-child { border-left: 2px solid transparent; }

.tone-good td:first-child { border-left-color: var(--ok); }
.tone-good .cat           { color: var(--ok); }

.tone-bad td:first-child  { border-left-color: var(--danger); }
.tone-bad .cat            { color: var(--danger); }

/* Very low tint so a long run of joins does not turn the table into a colour block. */
.tone-good:hover td { background: rgba(143, 191, 159, 0.06); }
.tone-bad:hover td  { background: rgba(224, 139, 123, 0.06); }
