/* session screen styles (redesign) — builds on assets/css/testflow.css tokens */

/* ---------- Session bar (live task session) ---------- */
.tfs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  margin-bottom: 20px;
  border-radius: 0;
  background: #0F172A;
  color: #CBD2DE;
}

[data-bs-theme=dark] .tfs-bar {
  background: #0A0D13;
  border: 1px solid var(--tf-border);
}

.tfs-bar-title {
  margin: 0;
  font-family: var(--tf-font-display);
  font-size: 18px;
  font-weight: 700;
  color: #FFFFFF;
}

.tfs-bar-sub {
  font-size: 13px;
  color: #CBD2DE;
}

.tfs-bar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tfs-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 0;
  background: #1E293B;
  color: #FFFFFF;
  font-weight: 600;
}

.tfs-chip-code {
  width: 30px;
  height: 30px;
  border-radius: 0;
  background: #334155;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tfs-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 0;
  background: #F04438;
}

.tfs-clock { font-variant-numeric: tabular-nums; }

.tfs-exit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #334155;
  border-radius: 0;
  color: #FFFFFF;
  font-weight: 600;
  text-decoration: none;
}

.tfs-exit:hover {
  background: #1E293B;
  color: #FFFFFF;
}

.tfs-custom {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tfs-custom li {
  padding: 2px 10px;
  border-radius: 0;
  background: #1E293B;
  font-size: 12px;
  color: #E4E7EC;
}

/* ---------- Layout ---------- */
.tfs-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.tfs-steps {
  flex: 1 1 280px;
  min-width: 0;
  position: sticky;
  top: 96px;
}

.tfs-main {
  flex: 999 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- Stepper ---------- */
.tfs-step-list {
  margin: 0;
  padding: 6px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tfs-step-group {
  padding: 10px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tf-muted);
}

.tfs-step {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 6px 10px;
  border-radius: 0;
  color: inherit;
  text-decoration: none;
}

.tfs-step:hover { background: var(--tf-surface-2); color: inherit; }

.tfs-step[aria-current="step"] {
  background: var(--tf-accent-soft);
  box-shadow: inset 3px 0 0 var(--tf-accent);
}

.tfs-step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--tf-chip);
  color: var(--tf-text);
}

.tfs-step[aria-current="step"] .tfs-step-badge {
  background: var(--tf-accent);
  color: var(--tf-on-accent);
}

.tfs-step.is-done .tfs-step-badge {
  background: var(--tf-success);
  color: #FFFFFF;
}

[data-bs-theme=dark] .tfs-step.is-done .tfs-step-badge { color: #0B1020; }

.tfs-step.is-partial .tfs-step-badge {
  background: #F2B54B;
  color: #3A2C10;
}

.tfs-step.is-failed .tfs-step-badge {
  background: var(--tf-danger-soft);
  color: var(--tf-danger);
  box-shadow: inset 0 0 0 1.5px var(--tf-danger);
}

.tfs-step-title {
  display: block;
  font-weight: 600;
  color: var(--tf-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tfs-step-meta {
  display: block;
  font-size: 12px;
  color: var(--tf-muted);
}

/* ---------- Task panel ---------- */
.tfs-task {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tfs-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tf-muted);
}

.tfs-task-title {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.25;
}

.tfs-task-title p { margin: 0; }

.tfs-timer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tfs-timer-value {
  font-family: var(--tf-font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--tf-ink);
  font-variant-numeric: tabular-nums;
  min-width: 4.2ch;
  text-align: right;
}

.tfs-timer-btn {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--tf-ink);
  color: var(--tf-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tfs-timer-btn[aria-pressed="true"] { background: var(--tf-accent); color: var(--tf-on-accent); }

.tfs-read {
  padding: 16px 18px;
  border-radius: 0;
  background: var(--tf-accent-soft);
  border: 1px solid var(--bs-primary-border-subtle, #a4c7df);
  color: var(--tf-ink);
  font-size: 17px;
  line-height: 1.55;
}

[data-bs-theme=dark] .tfs-read { border-color: #2B3A66; }

.tfs-read .tfs-eyebrow { color: var(--tf-accent-ink); margin-bottom: 4px; }

.tfs-read p:last-child,
.tfs-note p:last-child { margin-bottom: 0; }

.tfs-note { color: var(--tf-text); }

.tfs-record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

@media (max-width: 575.98px) {
  .tfs-record-row { grid-template-columns: 1fr; }
}

.tfs-outcomes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

/* Errors counted by the moderator: − [n] + */
.tfs-counter {
  display: flex;
  align-items: stretch;
}

.tfs-counter .btn {
  min-width: 44px;
  min-height: 52px;
  font-size: 20px;
  line-height: 1;
}

.tfs-counter .form-control {
  width: 64px;
  min-height: 52px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  -moz-appearance: textfield;
}

.tfs-counter .form-control::-webkit-inner-spin-button,
.tfs-counter .form-control::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.tfs-outcome {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  border: 1px solid var(--tf-border-strong);
  border-radius: 0;
  background: var(--tf-surface);
  color: var(--tf-text);
  font-weight: 600;
  cursor: pointer;
}

.tfs-outcome input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tfs-outcome:has(input:focus-visible) {
  outline: 2px solid var(--tf-accent);
  outline-offset: 2px;
}

.tfs-outcome.is-success:has(input:checked) {
  background: var(--tf-success-soft);
  color: var(--tf-success-ink);
  border: 2px solid var(--tf-success);
}

.tfs-outcome.is-partial:has(input:checked) {
  background: #FEF6E4;
  color: #7A4E07;
  border: 2px solid #F2B54B;
}

[data-bs-theme=dark] .tfs-outcome.is-partial:has(input:checked) {
  background: #3A2C10;
  color: #F7D38A;
}

.tfs-outcome.is-fail:has(input:checked) {
  background: var(--tf-danger-soft);
  color: var(--tf-danger);
  border: 2px solid var(--tf-danger);
}

.tfs-answer .form-check-label { color: var(--tf-ink); }

.tfs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
}

.tfs-actions .btn { min-height: 48px; }

/* JS shows one task at a time; without JS every task stays visible */
.tfs-js .tfs-task-panel[hidden] { display: none !important; }

/* ---------- Start session & dashboard ---------- */
.tfs-mode {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.tfs-mode-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--tf-border);
  border-radius: 0;
  background: var(--tf-surface);
  cursor: pointer;
}

.tfs-mode-option:has(input:checked) {
  border: 1.5px solid var(--tf-accent);
  background: var(--tf-accent-soft);
}

.tfs-mode-option input { margin-top: 3px; }

.tfs-mode-title {
  display: block;
  font-weight: 600;
  color: var(--tf-ink);
}

.tfs-mode-desc {
  display: block;
  font-size: 13px;
  color: var(--tf-muted);
}

.tfs-test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.tfs-test-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.tfs-people {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tfs-people li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--tf-divider);
}

.tfs-people li:last-child { border-bottom: 0; }

@media (max-width: 991.98px) {
  .tfs-steps { position: static; }
}

/* ---------- Questionnaire sessions (moderator + remote participant) ---------- */
.tfq-wrap {
  max-width: 860px;
  margin: 0 auto;
}

.tfq-group { margin-bottom: 28px; }

.tfq-group-title {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 700;
}

.tfq-question {
  margin: 0 0 14px;
  padding: 18px 20px 20px;
  min-width: 0;
  border: 1px solid var(--tf-border);
  border-radius: 0;
  background: var(--tf-surface);
  transition: border-color 0.15s ease;
}

.tfq-question.is-answered { border-color: color-mix(in srgb, var(--tf-success) 45%, var(--tf-border)); }

.tfq-legend {
  float: left; /* lets the legend sit inside the padded box like a heading */
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 14px;
  padding: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--tf-ink);
}

.tfq-legend + * { clear: both; }

.tfq-num {
  flex-shrink: 0;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tf-chip);
  color: var(--tf-text);
  font-size: 13px;
  font-weight: 700;
}

.tfq-question.is-answered .tfq-num {
  background: var(--tf-success);
  color: var(--tf-surface);
}

.tfq-text { padding-top: 3px; }

.tfq-hint {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--tf-muted);
}

/* Likert / numeric scales */
.tfq-scale {
  display: grid;
  grid-template-columns: repeat(var(--tfq-count, 5), minmax(0, 1fr));
  gap: 8px;
}

.tfq-scale-opt {
  position: relative;
  min-height: 56px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--tf-border-strong);
  border-radius: 0;
  background: var(--tf-surface);
  text-align: center;
  cursor: pointer;
}

.tfq-scale-opt input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.tfq-scale-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--tf-ink);
}

.tfq-scale-label {
  font-size: 12px;
  line-height: 1.3;
  color: var(--tf-muted);
}

.tfq-scale-opt:hover { background: var(--tf-surface-2); }

.tfq-scale-opt:has(input:checked) {
  border: 2px solid var(--tf-accent);
  background: var(--tf-accent-soft);
}

.tfq-scale-opt:has(input:checked) .tfq-scale-value,
.tfq-scale-opt:has(input:checked) .tfq-scale-label { color: var(--tf-accent-ink); }

.tfq-scale-opt:has(input:focus-visible) {
  outline: 2px solid var(--tf-accent);
  outline-offset: 2px;
}

/* Option lists (single/multiple choice) */
.tfq-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tfq-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 14px;
  border: 1px solid var(--tf-border-strong);
  border-radius: 0;
  background: var(--tf-surface);
  color: var(--tf-ink);
  cursor: pointer;
}

.tfq-choice input { flex-shrink: 0; margin: 0; }

.tfq-choice:has(input:checked) {
  border-color: var(--tf-accent);
  background: var(--tf-accent-soft);
}

/* Sticky finish bar */
.tfq-submitbar {
  position: sticky;
  bottom: 12px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border: 1px solid var(--tf-border);
  border-radius: 0;
  background: var(--tf-surface);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
}

.tfq-submitbar-progress {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--tf-ink);
}

/* Start screen bits */
.tfq-remote {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px dashed var(--tf-border-strong);
  border-radius: 0;
  background: var(--tf-surface-2);
}

.tfq-remote.d-none { display: none !important; }

.tfq-seg { position: relative; margin: 0; }

.tfq-seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.tfq-seg span {
  min-width: 64px;
  height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  color: var(--tf-text);
  font-weight: 500;
}

.tfq-seg input:checked + span {
  background: var(--tf-surface);
  color: var(--tf-ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.tfq-seg input:focus-visible + span {
  outline: 2px solid var(--tf-accent);
  outline-offset: 2px;
}

/* Completion (moderator) */
.tfq-done {
  max-width: 560px;
  margin: 24px auto;
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.tfq-done-icon,
.tfq-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tf-accent-soft);
  color: var(--tf-accent-ink);
}

.tfq-done-icon,
.tfq-card-icon.is-done {
  background: var(--tf-success-soft);
  color: var(--tf-success-ink);
}

.tfq-done-title,
.tfq-card-title {
  margin: 6px 0 0;
  font-size: 24px;
  font-weight: 700;
}

/* ---------- Participant (logged-out) pages ---------- */
.tfq-participant-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--tf-bg);
}

.tfq-participant-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  background: var(--tf-surface);
  border-bottom: 1px solid var(--tf-border);
}

.tfq-participant-main {
  flex-grow: 1;
  width: 100%;
  box-sizing: border-box;
  padding: 32px 24px 40px;
}

.tfq-participant-foot {
  padding: 16px 24px;
  font-size: 13px;
  text-align: center;
  color: var(--tf-muted);
}

.tfq-card {
  max-width: 440px;
  margin: 40px auto;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.tfq-card form { width: 100%; margin-top: 8px; }

.tfq-intro { margin-bottom: 24px; }

.tfq-eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tf-muted);
}

.tfq-intro-title {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
}

@media (max-width: 575.98px) {
  /* Long scales stack so every option stays a full-width 48px target */
  .tfq-scale { grid-template-columns: 1fr; }
  .tfq-scale-opt { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 8px 14px; text-align: left; }
  .tfq-scale-value { min-width: 20px; }
  .tfq-question { padding: 16px; }
  .tfq-participant-main { padding: 20px 16px 32px; }
  .tfq-participant-top { padding: 12px 16px; }
}

/* ---------- Live task session on small screens ---------- */
.tfs-steps-toggle { display: none; }

@media (max-width: 991.98px) {
  /* The task list folds into its header: "Task 2 of 6" with a button to open it */
  .tfs-steps .tf-panel-head { display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; }
  .tfs-steps-toggle:not([hidden]) { display: inline-flex; flex-shrink: 0; min-height: 40px; }
  .tfs-js .tfs-steps:not(.is-open) .tfs-step-list,
  .tfs-js .tfs-steps:not(.is-open) .tfs-steps-finish { display: none; }

  .tfs-task { padding: 20px 16px; }

  /* Previous / next stay at the bottom of the screen while the task is in view */
  .tfs-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    flex-wrap: nowrap;
    margin: 0 -16px -20px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--tf-surface);
    border-top: 1px solid var(--tf-border);
  }
  .tfs-actions > * { flex: 1 1 0; justify-content: center; }
  .tfs-actions > span:empty { display: none; }
}
