/* ============================================================
   Психологические тесты и скрининги: Стили (2026)
   ============================================================ */

.tests-hero {
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
}
.tests-hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--color-text-main);
  margin: 0 0 10px;
  line-height: 1.2;
}
.tests-hero-desc {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 820px;
  line-height: 1.55;
  margin: 0;
}

/* Навигация по категориям (пилюли) */
.tests-cat-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.test-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--color-bg-subtle);
  color: var(--color-text-main);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--color-border);
  transition: all 0.15s ease;
}
.test-cat-pill:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-bg-surface);
}
.test-cat-pill.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff !important;
}

/* Сетка карточек тестов */
.tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
  margin-bottom: 40px;
}
.test-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.test-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-accent);
  box-shadow: 0 12px 30px rgb(23 107 135 / 0.12);
}
.test-card-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.badge-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-clinical {
  background: color-mix(in srgb, #0284c7 15%, transparent);
  color: #0284c7;
}
.badge-featured {
  background: color-mix(in srgb, #eab308 18%, transparent);
  color: #b45309;
}
.badge-category {
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
}
.test-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin: 0 0 10px;
  line-height: 1.3;
}
.test-card-title a {
  color: inherit;
  text-decoration: none;
}
.test-card-title a:hover {
  color: var(--color-accent);
}
.test-card-annotation {
  font-size: 0.92rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0 0 16px;
  flex-grow: 1;
}
.test-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.test-card-meta {
  display: flex;
  gap: 12px;
}
.test-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff !important;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease;
}
.test-btn:hover {
  background: var(--color-accent-hover);
  text-decoration: none;
}

/* ============================================================
   Страница прохождения теста (test-view.php)
   ============================================================ */
.test-view-container {
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 10px 0 40px;
}
.test-hero-header {
  margin-bottom: 24px;
}
.test-hero-header h1 {
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  font-weight: 800;
  color: var(--color-text-main);
  margin: 10px 0 12px;
  line-height: 1.25;
}
.test-passport {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 24px;
  font-size: 0.92rem;
  line-height: 1.55;
}
.test-passport h3 {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--color-text-main);
}
.test-passport p {
  margin: 0 0 8px;
  color: var(--color-text-muted);
}
.test-passport p:last-child {
  margin-bottom: 0;
}

/* Инструкция */
.test-instruction-box {
  background: var(--color-warning-bg);
  border-left: 4px solid var(--color-warning-border);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 28px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--color-text-main);
}

/* Плавающий прогресс-бар */
.test-progress-wrapper {
  position: sticky;
  top: 74px;
  z-index: 40;
  background: color-mix(in srgb, var(--color-bg-surface) 95%, transparent);
  backdrop-filter: blur(8px);
  padding: 10px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}
.test-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}
.test-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}
.test-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), #0284c7);
  transition: width 0.25s ease;
}

/* Карточка вопроса */
.test-question-item {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease;
}
.test-question-item.is-answered {
  border-color: color-mix(in srgb, var(--color-accent) 40%, var(--color-border));
}
.test-q-num {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.test-q-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-main);
  margin: 0 0 16px;
  line-height: 1.4;
}

/* Опции ответов (радио-карточки) */
.test-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.test-option-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.test-option-label:hover {
  background: var(--color-bg-surface);
  border-color: var(--color-accent);
}
.test-option-label input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-accent);
  margin: 0;
  cursor: pointer;
}
.test-option-label.is-selected {
  background: color-mix(in srgb, var(--color-accent) 12%, var(--color-bg-surface));
  border-color: var(--color-accent);
  font-weight: 600;
  color: var(--color-text-main);
}

/* Кнопка отправки */
.test-submit-area {
  text-align: center;
  margin: 32px 0;
}
.test-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 36px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgb(23 107 135 / 0.25);
  transition: all 0.15s ease;
}
.test-submit-btn:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}
.test-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================
   Блок результатов
   ============================================================ */
.test-result-wrapper {
  background: var(--color-bg-surface);
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 4vw, 36px);
  margin: 30px 0;
  box-shadow: var(--shadow-soft);
  display: none; /* скрыт до расчета */
}
.test-result-wrapper.is-visible {
  display: block;
  animation: fadeInResult 0.35s ease;
}
@keyframes fadeInResult {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.result-badge--normal { background: #dcfce7; color: #15803d; }
.result-badge--mild { background: #fef3c7; color: #b45309; }
.result-badge--moderate { background: #ffedd5; color: #c2410c; }
.result-badge--severe { background: #fee2e2; color: #b91c1c; }

.result-score-title {
  font-size: clamp(1.4rem, 2.5vw, 1.8rem);
  font-weight: 800;
  color: var(--color-text-main);
  margin: 0 0 10px;
}
.result-score-number {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--color-accent);
  margin-bottom: 16px;
}

.result-text-block {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text-main);
  margin-bottom: 20px;
}
.result-recommendations {
  background: var(--color-bg-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 20px 0;
}
.result-recommendations h4 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--color-text-main);
}

/* Разбор подшкал (для Big Five и др.) */
.result-scales-container {
  margin: 24px 0;
}
.result-scale-row {
  margin-bottom: 16px;
}
.result-scale-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.result-scale-bar {
  height: 10px;
  background: var(--color-bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}
.result-scale-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
  border-top: 1px solid var(--color-border);
  padding-top: 18px;
}
.btn-restart {
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--color-bg-subtle);
  color: var(--color-text-main);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--color-border);
  cursor: pointer;
}
.btn-restart:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* FAQ аккордеон */
.test-faq-wrap {
  margin: 40px 0;
  border-top: 1px solid var(--color-border);
  padding-top: 28px;
}
.test-faq-wrap h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 18px;
  color: var(--color-text-main);
}
.test-faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: var(--color-bg-surface);
  overflow: hidden;
}
.test-faq-item summary {
  padding: 14px 18px;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  color: var(--color-text-main);
  background: var(--color-bg-subtle);
}
.test-faq-item summary:hover {
  color: var(--color-accent);
}
.test-faq-body {
  padding: 16px 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}

/* Статьи по теме */
.test-related-articles {
  margin: 36px 0;
  border-top: 1px solid var(--color-border);
  padding-top: 24px;
}
.test-related-articles h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 16px;
}
.related-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.related-article-card {
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-surface);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
}
.related-article-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}
.related-article-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.35;
  color: var(--color-text-main);
}
.related-article-card p {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .tests-grid {
    grid-template-columns: 1fr;
  }
  .test-option-label {
    padding: 14px 16px;
  }
  .test-submit-btn {
    width: 100%;
  }
}

/* The test introduction is content, not the site masthead. */
header.test-hero-header { display: block !important; position: static !important; min-height: 0 !important; height: auto !important; margin: 0 0 24px; padding: 18px 0 24px !important; border-bottom: 1px solid var(--color-border) !important; background: transparent !important; backdrop-filter: none !important; }
.test-hero-header .test-card-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.test-hero-header .badge-tag { white-space: normal; overflow-wrap: normal; word-break: normal; }
.test-hero-header h1 { max-width: 760px; margin: 0 0 14px; font-size: clamp(1.9rem, 4vw, 2.8rem); line-height: 1.15; letter-spacing: -.025em; overflow-wrap: normal; word-break: normal; }
.test-hero-header .tests-hero-desc { max-width: 720px; margin: 0; line-height: 1.65; overflow-wrap: break-word; }
@media (max-width: 600px) { header.test-hero-header { padding: 12px 0 20px !important; } .test-hero-header h1 { font-size: clamp(1.65rem, 7vw, 2.2rem); } }

/* Step-by-step test navigation; without JavaScript the full form remains available. */
.test-view-page [hidden] { display: none !important; }
.is-step-quiz .test-question-item { padding: clamp(22px, 4vw, 34px); border-radius: 16px; }
.is-step-quiz .test-q-num { margin-bottom: 14px; color: var(--color-accent); font-size: .76rem; letter-spacing: .08em; }
.is-step-quiz .test-q-text { margin-bottom: 24px; font: 700 clamp(1.3rem, 2.5vw, 1.7rem)/1.35 var(--font-serif); }
.is-step-quiz .test-option-label { min-height: 56px; border-radius: 10px; }
.test-option-label:focus-within { outline: 3px solid #f0a93b; outline-offset: 2px; }
.test-quiz-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }
.test-quiz-nav button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 24px; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-bg-surface); color: var(--color-text-main); font: 700 .95rem var(--font-sans); cursor: pointer; }
.test-quiz-nav .test-quiz-next { margin-left: auto; border-color: var(--color-accent); background: var(--color-accent); color: var(--color-bg-surface); }
.test-quiz-nav button:disabled { opacity: .5; cursor: not-allowed; }
.is-step-quiz .test-submit-area { text-align: right; margin: 16px 0 32px; }
.test-quiz-status { min-height: 1.4em; margin: 8px 0 0; color: var(--color-text-muted); font-size: .85rem; }
.test-quiz-error { padding: 12px 16px; border: 1px solid var(--color-warning-border); border-radius: 8px; background: var(--color-warning-bg); }
.test-progress-wrapper { top: 0; }
@media (max-width: 600px) { .test-quiz-nav button { flex: 1; padding-inline: 12px; } .is-step-quiz .test-submit-btn { width: 100%; padding-inline: 16px; } }
@media (prefers-reduced-motion: reduce) { .test-progress-fill, .test-option-label { transition: none; } }

.test-before-start { margin: 0 0 18px; padding: 16px 18px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-bg-subtle); color: var(--color-text-main); font-size: .9rem; line-height: 1.55; }
.test-before-start strong { display: block; margin-bottom: 6px; }
.test-before-start p { margin: 0 0 6px; color: var(--color-text-muted); }
.test-before-start p:last-child { margin-bottom: 0; }

/* Catalog search and compact previews. */
.tests-page [hidden] { display: none !important; }
.tests-filter { margin: 0 0 24px; padding: 18px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-bg-subtle); }
.tests-filter label { display: block; margin: 0 0 7px; font-weight: 700; color: var(--color-text-main); }
.tests-filter input { display: block; width: 100%; max-width: 540px; min-height: 48px; padding: 10px 14px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-bg-surface); color: var(--color-text-main); font: inherit; }
.tests-filter p { margin: 8px 0 0; color: var(--color-text-muted); font-size: .86rem; }
.tests-filter-empty { padding: 20px; border: 1px solid var(--color-border); border-radius: 12px; color: var(--color-text-muted); }
.test-card-annotation { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }

/* ==========================================================================
   SEVERITY GAUGE & RESULT ENHANCEMENTS
   ========================================================================== */
.result-gauge-wrap {
  margin: 18px 0 24px;
  padding: 16px;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: 14px;
}

.result-gauge-bar {
  position: relative;
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: visible;
  background: var(--color-border);
}

.result-gauge-zone {
  flex: 1;
  height: 100%;
  transition: opacity 0.2s ease;
}

.result-gauge-zone:first-child {
  border-radius: 999px 0 0 999px;
}

.result-gauge-zone:last-child {
  border-radius: 0 999px 999px 0;
}

.zone--normal { background: #10b981; }
.zone--mild { background: #f59e0b; }
.zone--moderate { background: #f97316; }
.zone--severe { background: #ef4444; }

.result-gauge-pin {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-bg-surface);
  border: 3px solid var(--color-text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-gauge-pin-val {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-text-main);
  line-height: 1;
}

.result-gauge-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* History Box */
.result-history-box {
  margin: 16px 0 20px;
  padding: 14px 18px;
  background: var(--color-bg-subtle);
  border-left: 4px solid var(--color-accent);
  border-radius: 8px;
  font-size: 0.88rem;
}

.history-title {
  font-weight: 700;
  color: var(--color-text-main);
  margin-bottom: 4px;
}

.history-text {
  color: var(--color-text-muted);
  line-height: 1.5;
}

.history-diff.diff-better {
  color: #10b981;
  font-weight: 700;
}

.history-diff.diff-worse {
  color: #f97316;
  font-weight: 700;
}

.history-diff.diff-same {
  color: var(--color-text-muted);
  font-weight: 700;
}

/* Doctor Summary Button */
.btn-copy-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  background: var(--color-bg-surface);
  border: 1.5px solid var(--color-accent);
  color: var(--color-accent);
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-copy-summary:hover {
  background: var(--color-accent);
  color: #fff;
  transform: translateY(-1px);
}

/* Next Recommended Tests */
.result-next-tests {
  margin: 28px 0 20px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.result-next-tests h4 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: var(--color-text-main);
}

.next-tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.next-test-card {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.next-test-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.next-test-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text-main);
  margin-bottom: 6px;
}

.next-test-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

