/* ─────────────────────────────────────────────────────────────────────────────
   Forge — Run Module CSS
   Iron-and-gold design tokens (see DESIGN.md). Reuses .hlt-* shell classes
   (tabs, main, units pill, save button/confirm) from health.css / components.css.
───────────────────────────────────────────────────────────────────────────── */

.hlt-units-pill {
  padding: 4px 12px; border-radius: 20px;
  border: 0.5px solid var(--gold-border); background: var(--gold-dim);
  font-size: 12px; font-weight: 600; color: var(--gold);
  cursor: pointer; letter-spacing: 1px; user-select: none;
  transition: all var(--transition);
  position: relative;
}
/* Invisible padded hit area — brings the ~26px pill to a ~44px touch target
   without visually bloating it. Clicks bubble to the pill's listener. */
.hlt-units-pill::after {
  content: ''; position: absolute;
  top: -9px; bottom: -9px; left: -8px; right: -8px;
}
.hlt-units-pill:hover { background: rgba(200, 150, 62, 0.2); }
.hlt-units-pill:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ── Shared shell classes (mirror health.css so the page works standalone) ── */
.hlt-tabs {
  display: flex; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.hlt-tab {
  flex: 1; padding: 12px 16px; border: none;
  border-bottom: 2px solid transparent; background: transparent;
  color: var(--muted); font-family: var(--font-condensed);
  font-size: 13px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.hlt-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.hlt-tab:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.hlt-main {
  width: 100%; max-width: 600px; margin: 0 auto;
  padding: 20px; padding-bottom: 88px;
  overflow-y: auto; overflow-x: hidden; min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.hlt-panel { display: none; }
.hlt-panel.active { display: block; animation: fadeUp 0.2s var(--ease-precise); }

.hlt-section-label {
  font-family: var(--font-condensed); font-size: 11px; font-weight: 600;
  letter-spacing: 2.5px; text-transform: uppercase; color: var(--muted);
  margin-bottom: 10px;
}

.hlt-save-btn {
  width: 100%; margin-top: 18px; padding: 15px; border: none;
  border-radius: var(--radius-sm); background: var(--gold); color: var(--dark);
  font-family: var(--font-condensed); font-size: 16px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; cursor: pointer;
  transition: background var(--transition);
}
.hlt-save-btn:hover { background: var(--gold-light); }
.hlt-save-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.hlt-save-confirm {
  text-align: center; padding: 12px; font-size: 14px;
  color: var(--green); font-weight: 600; margin-top: 10px;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── Resume-in-progress-run banner ─────────────────────────────────────────── */
.run-resume-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  padding: 14px; margin-bottom: 16px;
  background: var(--gold-dim); border: 1px solid var(--gold-border);
  border-radius: var(--radius-md);
}
.run-resume-text {
  display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text);
}
.run-resume-text strong {
  font-family: var(--font-condensed); font-size: 13px; font-weight: 600;
  letter-spacing: 0.5px; color: var(--gold);
}
.run-resume-actions { display: flex; gap: 8px; flex-shrink: 0; }
.run-resume-actions .run-btn {
  flex: 0 0 auto; padding: 9px 16px; min-height: 36px; font-size: 12px;
}

/* ── GPS status banner ─────────────────────────────────────────────────────── */
.run-gps-status {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin-bottom: 16px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px; color: var(--muted); line-height: 1.35;
}
.run-gps-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--muted); transition: background var(--transition);
}
.run-gps-status[data-state="ready"]   .run-gps-dot,
.run-gps-status[data-state="good"]    .run-gps-dot { background: var(--green); }
.run-gps-status[data-state="good"]    .run-gps-dot { box-shadow: 0 0 0 4px rgba(76, 175, 118, 0.18); }
.run-gps-status[data-state="acquiring"] .run-gps-dot { background: var(--blue); animation: gpsPulse 1.1s var(--ease-precise) infinite; }
.run-gps-status[data-state="weak"]    .run-gps-dot { background: var(--gold); }
.run-gps-status[data-state="denied"]  .run-gps-dot,
.run-gps-status[data-state="error"]   .run-gps-dot { background: var(--red); }

.run-gps-status[data-state="denied"],
.run-gps-status[data-state="error"] {
  border-color: rgba(224, 82, 82, 0.35); background: rgba(224, 82, 82, 0.08);
  color: var(--text);
}
.run-gps-status[data-state="weak"] {
  border-color: var(--gold-border); background: var(--gold-dim); color: var(--text);
}

@keyframes gpsPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* ── Run-type chips ────────────────────────────────────────────────────────── */
.run-type-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px;
}
.run-interval-setup { margin-bottom: 4px; }
.run-type-chip {
  padding: 8px 15px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-family: var(--font-condensed);
  font-size: 12px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; cursor: pointer; min-height: 44px;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.run-type-chip:hover { border-color: var(--gold-border); color: var(--text); }
.run-type-chip.active {
  color: var(--gold); border-color: var(--gold-border); background: var(--gold-dim);
}
.run-type-chip:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ── Live hero stats ───────────────────────────────────────────────────────── */
.run-hero {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px 20px 20px;
  transition: background var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.run-hero.is-running {
  background: var(--card-raised); border-color: var(--gold-border);
  box-shadow: var(--shadow-molten);
}
.run-hero-primary { text-align: center; margin-bottom: 20px; }
.run-hero-value {
  font-family: var(--font-display); font-size: clamp(4rem, 22vw, 6rem);
  line-height: 0.9; letter-spacing: 1px; color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.run-hero-label {
  font-family: var(--font-condensed); font-size: 11px; font-weight: 600;
  letter-spacing: 2.5px; text-transform: uppercase; color: var(--muted);
  margin-top: 6px;
}
.run-hero-secondary {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  border-top: 1px solid var(--border); padding-top: 18px;
}
/* Interval: WORK / REST / DONE and the round, as on a workout's run. */
.run-cue {
  font-family: var(--font-condensed); font-size: 34px; font-weight: 700;
  letter-spacing: 3px; color: var(--gold); text-align: center;
}
.run-round { font-size: 13px; color: var(--muted); text-align: center; min-height: 1em; margin-bottom: 8px; }
.run-stat { text-align: center; }
.run-stat-value {
  font-family: var(--font-display); font-size: 32px; line-height: 1;
  letter-spacing: 1px; color: var(--text); font-variant-numeric: tabular-nums;
}
.run-stat-label {
  font-family: var(--font-condensed); font-size: 10px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase; color: var(--muted);
  margin-top: 6px;
}

.run-accuracy {
  margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center;
  line-height: 1.4;
}
.run-accuracy.is-weak { color: var(--gold); }

/* ── Controls ──────────────────────────────────────────────────────────────── */
.run-controls {
  display: flex; gap: 12px; margin-top: 20px;
}
.run-btn {
  flex: 1; min-height: 54px; padding: 15px; border: none;
  border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font-condensed); font-size: 16px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform 0.25s var(--ease-precise);
}
.run-btn:hover:not(:disabled) { transform: translateY(-4px); }
.run-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.run-btn--primary { background: var(--gold); color: var(--dark); }
.run-btn--primary:hover { background: var(--gold-light); }
.run-btn--secondary {
  background: transparent; border: 1px solid var(--border); color: var(--text);
}
.run-btn--secondary:hover { border-color: var(--gold); color: var(--gold); }
.run-btn--stop {
  background: rgba(224, 82, 82, 0.12); border: 1px solid rgba(224, 82, 82, 0.4);
  color: var(--red);
}
.run-btn--stop:hover { background: rgba(224, 82, 82, 0.2); }

.run-hint {
  margin-top: 16px; font-size: 12px; color: var(--muted); line-height: 1.5;
}
/* Finish with no measured distance: the optional box, then Save / Discard. */
.run-finish { margin-top: 16px; }

/* ── Manual entry fields ───────────────────────────────────────────────────── */
.run-field { margin-bottom: 14px; }
.run-field-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.run-field-label {
  display: block; font-family: var(--font-condensed); font-size: 11px;
  font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 7px;
}
.run-optional { text-transform: none; letter-spacing: 0; font-weight: 400; opacity: 0.7; }
.run-input-wrap { display: flex; align-items: center; gap: 8px; }
.run-input {
  flex: 1; width: 100%; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font-body); font-size: 16px;
  font-weight: 500; outline: none; -webkit-appearance: none; min-width: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.run-input:focus { border-color: var(--gold); box-shadow: var(--shadow-focus); }
.run-input::placeholder { color: var(--muted); }
.run-input-unit { font-size: 14px; color: var(--muted); white-space: nowrap; }
.run-notes {
  width: 100%; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font-body); font-size: 16px; /* 16px stops iOS auto-zoom on focus */
  outline: none; resize: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.run-notes:focus { border-color: var(--gold); box-shadow: var(--shadow-focus); }
.run-notes::placeholder { color: var(--muted); }

/* ── History summary ───────────────────────────────────────────────────────── */
.run-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-bottom: 20px;
}
.run-summary-stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 10px; text-align: center;
}
.run-summary-value {
  font-family: var(--font-display); font-size: 28px; line-height: 1;
  color: var(--gold); font-variant-numeric: tabular-nums;
}
.run-summary-label {
  font-family: var(--font-condensed); font-size: 10px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted);
  margin-top: 6px;
}

/* ── History list ──────────────────────────────────────────────────────────── */
.run-history-list { display: flex; flex-direction: column; gap: 10px; }
.run-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 15px 16px;
  animation: fadeUp 0.24s var(--ease-precise) both;
}
.run-card-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.run-card-type {
  font-family: var(--font-condensed); font-size: 11px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold);
  padding: 3px 10px; border: 1px solid var(--gold-border);
  background: var(--gold-dim); border-radius: 20px;
}
.run-card-date { font-size: 12px; color: var(--muted); }
.run-card-actions { display: flex; align-items: center; gap: 2px; }
.run-card-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin: -10px -10px -10px 0;
  padding: 0; border: none; background: none; cursor: pointer;
  color: var(--muted); border-radius: 50%;
  transition: color var(--transition), background var(--transition);
}
.run-card-del:hover, .run-card-del:active { color: var(--red); background: var(--gold-dim); }
.run-card-del svg { width: 16px; height: 16px; }
.run-card-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.run-card-stat { text-align: left; }
.run-card-stat-value {
  font-family: var(--font-display); font-size: 22px; line-height: 1;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.run-card-stat-label {
  font-family: var(--font-condensed); font-size: 9px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted);
  margin-top: 4px;
}
.run-card-notes {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted); line-height: 1.45;
}

/* ── Empty state ───────────────────────────────────────────────────────────── */
.run-empty {
  text-align: center; padding: 48px 24px 24px;
  animation: fadeUp 0.24s var(--ease-precise);
}
.run-empty-mark {
  width: 64px; height: 64px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--gold-dim);
  border: 1px solid var(--gold-border); color: var(--gold);
}
.run-empty-title {
  font-family: var(--font-display); font-size: 24px; letter-spacing: 2px;
  color: var(--text);
}
.run-empty-sub {
  margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.5;
  max-width: 40ch; margin-left: auto; margin-right: auto;
}

/* ── Reduced motion ────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hlt-panel.active, .run-card, .run-empty { animation: none; }
  .run-gps-status[data-state="acquiring"] .run-gps-dot { animation: none; }
  .run-btn, .run-type-chip, .run-hero { transition: none; }
}
