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

/* ---------- Test detail: header ---------- */
.tf-test-header {
  margin-bottom: 20px;
}

.tf-test-header-top {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px 8px;
}

.tf-test-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 320px;
}

.tf-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  min-height: 32px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tf-muted);
  text-decoration: none;
}

.tf-back-link:hover { color: var(--tf-accent); }

.tf-test-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.tf-test-meta {
  margin: 0;
  font-size: 13px;
  color: var(--tf-muted);
}

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

.tf-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0 8px 0 0;
  padding-left: 0;
}

.tf-switch .form-check-input {
  float: none;
  margin: 0;
}

.tf-switch .form-check-label {
  font-weight: 500;
  color: var(--tf-text);
}

.tf-test-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0 12px;
  overflow-x: auto;
  border-top: 1px solid var(--tf-divider);
}

.tf-test-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--tf-text);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.tf-test-tab:hover { color: var(--tf-ink); }

.tf-test-tab.active {
  border-bottom-color: var(--tf-accent);
  color: var(--tf-ink);
  font-weight: 600;
}

/* ---------- Test detail: body ---------- */
.tf-test-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.tf-test-main {
  flex: 999 1 520px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tf-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px 10px 6px;
  border-bottom: 1px solid var(--tf-divider);
  background: var(--tf-surface-2);
  border-radius: 0;
}

.tf-group-title {
  margin: 0;
  font-family: var(--tf-font);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--tf-ink);
  overflow-wrap: anywhere;
}

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

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

.tf-drag {
  width: 36px;
  min-height: 44px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tf-subtle);
  cursor: grab;
}

.tf-drag:active { cursor: grabbing; }

.tf-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tf-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 6px;
  border-bottom: 1px solid var(--tf-divider);
  background: var(--tf-surface);
}

.tf-row.is-selected {
  background: var(--tf-accent-soft);
  box-shadow: inset 3px 0 0 var(--tf-accent);
}

.tf-row-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tf-num {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  background: var(--tf-chip);
  color: var(--tf-text);
  font-size: 12px;
  font-weight: 600;
}

.tf-row.is-selected .tf-num {
  background: var(--tf-accent);
  color: var(--tf-on-accent);
}

.tf-row-title {
  display: block;
  font-weight: 600;
  color: var(--tf-ink);
  overflow-wrap: anywhere;
}

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

.tf-empty-row {
  margin: 0;
  padding: 16px 18px;
  color: var(--tf-muted);
}

.tf-group-foot {
  padding: 6px 10px;
}

.tf-add-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 8px;
  color: var(--tf-accent) !important;
  font-weight: 600;
  text-decoration: none;
}

.tf-empty p { margin: 0; }

.tf-add-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  margin-top: 16px;
  border: 1.5px dashed var(--tf-border-strong);
  border-radius: 0;
  background: var(--tf-surface-2);
  color: var(--tf-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tf-test-main .tf-add-block { margin-top: 0; }

.tf-add-block:hover {
  border-color: var(--tf-accent);
  color: var(--tf-accent);
}

.tf-dropdown {
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--tf-border);
  border-radius: 0;
  background: var(--tf-surface);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
}

.tf-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border-radius: 0;
  color: var(--tf-text);
  font-weight: 500;
}

.tf-dropdown .dropdown-item:hover,
.tf-dropdown .dropdown-item:focus {
  background: var(--tf-chip);
  color: var(--tf-ink);
}

.tf-dropdown .dropdown-divider { border-color: var(--tf-divider); }

/* Anchor targets used by redirects (#questionnaire-group<ID>) */
.tf-anchor {
  display: block;
  position: relative;
  top: -96px;
}

/* ---------- Task inspector ---------- */
.tf-inspector {
  flex: 1 1 320px;
  min-width: 0;
  position: sticky;
  top: 96px;
}

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

.tf-dl {
  margin: 0;
  padding: 4px 18px 16px;
}

.tf-dl > div {
  padding: 12px 0;
  border-bottom: 1px solid var(--tf-divider);
}

.tf-dl > div:last-child { border-bottom: 0; }

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

.tf-dl dd {
  margin: 6px 0 0;
  color: var(--tf-ink);
}

.tf-rich { overflow-wrap: anywhere; }
.tf-rich > :last-child { margin-bottom: 0; }
.tf-rich ul,
.tf-rich ol { padding-left: 1.25rem; }

/* ---------- Description tab ---------- */
.tf-description {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 22px;
}

.tf-description-text {
  flex: 3 1 360px;
  min-width: 0;
}

.tf-description-image {
  flex: 2 1 280px;
  min-width: 0;
}

.tf-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--tf-border);
  border-radius: 0;
  overflow: hidden;
  background: var(--tf-chip);
  cursor: zoom-in;
}

.tf-image-button img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Tests list (project Tests tab) ---------- */
.tf-tests-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.tf-tests-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.tf-tests-head p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--tf-muted);
}

.tf-test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

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

.tf-test-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tf-test-card h3 {
  margin: 0;
  font-family: var(--tf-font);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}

.tf-test-card h3 a {
  color: var(--tf-ink);
  text-decoration: none;
}

.tf-test-card h3 a:hover { color: var(--tf-accent); }

.tf-test-card-desc {
  margin: 0;
  color: var(--tf-muted);
  overflow-wrap: anywhere;
}

.tf-test-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--tf-text);
}

.tf-test-counts strong {
  color: var(--tf-ink);
  font-weight: 600;
}

.tf-test-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--tf-divider);
}

.tf-test-card-actions .btn { flex: 1 1 auto; }

.tf-dropdown .tf-switch {
  min-height: 40px;
  margin: 0;
  padding: 0 12px;
}

@media (max-width: 575.98px) {
  .tf-test-header-top { padding: 16px; }
  .tf-row { flex-wrap: wrap; }
  .tf-row-main { flex-basis: calc(100% - 44px); }
  .tf-row-actions { margin-left: 40px; }
  .tf-inspector { position: static; }
}
