/* ==========================================================================
   TrainerPlatform - Product surfaces
   --------------------------------------------------------------------------
   Styles for the scheduling, client and progress surfaces. Separated from
   components.css because these are domain-shaped rather than generic
   primitives, but they follow exactly the same token rules.
   ========================================================================== */

/* ======================================================================
   DAY SCHEDULE
   A time-gutter list rather than a proportional calendar grid: a trainer
   reads their day as an ordered list of appointments, and a grid wastes
   most of its height on empty hours.
   ====================================================================== */
.tp-schedule {
  display: flex;
  flex-direction: column;
}

.tp-appointment {
  position: relative;
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  gap: var(--tp-space-4);
  padding: var(--tp-space-4) var(--tp-space-5);
  border-bottom: var(--tp-border-thin) solid var(--tp-border-subtle);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--tp-duration-fast) var(--tp-ease-standard);
}

.tp-appointment:last-child { border-bottom: 0; }
.tp-appointment:hover { background: var(--tp-bg-hover); color: inherit; }

/* The time gutter. Tabular figures keep the colons aligned down the column. */
.tp-appointment__when {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding-top: 0.1rem;
}

.tp-appointment__time {
  font-size: var(--tp-text-base);
  font-weight: var(--tp-weight-semibold);
  font-variant-numeric: tabular-nums;
  line-height: var(--tp-leading-none);
  color: var(--tp-text-primary);
}

.tp-appointment__duration {
  font-size: var(--tp-text-2xs);
  color: var(--tp-text-muted);
  font-variant-numeric: tabular-nums;
}

.tp-appointment__body {
  display: flex;
  align-items: flex-start;
  gap: var(--tp-space-3);
  min-width: 0;
}

.tp-appointment__text { min-width: 0; flex: 1 1 auto; }

.tp-appointment__client {
  font-size: var(--tp-text-base);
  font-weight: var(--tp-weight-semibold);
  color: var(--tp-text-primary);
  line-height: var(--tp-leading-snug);
}

.tp-appointment__focus {
  margin-top: 0.1rem;
  font-size: var(--tp-text-sm);
  color: var(--tp-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-appointment__meta {
  margin-top: var(--tp-space-2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tp-space-2) var(--tp-space-3);
  font-size: var(--tp-text-xs);
  color: var(--tp-text-muted);
}

.tp-appointment__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.tp-appointment__meta-icon { width: 0.875rem; height: 0.875rem; }

.tp-appointment__trailing {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--tp-space-2);
  padding-top: 0.1rem;
}

/* A concluded appointment recedes so the live and upcoming ones dominate. */
.tp-appointment--concluded .tp-appointment__client,
.tp-appointment--concluded .tp-appointment__time { color: var(--tp-text-secondary); }
.tp-appointment--concluded { background: var(--tp-bg-surface-alt); }
.tp-appointment--concluded:hover { background: var(--tp-bg-hover); }

.tp-appointment--cancelled .tp-appointment__client { text-decoration: line-through; }
.tp-appointment--cancelled .tp-appointment__focus { text-decoration: line-through; }

/* The session happening right now - the single loudest row on the screen. */
.tp-appointment--live {
  background: var(--tp-brand-subtle);
  border-bottom-color: color-mix(in srgb, var(--tp-brand) 30%, transparent);
}

.tp-appointment--live:hover {
  background: color-mix(in srgb, var(--tp-brand) 18%, var(--tp-bg-surface));
}

.tp-appointment--live::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tp-brand);
}

.tp-appointment--live .tp-appointment__time { color: var(--tp-brand-on-subtle); }

/* Pulsing dot marking the live session. Static under reduced-motion. */
.tp-live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--tp-brand);
  flex: 0 0 auto;
  animation: tp-pulse 2s var(--tp-ease-standard) infinite;
}

@keyframes tp-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}

/* ======================================================================
   NEXT-UP CALLOUT
   ====================================================================== */
.tp-next-up {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tp-space-4);
  padding: var(--tp-space-5);
  border-radius: var(--tp-radius-lg);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--tp-primary-500) 14%, var(--tp-bg-surface)),
    var(--tp-bg-surface) 70%
  );
  border: var(--tp-border-thin) solid color-mix(in srgb, var(--tp-brand) 28%, transparent);
}

.tp-next-up__text { flex: 1 1 14rem; min-width: 0; }

.tp-next-up__clock {
  font-size: var(--tp-text-3xl);
  font-weight: var(--tp-weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tp-tracking-tight);
  line-height: var(--tp-leading-none);
  color: var(--tp-text-primary);
}

/* ======================================================================
   PACKAGE METER
   ====================================================================== */
.tp-meter {
  display: flex;
  flex-direction: column;
  gap: var(--tp-space-2);
}

.tp-meter__track {
  height: 0.5rem;
  border-radius: var(--tp-radius-pill);
  background: var(--tp-bg-sunken);
  overflow: hidden;
}

.tp-meter__fill {
  height: 100%;
  border-radius: var(--tp-radius-pill);
  background: var(--tp-brand);
  transition: width var(--tp-duration-slow) var(--tp-ease-emphasis);
}

.tp-meter__fill--warning { background: var(--tp-warning); }
.tp-meter__fill--danger  { background: var(--tp-danger); }

.tp-meter__legend {
  display: flex;
  justify-content: space-between;
  gap: var(--tp-space-3);
  font-size: var(--tp-text-xs);
  color: var(--tp-text-muted);
  font-variant-numeric: tabular-nums;
}

/* ======================================================================
   ROSTER ROW
   ====================================================================== */
.tp-roster-row {
  display: flex;
  align-items: center;
  gap: var(--tp-space-3);
  padding: var(--tp-space-3) var(--tp-space-5);
  border-bottom: var(--tp-border-thin) solid var(--tp-border-subtle);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--tp-duration-fast) var(--tp-ease-standard);
}

.tp-roster-row:last-child { border-bottom: 0; }
.tp-roster-row:hover { background: var(--tp-bg-hover); color: inherit; }

.tp-roster-row__text { flex: 1 1 auto; min-width: 0; }

.tp-roster-row__name {
  font-size: var(--tp-text-sm);
  font-weight: var(--tp-weight-semibold);
  color: var(--tp-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-roster-row__meta {
  font-size: var(--tp-text-xs);
  color: var(--tp-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-roster-row__trailing {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--tp-space-3);
}

/* On a phone the package count is the first thing to drop. */
@media (max-width: 30rem) {
  .tp-roster-row__trailing .tp-roster-row__count { display: none; }
}

.tp-roster-row__count {
  font-size: var(--tp-text-xs);
  color: var(--tp-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ======================================================================
   SESSION PLAN
   ====================================================================== */
.tp-plan-block { border-bottom: var(--tp-border-thin) solid var(--tp-border-subtle); }
.tp-plan-block:last-child { border-bottom: 0; }

.tp-plan-block__header {
  display: flex;
  align-items: center;
  gap: var(--tp-space-3);
  padding: var(--tp-space-3) var(--tp-space-5);
  background: var(--tp-bg-surface-alt);
}

.tp-plan-block__title {
  font-size: var(--tp-text-2xs);
  font-weight: var(--tp-weight-semibold);
  letter-spacing: var(--tp-tracking-caps);
  text-transform: uppercase;
  color: var(--tp-text-secondary);
}

.tp-plan-block__count {
  margin-left: auto;
  font-size: var(--tp-text-2xs);
  color: var(--tp-text-muted);
  font-variant-numeric: tabular-nums;
}

.tp-exercise {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--tp-space-2) var(--tp-space-4);
  padding: var(--tp-space-3) var(--tp-space-5);
  border-top: var(--tp-border-thin) solid var(--tp-border-subtle);
}

.tp-exercise:first-of-type { border-top: 0; }

.tp-exercise__name {
  font-size: var(--tp-text-sm);
  font-weight: var(--tp-weight-medium);
  color: var(--tp-text-primary);
}

.tp-exercise__cue {
  grid-column: 1 / -1;
  font-size: var(--tp-text-xs);
  color: var(--tp-text-muted);
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.tp-exercise__cue-icon { width: 0.875rem; height: 0.875rem; margin-top: 0.1rem; }

/* The prescription column: sets x reps, then load. */
.tp-exercise__dose {
  display: flex;
  align-items: baseline;
  gap: var(--tp-space-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tp-exercise__scheme {
  font-size: var(--tp-text-sm);
  font-weight: var(--tp-weight-semibold);
  color: var(--tp-text-primary);
}

.tp-exercise__load {
  font-size: var(--tp-text-xs);
  color: var(--tp-text-secondary);
  padding: 0.1rem var(--tp-space-2);
  border-radius: var(--tp-radius-sm);
  background: var(--tp-bg-sunken);
}

/* ======================================================================
   SPARKLINE
   ====================================================================== */
.tp-sparkline {
  display: block;
  width: 100%;
  height: 2.5rem;
  overflow: visible;
}

.tp-sparkline__line {
  fill: none;
  stroke: var(--tp-brand);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.tp-sparkline__area { fill: var(--tp-brand); opacity: 0.12; }

.tp-sparkline__point {
  fill: var(--tp-bg-surface);
  stroke: var(--tp-brand);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

/* ======================================================================
   DEFINITION LIST - contact details, session facts
   ====================================================================== */
.tp-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
  gap: var(--tp-space-4);
  margin: 0;
}

.tp-fact { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }

.tp-fact__label {
  font-size: var(--tp-text-2xs);
  font-weight: var(--tp-weight-semibold);
  letter-spacing: var(--tp-tracking-caps);
  text-transform: uppercase;
  color: var(--tp-text-muted);
}

.tp-fact__value {
  font-size: var(--tp-text-sm);
  color: var(--tp-text-primary);
  overflow-wrap: anywhere;
}

/* ======================================================================
   CLIENT IDENTITY HEADER
   ====================================================================== */
.tp-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tp-space-4);
}

.tp-identity__text { flex: 1 1 14rem; min-width: 0; }

.tp-identity__name {
  font-size: var(--tp-text-2xl);
  font-weight: var(--tp-weight-semibold);
  letter-spacing: var(--tp-tracking-snug);
  line-height: var(--tp-leading-tight);
  color: var(--tp-text-primary);
}

.tp-identity__sub {
  margin-top: var(--tp-space-1);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tp-space-2) var(--tp-space-3);
  font-size: var(--tp-text-sm);
  color: var(--tp-text-secondary);
}

/* ======================================================================
   BACK LINK
   ====================================================================== */
.tp-back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--tp-space-1);
  margin-bottom: var(--tp-space-3);
  font-size: var(--tp-text-sm);
  font-weight: var(--tp-weight-medium);
  color: var(--tp-text-secondary);
  text-decoration: none;
}

.tp-back-link:hover { color: var(--tp-text-primary); }
.tp-back-link__icon { width: 1rem; height: 1rem; rotate: 180deg; }
