/* recview. Colours and font follow musicdatasystems.com (client_app/frontend_vue/src/style.css). */

:root {
  --musicdata-blue: #29abe2;
  --musicdata-blue-light: #5cc4f0;
  --musicdata-blue-dark: #1a8bb8;
  --musicdata-blue-tint: rgba(41, 171, 226, 0.1);
  --ink: #212529;
  --muted: #6c757d;
  --rule: #dee2e6;
  --panel: #f8f9fa;
  --page: #ffffff;
  --bad: #dc3545;
  --bad-tint: #f8d7da;
  --warn: #b26a00;
  --ok: #198754;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: 'Google Sans Flex', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
}

[hidden] { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 10px 16px;
  background: var(--musicdata-blue);
  color: #fff;
}

.brand { font-size: 20px; font-weight: 700; white-space: nowrap; }
.brand-sub { font-weight: 500; opacity: 0.9; margin-left: 6px; }

.controls { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.controls label { font-weight: 500; }
.controls select {
  font: inherit;
  padding: 5px 8px;
  border: 1px solid var(--musicdata-blue-dark);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  min-width: 220px;
}
.spacer { flex: 1; }
.who { opacity: 0.9; }
.freshness { font-weight: 500; }
.freshness.stale { background: #fff; color: var(--warn); padding: 2px 8px; border-radius: 10px; }

.btn, .btn-ghost {
  font: inherit;
  font-weight: 600;
  border-radius: 4px;
  padding: 6px 14px;
  cursor: pointer;
}
.btn { background: var(--musicdata-blue); border: 1px solid var(--musicdata-blue); color: #fff; }
.btn:hover { background: var(--musicdata-blue-dark); border-color: var(--musicdata-blue-dark); }
.btn-ghost { background: transparent; border: 1px solid #fff; color: #fff; }
.btn-ghost:hover { background: var(--musicdata-blue-dark); }

main { padding: 16px; }

.login { display: flex; justify-content: center; padding-top: 8vh; }
.card {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px;
  border: 1px solid var(--rule);
  border-top: 4px solid var(--musicdata-blue);
  border-radius: 6px;
  background: #fff;
}
.card h1 { margin: 0 0 8px; font-size: 20px; color: var(--musicdata-blue-dark); }
.card input {
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin-bottom: 8px;
}
.card input:focus { outline: 2px solid var(--musicdata-blue-light); border-color: var(--musicdata-blue); }
.error-text { color: var(--bad); min-height: 1.2em; margin: 4px 0 0; }

.status { color: var(--muted); margin: 0 0 12px; }

/* Loop header band: stays in view while the grid scrolls sideways. */
tr.band td { padding: 0; border-bottom: 0; background: #fff; }
tbody.loop + tbody.loop tr.band td { padding-top: 18px; }
.loop-head {
  position: sticky;
  left: 0;
  width: max-content;
  max-width: calc(100vw - 34px);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 8px 12px;
  background: #eaf6fc;
  border-left: 5px solid var(--musicdata-blue);
  border-radius: 4px 4px 0 0;
  white-space: normal;
}
.loop-head.fresh { animation: arrive 2.5s ease-out; }
@keyframes arrive { from { background: var(--musicdata-blue-light); } to { background: #eaf6fc; } }
.loop-title { font-weight: 700; color: var(--musicdata-blue-dark); }
.loop-head .kv { white-space: nowrap; }
.loop-head .k { color: var(--muted); margin-right: 4px; }
.loop-head .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; }

.grid-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px; }
table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
th, td {
  padding: 4px 10px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  white-space: nowrap;
  vertical-align: top;
}
th {
  background: var(--panel);
  color: var(--musicdata-blue-dark);
  font-weight: 600;
  font-size: 12px;
}
th.group-rds, td.group-rds { background-color: rgba(41, 171, 226, 0.04); }
tbody tr:not(.band):not(.labels):hover td { background: #eaf6fc; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.rt { white-space: normal; min-width: 260px; max-width: 460px; }
td.extra { color: var(--muted); font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; }

/* Time and station stay in view while the grid scrolls sideways. */
th.stick, td.stick { position: sticky; background: #fff; z-index: 1; }
th.stick { background: var(--panel); }
.stick-1 { left: 0; min-width: 150px; }
.stick-2 { left: 150px; border-right: 1px solid var(--rule); }

.yes { color: var(--ok); font-weight: 700; }
.no { color: var(--bad); font-weight: 700; }
.nil { color: #adb5bd; }
tr.has-error td { background: var(--bad-tint); }
tr.has-error td.stick { background: var(--bad-tint); }
td.err { color: var(--bad); font-weight: 600; white-space: normal; min-width: 160px; }
