/* Workout Structure — Three-Level Visual Hierarchy
   ================================================
   PARTS (training blocks) → STAGES (segments) → PLANNED VALUES (targets)
   Each level has distinct visual weight and color identity by part type.
   ================================================ */

:root {
  --part-clr-warmup: #16a34a;
  --part-clr-warmup-light: #f0fdf4;
  --part-clr-warmup-border: #bbf7d0;

  --part-clr-main: #dc2626;
  --part-clr-main-light: #fef2f2;
  --part-clr-main-border: #fecaca;

  --part-clr-cooldown: #2563eb;
  --part-clr-cooldown-light: #eff6ff;
  --part-clr-cooldown-border: #bfdbfe;

  --stage-clr-accent: #94a3b8;
  --stage-clr-accent-light: #f8fafc;
}

/* ============================================================ */
/*  LEVEL 1 — PARTS: TRAINING BLOCKS                             */
/*  Rounded cards with color-coded left border & type badge.     */
/* ============================================================ */

.ws-part {
  border-radius: 0.75rem;
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.75rem;
  background: var(--color-panel-main, #ffffff);
  border: 1px solid var(--color-border-light, #e2e8f0);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.15s ease;
  position: relative;
}

.ws-part:hover {
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

/* Color accent by part type */
.ws-part--default  { border-left: 5px solid var(--stage-clr-accent); }
.ws-part--warmup   { border-left: 5px solid var(--part-clr-warmup); }
.ws-part--main     { border-left: 5px solid var(--part-clr-main); }
.ws-part--cooldown { border-left: 5px solid var(--part-clr-cooldown); }

/* Part header row */
.ws-part__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border-light, #e2e8f0);
}

/* Part type — the only place the part's name lives. The badge that used to
   repeat it is gone, so its colour coding moved here: the dropdown is now the
   part's chip, and its text is lowercase.
   The list inside the dropdown shows the same names, lowered the same way. */
.ws-part__type-select {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  line-height: 1.4;
  border: 1.5px solid var(--color-border-light, #e2e8f0);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  background: var(--color-panel-muted, #f8fafc);
  color: var(--color-txt-main, #0f172a);
  cursor: pointer;
}

.ws-part__type-select option {
  text-transform: lowercase;
  font-weight: 700;
}

.ws-part--default .ws-part__type-select   { background: var(--stage-clr-accent-light); color: #475569; border-color: var(--color-border-light); }
.ws-part--warmup .ws-part__type-select    { background: var(--part-clr-warmup-light); color: #15803d; border-color: var(--part-clr-warmup-border); }
.ws-part--main .ws-part__type-select      { background: var(--part-clr-main-light); color: #b91c1c; border-color: var(--part-clr-main-border); }
.ws-part--cooldown .ws-part__type-select  { background: var(--part-clr-cooldown-light); color: #1d4ed8; border-color: var(--part-clr-cooldown-border); }

.ws-part__type-select:focus {
  outline: none;
  border-color: var(--color-border-focus, #6366f1);
  box-shadow: 0 0 0 1.5px var(--color-brand-light, #eef2ff);
}

/* Part duration display */
.ws-part__duration {
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-txt-main, #0f172a);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  padding: 0.2rem 0.6rem;
  background: var(--color-panel-muted, #f8fafc);
  border: 1px solid var(--color-border-light, #e2e8f0);
  border-radius: 0.3rem;
}

/* Part description */
.ws-part__desc {
  background: var(--color-panel-muted, #f8fafc);
  border-radius: 0.5rem;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.5rem;
}

.ws-part__desc textarea {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-txt-main, #0f172a);
  resize: none;
}

.ws-part__desc textarea:focus {
  outline: none;
}

/* Repetition divider */
.ws-part__reps {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
}

.ws-part__reps-line {
  flex: 1;
  height: 0;
  border-top: 1px solid var(--color-border-light, #e2e8f0);
}

.ws-part__reps-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.7rem;
  border-radius: 0.35rem;
  background: var(--color-panel-main, #ffffff);
  border: 1px solid var(--color-border-light, #e2e8f0);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-txt-muted, #64748b);
}

.ws-part__reps-badge input {
  width: 2.2rem;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  background: transparent;
  text-align: center;
  color: var(--color-txt-main, #0f172a);
  padding: 0;
}

.ws-part__reps-badge input:focus {
  outline: none;
}

/* ============================================================ */
/*  LEVEL 2 — STAGES: SEGMENTS WITHIN A PART                     */
/*  Cards with stage number indicator.                           */
/* ============================================================ */

.ws-stage {
  border: 1px solid var(--color-border-light, #e2e8f0);
  border-radius: 0.55rem;
  padding: 0.65rem 0.7rem;
  background: var(--color-panel-main, #ffffff);
  transition: box-shadow 0.12s ease;
  position: relative;
}

.ws-stage:hover {
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.ws-stage__header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.ws-stage__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--stage-clr-accent);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
}

/* Color stage number by parent part type */
.ws-part--default .ws-stage__number   { background: var(--stage-clr-accent); }
.ws-part--warmup .ws-stage__number    { background: var(--part-clr-warmup); }
.ws-part--main .ws-stage__number      { background: var(--part-clr-main); }
.ws-part--cooldown .ws-stage__number  { background: var(--part-clr-cooldown); }

.ws-stage__label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-txt-main, #0f172a);
  opacity: 0.6;
}

.ws-stage__name-input {
  width: 100%;
  border: 1px solid var(--color-border-light, #e2e8f0);
  border-radius: 0.4rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-txt-main, #0f172a);
  background: var(--color-panel-muted, #f8fafc);
}

.ws-stage__name-input:focus {
  outline: none;
  border-color: var(--color-border-focus, #6366f1);
  box-shadow: 0 0 0 1.5px var(--color-brand-light, #eef2ff);
}

.ws-stage__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

/* ============================================================ */
/*  LEVEL 3 — PLANNED VALUES: TARGET METRICS                     */
/*  Bold labels with clear value displays.                       */
/* ============================================================ */

.ws-planned {
  border: 1px solid var(--color-border-light, #e2e8f0);
  border-radius: 0.45rem;
  padding: 0.35rem 0.4rem;
  background: var(--color-panel-main, #ffffff);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

/* Container for planned value fields — stretch single items to full width */
.ws-planned__container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
}

.ws-planned__container > .ws-planned {
  flex: 1 1 0%;
  min-width: 120px;
}

.ws-planned__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-txt-main, #0f172a);
  text-align: center;
  white-space: nowrap;
  opacity: 0.65;
}

.ws-planned__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

/* Value inputs */
.ws-planned__input {
  width: 100%;
  border: 1.5px solid var(--color-border-light, #e2e8f0);
  border-radius: 0.4rem;
  padding: 0.3rem 0.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-txt-main, #0f172a);
  background: var(--color-panel-muted, #f8fafc);
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.ws-planned__input:focus {
  outline: none;
  border-color: var(--color-border-focus, #6366f1);
  box-shadow: 0 0 0 2px var(--color-brand-light, #eef2ff);
}

/* Select fields for zones */
.ws-planned--center {
  justify-content: center;
}
.ws-planned__select {
  width: 100%;
  border: 1.5px solid var(--color-border-light, #e2e8f0);
  border-radius: 0.4rem;
  padding: 0.3rem 0.2rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-txt-main, #0f172a);
  background: var(--color-panel-muted, #f8fafc);
  text-align: center;
}

.ws-planned__select:focus {
  outline: none;
  border-color: var(--color-border-focus, #6366f1);
  box-shadow: 0 0 0 2px var(--color-brand-light, #eef2ff);
}

/* Separator between from/to values */
.ws-planned__sep {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-txt-muted, #64748b);
  flex-shrink: 0;
}

.ws-part__remove {
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #f87171;
  transition: color 0.1s;
  padding: 0.2rem;
}

.ws-part__remove:hover {
  color: #dc2626;
}

/* ============================================================ */
/*  ADD STAGE BUTTON                                             */
/* ============================================================ */

.ws-add-stage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1.5px dashed var(--color-border-light, #e2e8f0);
  border-radius: 0.5rem;
  background: transparent;
  color: var(--color-txt-muted, #64748b);
  cursor: pointer;
  transition: all 0.12s ease;
  width: 100%;
}

.ws-add-stage:hover {
  border-color: var(--color-border-focus, #6366f1);
  color: var(--color-txt-main, #0f172a);
  background: var(--color-brand-light, #eef2ff);
}
