/*
 * Testing tab, Settings tab and the FTP test result card.
 * Loaded after theme-refresh.css (uses its tokens) and before mobile.css.
 */

/* ---------- settings ---------- */

.settings-panel,
.testing-panel { max-width: 860px; }

.settings-group { margin: 0 0 26px; }

.settings-group h3 {
  margin: 0 0 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.settings-label { min-width: 0; flex: 1 1 auto; }
.settings-label strong { display: block; font-size: 0.95rem; }
.settings-label small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }

.settings-control { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.settings-note { margin: 10px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }

.ftp-control input {
  width: 84px;
  min-height: 38px;
  padding: 6px 10px;
  text-align: right;
  font-weight: 700;
}
.ftp-control .unit { color: var(--muted); font-weight: 600; }

.settings-toggle { cursor: pointer; user-select: none; }
.settings-toggle input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.settings-toggle .switch {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--line);
  position: relative;
  flex: 0 0 auto;
  transition: background 0.15s;
}
.settings-toggle .switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.settings-toggle input:checked + .switch { background: var(--accent); }
.settings-toggle input:checked + .switch::after { transform: translateX(18px); }
.settings-toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- testing ---------- */

.testing-intro { margin: 0 0 16px; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

.testing-list { display: grid; gap: 12px; }

.test-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.test-card.open { border-color: var(--accent); }

.test-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}
.test-card-title { min-width: 0; }
.test-card-title strong { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 1rem; }
.test-card-title small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }

.test-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.test-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; color: var(--muted); font-size: 0.78rem; font-weight: 600; }

.test-detail { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.test-detail h4 {
  margin: 16px 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.test-detail p { margin: 0 0 6px; font-size: 0.88rem; line-height: 1.5; }
.test-detail ul { margin: 0; padding-left: 18px; font-size: 0.88rem; line-height: 1.55; }
.test-detail .workout-profile { margin-top: 14px; }
.test-detail-actions { display: flex; justify-content: flex-end; margin-top: 16px; }

.testing-recent { margin-top: 22px; }
.testing-recent h3 {
  margin: 0 0 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.testing-recent-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.testing-recent-row span:last-child { color: var(--muted); }

/* ---------- FTP test result (completion screen) ---------- */

.test-result {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.test-result h3 { margin: 0 0 4px; font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-dark); }
.test-result-value { display: flex; align-items: baseline; gap: 8px; margin: 4px 0; }
.test-result-value strong { font-size: 2.6rem; line-height: 1; }
.test-result-value span { color: var(--muted); font-weight: 600; }
.test-result p { margin: 4px 0; font-size: 0.88rem; line-height: 1.5; }
.test-result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.test-result.warn { border-color: var(--amber); background: transparent; }
.test-result.warn h3 { color: var(--amber); }

/* ---------- RPE survey (completion screen) ---------- */

.rpe-survey { margin: 18px 0; }
.rpe-survey h3 { margin: 0 0 2px; font-size: 1rem; }
.rpe-survey > p { margin: 0 0 12px; color: var(--muted); font-size: 0.85rem; }
.rpe-options { display: grid; gap: 8px; }
.rpe-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.rpe-option:hover { border-color: var(--accent); }
.rpe-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.rpe-number {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface-2);
  font-weight: 800;
}
.rpe-option.selected .rpe-number { background: var(--accent); color: #fff; }
.rpe-option strong { display: block; font-size: 0.95rem; }
.rpe-option small { display: block; margin-top: 1px; color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.rpe-status { margin: 8px 0 0; min-height: 1.2em; }

@media (max-width: 640px) {
  .settings-row { align-items: flex-start; flex-wrap: wrap; }
  .settings-control { width: 100%; justify-content: flex-end; }
  .settings-toggle .settings-control { width: auto; margin-left: auto; }
  .test-card-head { flex-wrap: wrap; }
  .test-card-head > button { width: 100%; }
  .test-result-actions button { flex: 1 1 100%; }
}
