/* History page — shares the dark admin look of the config page. */

:root {
  --bg: #14161c;
  --panel: #1e2230;
  --panel-2: #262b3b;
  --text: #f2f4f8;
  --muted: #98a0b3;
  --accent: #ff4d4f;
  --accent-2: #2ea3ff;
  --radius: 0.5rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.45;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header h1 {
  margin: 0 0 0.2rem;
  font-size: 1.6rem;
}

.nav {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h2 {
  font-size: 1.1rem;
  margin: 0 0 0.8rem;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid #3a4257;
  border-radius: 0.4rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 1rem;
}

.btn:hover {
  border-color: var(--accent-2);
}

/* Session list */
.sessions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Card + delete button side by side (the card itself is a <button>, so the
   delete control can't nest inside it). */
.session-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.session {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "when dur" "who who" "bars bars";
  gap: 0.15rem 1rem;
  text-align: left;
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.btn-delete {
  flex: none;
  align-self: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  font: inherit;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
}

.btn-delete:hover {
  color: #ff4d4f;
  border-color: #ff4d4f;
}

.btn-download {
  flex: none;
  align-self: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  font: inherit;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
}

.btn-download:hover {
  color: #4fc3f7;
  border-color: #4fc3f7;
}

/* Inline per-participant zone bars on each session card. */
.session .list-zonebars {
  grid-area: bars;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.session .list-zonebar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.session .list-zonebar-row .zonebar {
  flex: 1;
  min-width: 0;
}

.session .zl-name {
  flex: none;
  width: 4.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--muted);
}

.session:hover {
  border-color: var(--accent-2);
}

.session .when {
  grid-area: when;
  font-weight: 600;
}

.session .dur {
  grid-area: dur;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 700;
}

.session .who {
  grid-area: who;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Detail */
.detail-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}

.detail-head .btn-delete {
  margin-left: auto;
}

.dur-big {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.p-card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.p-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.p-stats {
  display: flex;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.7rem;
}

.p-stats b {
  color: var(--text);
}

.p-spark {
  position: relative;
}

.p-spark svg {
  display: block;
  width: 100%;
  height: 6rem;
  overflow: visible;
}

.spark-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.spark-area {
  fill: var(--accent);
  opacity: 0.14;
}

/* Intensity-zone bands behind the chart (colors match the live overlay). */
.band {
  fill-opacity: 0.14;
}

.band.z1 {
  fill: #4aa3ff;
}

.band.z2 {
  fill: #2ecc71;
}

.band.z3 {
  fill: #ffb020;
}

.band.z4 {
  fill: #ff7a45;
}

.band.z5 {
  fill: #ff2e33;
}

.band-line {
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

/* Time-in-zone bars (shared by the session list and the detail page). Only
   zone colors are drawn (no background track); the bar's length = session
   time relative to max(1 hour, session duration). */
.zonebar {
  display: flex;
}

.zonebar .segs {
  display: flex;
  height: 0.55rem;
  min-width: 0.28rem;
  border-radius: 0.28rem;
  overflow: hidden;
}

.zonebar .seg.rest {
  background: #7a8699;
}

.zonebar .seg.z1 {
  background: #4aa3ff;
}

.zonebar .seg.z2 {
  background: #2ecc71;
}

.zonebar .seg.z3 {
  background: #ffb020;
}

.zonebar .seg.z4 {
  background: #ff7a45;
}

.zonebar .seg.z5,
.zonebar .seg.over {
  background: #ff2e33;
}

.p-zonetime {
  margin-top: 0.6rem;
}

.p-zonetime .zonetime-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.p-zonetime .zl.rest {
  color: #7a8699;
}

.p-zonetime .zl.z1 {
  color: #4aa3ff;
}

.p-zonetime .zl.z2 {
  color: #2ecc71;
}

.p-zonetime .zl.z3 {
  color: #ffb020;
}

.p-zonetime .zl.z4 {
  color: #ff7a45;
}

.p-zonetime .zl.z5,
.p-zonetime .zl.over {
  color: #ff2e33;
}

/* Axis labels; JS pins each to its gridline via an inline top. */
.p-spark .y-tick {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
