/* style.css — TrainingViz dark theme, mobile-first */

:root {
  --z1: #94a3b8;
  --z2: #3b82f6;
  --z3: #22c55e;
  --z4: #eab308;
  --z5: #f97316;
  --z6: #ef4444;
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #334155;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --radius: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px;
}

h1 { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
h2 { font-size: 0.95rem; font-weight: 500; color: var(--text-dim); margin-bottom: 16px; }

/* ── Session list ── */

.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
}

.session-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
}

.session-card:hover { background: var(--surface2); }
.session-card .name { font-weight: 600; font-size: 0.95rem; }
.session-card .meta { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }
.session-card .duration { font-size: 0.85rem; color: var(--text-dim); white-space: nowrap; }

/* ── Badges ── */

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-anaerob   { background: rgba(239,68,68,0.2);  color: #fca5a5; }
.badge-sweetspot  { background: rgba(234,179,8,0.2);  color: #fde047; }
.badge-vo2        { background: rgba(249,115,22,0.2); color: #fdba74; }
.badge-threshold  { background: rgba(34,197,94,0.2);  color: #86efac; }
.badge-distans    { background: rgba(59,130,246,0.2); color: #93c5fd; }

/* ── Chart container ── */

.chart-container {
  width: 100%;
  height: 50vh;
  margin-bottom: 16px;
}

/* ── Live view ── */

.live-container {
  text-align: center;
  padding: 20px 0;
}

.live-chart-container {
  width: 100%;
  height: 35vh;
  margin-bottom: 16px;
}

.live-zone-banner {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 16px;
  border-radius: 99px;
  display: inline-block;
  margin-bottom: 16px;
}

.live-timer {
  font-size: 2.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 8px;
}

.live-ftp {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.live-desc {
  font-size: 1rem;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.live-progress-wrap {
  background: var(--surface);
  border-radius: 99px;
  height: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.live-progress-bar {
  height: 100%;
  border-radius: 99px;
}

.live-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.live-next {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
  text-align: left;
}

.live-next-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.live-next-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.step-zone-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Buttons ── */

.live-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn {
  padding: 14px 32px;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
}

.btn-primary {
  background: #3b82f6;
  color: white;
  flex: 1;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
}

/* ── FTP Input ── */

.ftp-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
}

.ftp-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.ftp-input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--surface2);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  padding: 8px 12px;
  max-width: 120px;
  -moz-appearance: textfield;
}

.ftp-input:focus {
  outline: none;
  border-color: #3b82f6;
}

/* ── Borg + Zone row ── */

.live-zone-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.live-borg {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 99px;
  display: inline-block;
}

/* ── Scrub bar ── */

.scrub-wrap {
  padding: 8px 0;
  margin-bottom: 4px;
  cursor: pointer;
  touch-action: none;
}

.scrub-track {
  position: relative;
  height: 8px;
  background: var(--surface);
  border-radius: 99px;
  overflow: visible;
}

.scrub-fill {
  height: 100%;
  border-radius: 99px;
  width: 0;
  transition: width 0.1s linear;
}

.scrub-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #3b82f6;
  left: 0;
  transition: left 0.1s linear;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* ── QR Modal ── */

.qr-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.qr-modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  max-width: 340px;
  width: 100%;
}

.qr-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.qr-subtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.qr-canvas {
  display: block;
  margin: 0 auto 12px;
  border-radius: 8px;
}

.qr-url {
  font-size: 0.7rem;
  color: var(--text-dim);
  word-break: break-all;
  margin-bottom: 16px;
}

/* ── FTP Reference Table ── */

.ftp-table-wrapper {
  margin-bottom: 24px;
}

.section-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.ftp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.ftp-table th,
.ftp-table td {
  padding: 6px 8px;
  text-align: center;
  border-bottom: 1px solid var(--surface2);
}

.ftp-table th {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ftp-table-label {
  text-align: left;
  font-weight: 500;
  color: var(--text-dim);
}

/* ── View containers ── */

.view { display: none; }
.view.active { display: block; }
