/* ShapeUp — Exercise Log: History tab styles.
 *
 * Ported from the Claude Design mockup (example/shapeup-history.html) but recut
 * to the project's tokens/conventions (see exercise.css :root + .xl-* sizing) —
 * Montserrat, the shared color vars, and the same card radii/shadows as the Log
 * tab. Split colors are no longer data-driven per calendar day (a plain split
 * label is printed instead) — --split / --split-tint now only reach
 * .hist-session-pick, the session list below the calendar.
 *
 * Class prefix: .hist-* (lives inside #xl-panel-history > .xl-hist). */

.xl-hist { font-family: var(--font); }

/* ───────── month navigation ───────── */

.hist-monthnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 320px;
  margin: 0 auto 12px;
}
.hist-navbtn {
  width: 32px; height: 32px;
  flex: none;
  display: grid; place-items: center;
  border: none; border-radius: 8px;
  background: none;
  color: var(--slate);
  font-size: var(--fs-xl); font-weight: var(--fw-semibold);
  font-family: var(--font);
  cursor: pointer;
  transition: color 0.15s;
}
.hist-navbtn:hover:not(:disabled) { color: var(--blue); }
.hist-navbtn:disabled {
  color: var(--border);
  cursor: not-allowed;
}
.hist-month {
  font-size: var(--fs-lg); font-weight: var(--fw-semibold);
  color: var(--ink);
}
.hist-month-sub {
  text-align: center;
  font-size: var(--fs-xs); font-weight: var(--fw-regular);
  color: var(--muted);
  margin-bottom: 14px;
  min-height: 14px;
}

/* ───────── months layout (1 on mobile, 2 on desktop) ───────── */

.hist-months {
  background: var(--white);
  border-radius: 20px;
  padding: 16px 12px 12px;
  /* natural shadow: layered, offset downward (light from above), no hard border */
  box-shadow: var(--shadow-l2);
}
.hist-months-row {
  display: flex;
  justify-content: center;
  gap: 36px;
}
/* Each month block caps its own width so cells don't blow up; centered. */
.hist-month-block {
  flex: 0 1 320px;
  max-width: 320px;
}
/* Per-block month name — shown only in the two-up desktop layout (the single
 * mobile month is already labeled by the .hist-month nav title). */
.hist-month-name {
  display: none;
  text-align: center;
  font-size: var(--fs-md); font-weight: var(--fw-semibold);
  color: var(--ink);
  margin-bottom: 1px;
}
/* The previous-month block is desktop-only. */
.hist-month-prev { display: none; }

@media (min-width: 700px) {
  .hist-month-prev { display: block; }
  .hist-month-name { display: block; }
  /* Frame both calendars: widen the nav and hide its now-redundant title
   * (each block carries its own month name). */
  .hist-monthnav { max-width: 676px; }
  .hist-monthnav .hist-month { visibility: hidden; }
}

/* ───────── calendar grid ───────── */

.hist-weekdays,
.hist-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.hist-weekdays { margin-bottom: 4px; }
.hist-week { margin-bottom: 4px; }

.hist-weekday {
  text-align: center;
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold);

  color: var(--muted);
}

/* A single day cell — date number with the split type on a second line.
 * Workout days are treated equally (no per-split fill or color); the split word
 * itself is the marker. Tall enough for two lines: 42px wide → 36px tall. */
.hist-day {
  aspect-ratio: 7 / 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 8px;
}
.hist-day-num {
  font-size: var(--fs-base); font-weight: var(--fw-semibold);
  line-height: 1.25;
  color: var(--muted);          /* non-workout day number */
}
/* 9px keeps "Full Body" (the longest label, ~40px) inside a ~42px cell on one
 * line. Fixed height so rest days reserve the same second line and every date
 * number in a week sits on the same baseline. */
.hist-day-split {
  height: 10px;
  font-size: var(--fs-3xs); font-weight: var(--fw-semibold);
  line-height: 1;
  color: var(--blue);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
}
.hist-day.blank { pointer-events: none; }

/* Workout day: solid number, blue split label, clickable. No fill. */
.hist-day.workout { cursor: pointer; }
.hist-day.workout .hist-day-num { color: var(--ink); }

/* Today: blue inset ring (only when not the selected day). */
.hist-day.today { box-shadow: inset 0 0 0 2px var(--blue); }

/* Selected workout day: solid fill. */
.hist-day.selected.workout { background: var(--blue); }
.hist-day.selected.workout .hist-day-num,
.hist-day.selected.workout .hist-day-split { color: #fff; }

/* ───────── empty / loading states ───────── */

.hist-empty {
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-md);
  padding: 28px 20px;
  line-height: 1.6;
}

/* ───────── detail area (session list / session detail, below calendar) ─────────
 * Always present below the calendar grid + legend; filled in place when a day is
 * clicked. The calendar above is never cleared. */

.hist-detailarea:not(:empty) { margin-top: 16px; }

/* ───────── day session list (multi-session day) ───────── */

.hist-sessions-label {
  font-size: var(--fs-base); font-weight: var(--fw-semibold);
  color: var(--muted);
  margin-bottom: 8px;
}
.hist-session-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--white);
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  font-family: var(--font);
  transition: box-shadow 0.15s;
  /* natural shadow: layered, offset downward (light from above), no hard border — same recipe as .hist-months */
  box-shadow: var(--shadow-l2);
}
/* No hover lift — matches the exercise cards, which dropped their hover too
   (touch-first surface; :hover sticks after a tap on iOS). */
.hist-session-pick-main { min-width: 0; }
.hist-session-pick-title {
  font-size: var(--fs-base); font-weight: var(--fw-semibold); color: var(--ink);
}
.hist-session-pick-meta {
  font-size: var(--fs-xs); color: var(--muted); margin-top: 2px;
}
.hist-session-pick-split {
  flex: none;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  color: var(--blue);
}

/* ───────── session detail ───────── */

/* Back link uses the shared Button ghost variant (.sa-btn-ghost, shell.css);
   only the layout spacing for this spot is scoped here. */
.hist-detail-back { margin-bottom: 12px; }

/* Summary metadata and share action live in the shared HeroCardShell topbar. */
.hist-summary-meta { display: flex; flex-direction: column; gap: 1px; }
.hist-summary-date {
  font-size: var(--fs-base); font-weight: var(--fw-semibold);
  color: var(--blue); font-variant-numeric: tabular-nums;
}
.hist-summary-duration {
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.hist-summary-share {
  position: relative;
  width: 16px; height: 16px;
  padding: 0;
  color: var(--blue);
}
.hist-summary-share::before {
  content: '';
  position: absolute;
  inset: -14px;
}
.hist-summary-share:hover:not(:disabled) { color: var(--blue-dark); }

/* ───────── exercise detail cards ───────── */

.hist-ex {
  background: var(--white);
  border-radius: 12px;
  /* Collapsed-mode density, now the only mode: tighter padding and a smaller
     gap between cards. The card's CONTENTS are unchanged. */
  padding: 10px 12px;
  margin-top: 6px;
  /* natural shadow: layered, offset downward (light from above), no hard border — same recipe as .hist-months / .hist-session-pick */
  box-shadow: var(--shadow-l2);
}
.hist-ex-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.hist-ex-headleft {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
/* B / U category badge — sized/weighted to match the Log tab's current logged
   sets (.xl-cs-cat): 18px square, 10/700, same green/rust. --cat-bg set inline. */
.hist-ex-cat {
  width: 18px; height: 18px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--cat-bg, var(--slate));
  color: #fff;
  font-size: var(--fs-2xs); font-weight: var(--fw-bold);
}
.hist-ex-name {
  font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--slate);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Equipment badge — flat blue, matching the Log tab's logged sets
   (.xl-cs-equip): no per-equipment colors. */
.hist-ex-equip {
  flex: none;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  color: var(--blue); background: rgba(37, 99, 201, 0.1);
  border-radius: 6px;
  padding: 4px 9px;
}

/* ───────── collapse / expand ───────── */

.hist-ex-headright {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}

.hist-set {
  padding: 6px 12px;
  margin-bottom: 2px;
}
.hist-set:last-child { margin-bottom: 0; }
/* Editing state (inline edit form) — the form itself is a plain white
   bordered card (1b "no header"), see .xl-edit-form in exercise.css. */
.hist-set.editing { padding: 0; }
.hist-set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.hist-set-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.hist-set-wr {
  font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--ink);
  font-variant-numeric: tabular-nums;
}
/* PR badge styling is shared — see .pr-badge in exercise.css (loads on this page
   too). No badge rules here on purpose, so there's one source of truth. */
.hist-set-right {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}
/* Matches .hist-set-wr's size/weight/color now that both columns read the same
   (was fs-xs/teal — the user flagged weight vs. RIR·RPE reading inconsistently). */
.hist-set-effort {
  font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hist-set-time {
  font-size: var(--fs-xs); color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Per-set remark reuses the Log tab's .xl-cs-rmk style (exercise.css) for a
   100% match — no .hist-set-note rules needed here. */

/* ───────── swipe-to-edit/delete (per set row) ───────── */
/* Unified onto exercise.css's .xl-cs-set-swipe/.xl-cs-actions/.xl-cs-act/
   .xl-cs-slide (SwipeRow.tsx) — this file no longer defines its own copy. */

/* ───────── inline edit form ───────── */
/* Styles live in exercise.css (.xl-edit-*) — loaded on the same page. */
