/* App styles for the ECG web service. Tokens only -- every colour, size and
   radius comes from colors_and_type.css. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--fg-1);
  background: var(--bg-1);
}

/* ---------- Shell ---------- */

.shell-bar {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  height: 64px;                       /* README: top nav 64px desktop */
  padding: 0 var(--s-8);
  background: var(--bg-dark);
  color: var(--fg-inverse);
}

/* The wordmark sits in a 65px canvas with ~34px of transparent margin, so
   it needs more CSS height than a tightly-cropped mark to read at the same
   size. Adjusted here rather than by cropping, which keeps the downloaded
   asset untouched. */
.shell-bar img { height: 34px; width: auto; }

.shell-brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-weight: var(--fw-semi);
  font-size: var(--fs-md);
  color: var(--fg-inverse);
  text-decoration: none;
}

.shell-nav { display: flex; gap: var(--s-5); margin-left: auto; }

.shell-nav a {
  color: var(--ebm-cyan-tint);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

.shell-nav a:hover { color: var(--fg-inverse); text-decoration: underline; }

.shell-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.shell-foot {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--s-8) var(--s-8);
  display: flex;
  gap: var(--s-4);
  color: var(--fg-4);
  font-size: var(--fs-xs);
}

/* ---------- Cards ---------- */

.card {
  background: var(--bg-0);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--s-6);
}

.card > h1, .card > h2 { margin: 0 0 var(--s-2); }

.mono { font-family: var(--font-mono); }

/* ---------- Upload ---------- */

.banner-error {
  margin: var(--s-4) 0 0;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--danger);
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: var(--danger-deep);
  font-size: var(--fs-sm);
}

.upload-form {
  margin-top: var(--s-6);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-3);
}

.file-input {
  width: 100%;
  padding: var(--s-6);
  border: 1px dashed var(--ebm-cyan);
  border-radius: var(--r-md);
  background: var(--ebm-cyan-wash);
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--fg-2);
}

.file-input:focus { outline: none; box-shadow: var(--shadow-focus); }

.btn-primary {
  height: 40px;
  padding: 0 var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--ebm-blue);
  color: var(--fg-inverse);
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}

/* README: hover darkens the fill and lifts the shadow -- never scale. */
.btn-primary:hover {
  background: var(--ebm-blue-deep);
  box-shadow: var(--shadow-sm);
}

.btn-primary:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ---------- Study identity ---------- */

.study-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-3) var(--s-6);
  margin: var(--s-5) 0;
  font-size: var(--fs-xs);
}

.study-meta dt { color: var(--fg-4); }
.study-meta dd { margin: var(--s-1) 0 0; color: var(--fg-2); }
.study-meta .uid { word-break: break-all; }

/* Says the scored window is not the whole file -- quiet, but never hidden. */
.crop-note {
  display: block;
  margin-top: var(--s-1);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--warning);
}

.waveform {
  width: 100%;
  height: auto;
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
}

/* ---------- Scores ---------- */

.scores-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-6);
  flex-wrap: wrap;
}

.threshold { display: flex; align-items: center; gap: var(--s-3); }
.threshold input[type='range'] { accent-color: var(--ebm-cyan); width: 180px; }
.threshold input[type='range']:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}
.threshold output { color: var(--fg-2); font-size: var(--fs-sm); }

.label-list { list-style: none; margin: var(--s-4) 0 0; padding: 0; }

.label-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 3fr auto auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-2) 0;
}

.bar {
  display: block;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--bg-3);
  overflow: hidden;
}

/* Kit convention: chart bars run cyan -> deep blue. */
.bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--ebm-cyan), var(--ebm-blue-deep));
}

.label-name { display: flex; flex-direction: column; gap: 2px; }

/* The expanded PTB-XL wording: present for reading, never competing with
   the code above it. */
.label-desc {
  font-size: var(--fs-xs);
  font-weight: var(--fw-regular);
  line-height: 1.3;
  color: var(--fg-4);
}

.primary .label-name {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--fg-1);
}

.primary .label-score { font-size: var(--fs-sm); color: var(--fg-2); }

.pill-positive {
  visibility: hidden;
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-pill);
  background: var(--danger-soft);
  color: var(--danger-deep);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}

.label-row.is-positive .pill-positive,
.pill-positive.is-shown { visibility: visible; }

.label-row.is-positive .bar-fill { background: var(--danger); }

/* ---------- Secondary label groups ---------- */

.secondary {
  background: var(--bg-2);
  box-shadow: none;
}

.secondary summary { cursor: pointer; color: var(--fg-3); }

.secondary .label-row { grid-template-columns: minmax(120px, 1fr) 3fr auto auto; }

.secondary .label-name { font-size: var(--fs-sm); color: var(--fg-3); }

.secondary .label-score { font-size: var(--fs-xs); color: var(--fg-4); }

.secondary .label-desc { font-size: 11px; }

.secondary .bar { height: 3px; }

.secondary .bar-fill { background: var(--border-strong); }

.secondary .label-row.is-positive .bar-fill { background: var(--danger); }

.secondary .pill-positive { font-size: 11px; }

/* ---------- Records table ---------- */

.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }

.data-table thead th {
  background: var(--bg-2);
  color: var(--fg-2);
  font-weight: var(--fw-medium);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-2);
}

.data-table tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-1);
  vertical-align: top;
}

.data-table tbody tr:hover { background: var(--bg-1); }

.data-table a { color: var(--fg-link); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.data-table .uid { font-size: var(--fs-xs); word-break: break-all; }
