/* The workout editor's verdict marks (Components::SyntaxHighlightedTextarea
   with the live preview's Components::EditorVerdict). The colouring itself
   is the legacy syntax_highlight.css. */

/* The workout form's editor reads as the workout itself: the page's own
   type at a reading size and an open line pitch
   (Components::SyntaxHighlightedTextarea with prose: true). On the editor's
   inner box, so it sets what the legacy container's monospace hands down. */
.workout-editor-prose {
  font-family: var(--font-sans);
  font-size: var(--text-lg);
  line-height: 2.125;
}

/* Quantities in bold and loads in italic, as the workout reads when it is
   printed (Jim, 2026-12-03). The colours stay in the legacy
   syntax_highlight.css, whose colour-only rule this lifts for these two:
   CodeMirror lays the text out itself, so a mark's weight or style no longer
   has to keep the width of a textarea underneath. */
.hl-quantity {
  font-weight: 700;
}

.hl-condition {
  font-style: italic;
}

/* A movement the preview could not find in the gym's library, marked where
   it is typed: a soft danger ground under danger ink, never a change of
   weight or spacing, so the text keeps its width. The Live Details alert
   for the same movement takes the same tone. */
.hl-unknown {
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger-ink);
}

/* A movement the library has with no profile, marked where it is typed: a
   soft caution ground under caution ink, the tone of its Live Details box
   (Components::MovementAlerts). */
.hl-unprofiled {
  border-radius: var(--radius-sm);
  background: var(--caution-soft);
  color: var(--caution-ink);
}

/* A load the gym's standards do not hold (a pair like 95/60), outlined
   where it is typed in the tone of its movement's Live Details box
   (Components::MovementAlerts). An outline and a ground, so the load keeps
   its own colour and its width. */
.hl-flagged {
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  outline: var(--line-width) solid var(--danger);
}

/* A line the parser warned about (a movement in a timed window with no rep
   count), marked whole where it is typed: a wavy caution underline, the
   warning as the title, so it reads apart from the unknown movement's
   danger ground. The preview's warnings list says the same. */
.hl-warned {
  text-decoration: underline wavy var(--caution);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* The autocomplete's row for a movement the preview could not find
   (description_autocomplete_controller.js): its badge in the same danger
   tone as the mark above. The row and badge shapes are the legacy
   description_autocomplete.css. */
.autocomplete-badge-unknown {
  color: var(--danger-ink);
  background-color: var(--danger-soft);
}

/* The unknown row wraps: badge and name on one line, the notice and offer
   on the next, where a plain row's hint is cut to one line. */
.autocomplete-item-unknown {
  flex-wrap: wrap;
}

.autocomplete-hint-unknown {
  flex-basis: 100%;
  white-space: normal;
}

/* The workout form's Scoring select and what it says about where its value
   came from (Views::WorkoutDescriptions::PreviewableForm). The select can
   shrink to fit beside Stimulus in the builder's narrow column; the
   "From description" chip wraps under it when there is no room. */
.scoring-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.scoring-select {
  flex: 1 1 6rem;
  min-width: 0;
  transition: background-color 600ms;
}

/* The select just took the scoring the description states
   (workout_live_preview_controller#syncStatedScoring). */
.scoring-select[data-synced] {
  background-color: var(--accent-fill);
}

@media (prefers-reduced-motion: reduce) {
  .scoring-select {
    transition: none;
  }
}

/* The folded Program, Category, Movement prep and Benchmark: its closed
   line reads their values. */
.workout-fields-fold {
  min-width: 0;
}

/* A movement that comes round again (Planning::LineRepeats, by
   Planning::RepeatTone's gap): the editor marks the whole line typed, the
   sentence as its title (workout:repeat-marks, from Components::RepeatMarks);
   the sentence itself is in the movement's box (Components::MovementAlerts).
   The tones differ by more than hue: danger (the same movement back to back)
   is bold on a solid underline; caution (two or three days apart, a pattern
   the day before or after, a movement like one just programmed) a dashed
   one; quiet (the same movement four to six days away) a thin dotted one.
   The syntax colours stay under all three. */
.hl-repeat-danger {
  font-weight: 700;
  text-decoration: underline solid var(--danger);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.hl-repeat-caution {
  text-decoration: underline dashed var(--caution-ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.hl-repeat-quiet {
  text-decoration: underline dotted var(--ink-muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* The equipment the workout needs, first in the workout form's Live Details
   (Views::WorkoutPreviews::PreviewContent with details: true): one wrapping
   line at the panel's own edge, with no box of its own. */
.preview-equipment {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  font-size: var(--text-md);
}

/* The boxes for the movements that need the coach (Components::MovementAlerts),
   set off from the equipment line above and the estimate below. */
.movement-alerts {
  margin: var(--space-2) 0 var(--space-3);
}

/* The live check's rows under everything else in the live preview
   (Views::WorkoutPreviews::WarningsSection): a footer set off by a rule,
   not a box of its own. */
.preview-checks {
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: var(--line-width) solid var(--line);
}

/* The form's head across both columns (PreviewableForm#render_form_head):
   the form's own box is dropped so its head and its panel are the grid's
   items, the head spanning the editor and the preview. */
.workout-editor-form {
  display: contents;
}

.workout-editor-head {
  grid-column: 1 / -1;
  display: grid;
  gap: var(--space-3);
}

/* Name takes the room; Scoring its longest option, "For Rounds + Reps". */
.workout-editor-head-fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(12rem, 1fr);
  gap: var(--space-3);
  align-items: start;
}

@media (max-width: 768px) {
  .workout-editor-head-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
  }
}

/* The Name input with its Name ideas button after it. */
.workout-editor-name {
  display: flex;
  align-items: center;
}

.name-suggestions {
  flex: none;
}

/* Name ideas, a popover beside the Name input
   (Components::NameSuggestionsPopover). */
.name-suggestions-panel {
  width: min(24rem, calc(100vw - 2 * var(--space-2)));
  padding: var(--space-3);
}

.name-suggestions-status {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  margin: 0 0 var(--space-1);
}

/* An empty status must not reserve a row between the summary and pills. */
.name-suggestions-status:empty {
  display: none;
}

.name-suggestions-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-1);
}

.suggestion-pill {
  border: var(--line-width) solid var(--line);
  background: var(--surface);
  /* Pin text color and shadow in every state: global button hover rules
     (.btn) otherwise flip the text white on a light background. */
  color: var(--ink);
  text-shadow: none;
  border-radius: 999px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-md);
  font-weight: 600;
  text-align: center;
  display: inline-block;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.suggestion-pill:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  text-shadow: none;
  transform: scale(1.05);
  box-shadow: var(--shadow);
}

.suggestion-pill:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* The pill whose name the field now holds. */
.suggestion-pill-applied {
  border-color: var(--good);
  background: var(--good-soft);
  color: var(--ink);
}

.name-suggestions-more {
  border: none;
  background: none;
  color: var(--accent-ink);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 0 var(--space-1);
}

.name-suggestions-more:hover {
  text-decoration: underline;
}

.name-suggestions-more:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .suggestion-pill[data-entering] {
    animation: name-suggestion-pill-in 0.18s ease both;
  }

  @keyframes name-suggestion-pill-in {
    from {
      opacity: 0;
      transform: translateY(var(--space-1));
    }
  }
}

/* The live preview's loading ring, shown over the pane while a refresh is
   in flight (workout_live_preview_controller.js). */
.preview-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--surface-sunken);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: preview-spinner-turn 1s linear infinite;
}

@keyframes preview-spinner-turn {
  to {
    transform: rotate(360deg);
  }
}
