/* participants screen styles (redesign) — builds on assets/css/testflow.css tokens */
/* Also used by the moderators (project_users) and invitations screens. */

.tf-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tf-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tf-muted);
  pointer-events: none;
}

.tf-search .form-control {
  padding-left: 38px;
  min-height: 44px;
}

.tf-toolbar .form-select {
  min-height: 44px;
  width: auto;
}

.tf-toolbar .btn,
.tf-inline-form .btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* Data table */
.tf-table-wrap {
  position: relative; /* contain absolutely positioned helpers (e.g. hidden labels) so they scroll with the table */
  overflow-x: auto;
}

.tf-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 14px;
}

.tf-table th {
  padding: 10px 12px;
  background: var(--tf-surface-2);
  border-bottom: 1px solid var(--tf-divider);
  font-size: 12px;
  font-weight: 600;
  color: var(--tf-muted);
  text-align: left;
  white-space: nowrap;
}

.tf-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--tf-divider);
  vertical-align: middle;
  color: var(--tf-text);
}

.tf-table th:first-child,
.tf-table td:first-child { padding-left: 18px; }

.tf-table th:last-child,
.tf-table td:last-child { padding-right: 18px; }

.tf-table tbody tr:hover { background: var(--tf-surface-2); }

.tf-person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.tf-person .tf-avatar {
  border-radius: 0;
  background: var(--tf-chip);
  color: var(--tf-text);
  font-weight: 700;
  font-size: 12px;
}

.tf-person-name {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--tf-ink);
  text-align: left;
  cursor: pointer;
}

.tf-person-name:hover { color: var(--tf-accent); }

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

.tf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tf-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 0;
  background: var(--tf-chip);
  color: var(--tf-text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tf-row-actions .tf-icon-btn {
  width: 40px;
  height: 40px;
}

/* Profile columns appear only when "Show profile details" is on */
.tf-hide-profile .tf-profile-col { display: none; }

.tf-panel-subbar {
  display: flex;
  justify-content: flex-end;
  padding: 10px 18px;
  border-bottom: 1px solid var(--tf-divider);
  font-size: 14px;
}

/* Assigned tests with whether a session was held */
.tf-test-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tf-test-progress li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tf-ink);
}

.tf-test-progress li > svg { color: var(--tf-muted); }
.tf-test-progress li.is-done > svg { color: var(--tf-success); }

.tf-test-progress-state {
  font-weight: 400;
  color: var(--tf-muted);
}

.tf-next-note {
  font-size: 13px;
  color: var(--tf-muted);
}

.tf-next-note.is-done { color: var(--tf-success-ink); font-weight: 600; }

/* Small labelled actions for questionnaire links */
.tf-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--tf-accent-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.tf-text-btn:hover,
.tf-text-btn:focus-visible { background: var(--tf-accent-soft); color: var(--tf-accent-ink); }

.tf-qlinks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tf-qlink {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
}

.tf-qlink-title {
  font-size: 12px;
  color: var(--tf-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tf-link-actions {
  display: flex;
  gap: 2px;
}

.tf-panel-foot {
  padding: 12px 18px;
  font-size: 13px;
  color: var(--tf-muted);
}

.tf-empty p { margin: 0 0 12px; }

/* Lists (custom fields, team, invites) */
.tf-list > li {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--tf-divider);
}

.tf-list > li:last-child { border-bottom: 0; }

.tf-list-main {
  flex: 1 1 200px;
  min-width: 0;
}

.tf-list-sub {
  display: block;
  font-size: 13px;
  color: var(--tf-muted);
  overflow-wrap: anywhere;
}

.tf-list-aside {
  flex: 2 1 220px;
  color: var(--tf-muted);
  overflow-wrap: anywhere;
}

.tf-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tf-list-actions form { margin: 0; }

.tf-list-actions .btn {
  min-height: 40px;
}

.tf-subhead {
  margin: 0;
  padding: 12px 18px;
  background: var(--tf-surface-2);
  border-top: 1px solid var(--tf-divider);
  border-bottom: 1px solid var(--tf-divider);
  font-family: var(--tf-font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--tf-ink);
}

.tf-pending-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--tf-border-strong);
  color: var(--tf-muted);
}

/* Inline add form */
.tf-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px 18px;
  background: var(--tf-surface-2);
  border-top: 1px solid var(--tf-divider);
  border-radius: 0;
}

.tf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tf-field .form-label {
  margin: 0;
  font-size: 13px;
}

.tf-field .form-control,
.tf-field .form-select {
  min-height: 44px;
}

.tf-field-hint {
  font-weight: 400;
  color: var(--tf-muted);
}

/* Two-column layout (team + invite panel) */
.tf-split {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.tf-split-main {
  flex: 999 1 520px;
  min-width: 0;
}

.tf-split-side {
  flex: 1 1 300px;
  min-width: 0;
}

.tf-side-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Definition list in the participant view modal / detail page */
.tf-dl-grid {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 2fr;
  gap: 0;
}

.tf-dl-grid dt,
.tf-dl-grid dd {
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--tf-divider);
}

.tf-dl-grid dt {
  font-size: 13px;
  font-weight: 600;
  color: var(--tf-muted);
}

.tf-dl-grid dd { color: var(--tf-ink); }

.tf-qlink-card {
  padding: 12px 14px;
  border: 1px solid var(--tf-border);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tf-qlink-card code {
  overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
  .tf-search { max-width: none; }
  .tf-dl-grid { grid-template-columns: 1fr; }
  .tf-dl-grid dt { border-bottom: 0; padding-bottom: 0; }
}

/* ---------- Small screens ---------- */
@media (max-width: 767.98px) {
  /* Toolbar: search and filter take the full width, buttons share a row */
  .tf-panel-head .tf-toolbar { width: 100%; }
  .tf-toolbar .tf-search,
  .tf-toolbar .form-select { flex: 1 1 100%; width: 100%; }
  .tf-toolbar .btn { flex: 1 1 auto; justify-content: center; }
  .tf-toolbar .btn-primary { flex-basis: 100%; order: 5; }

  /* Tables marked tf-table-cards: one card per row, cells stacked with their column name */
  .tf-table-cards { min-width: 0; }
  .tf-table-cards thead { display: none; }
  .tf-table-cards,
  .tf-table-cards tbody,
  .tf-table-cards tr,
  .tf-table-cards td { display: block; width: auto; }
  .tf-table-cards tbody tr {
    position: relative;
    padding: 14px 16px;
    border-bottom: 1px solid var(--tf-divider);
  }
  .tf-table-cards tbody tr:hover { background: transparent; }
  .tf-table-cards td,
  .tf-table-cards td:first-child,
  .tf-table-cards td:last-child { padding: 0; border: 0; }
  .tf-table-cards td + td { margin-top: 10px; }
  .tf-table-cards td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--tf-muted);
  }
  /* Profile details sit on one line each: "Age 22" */
  .tf-table-cards td.tf-profile-col { display: flex; gap: 8px; margin-top: 4px; font-size: 13px; }
  .tf-table-cards td.tf-profile-col::before { margin: 0; min-width: 40%; font-weight: 500; }
  .tf-table-cards.tf-hide-profile td.tf-profile-col { display: none; }
  /* Row actions in the card's top-right corner */
  .tf-table-cards td.tf-cell-actions { position: absolute; top: 8px; right: 8px; margin: 0; }
  .tf-table-cards td:first-child { padding-right: 132px; }
  .tf-table-cards .tf-person { min-width: 0; }
}
