* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Arial", sans-serif;
}

body {
  background: linear-gradient(135deg, #4131c3 0%, #5e4bf5 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.container-app {
  background: white;
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 620px;
  padding: 40px;
  position: relative;
  overflow: hidden;
}

.screen {
  display: none;
  animation: fadeIn 0.5s ease-in;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  color: #333;
  text-align: center;
  margin-bottom: 20px;
  font-size: 28px;
}

h2 {
  color: #555;
  text-align: center;
  margin-bottom: 15px;
  font-size: 24px;
}

.message {
  margin: 15px 0;
  padding: 10px;
  border-radius: 4px;
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
}

.hidden {
  display: none;
}

.instruction {
  margin: 16px 0;
  padding: 16px 20px;
  border-left: 3px solid #4d90fe;
  background-color: #eef7ff;
  color: #2c3e50;
  font-size: 16px;
  line-height: 1.5;
  border-radius: 0 4px 4px 0;
  box-shadow: 0 1px 3px rgba(77, 144, 254, 0.15);
}

.welcome {
  text-align: center;
  padding: 1.4rem 1rem;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
  position: relative;
  overflow: hidden;
}

.welcome::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><pattern id="pattern" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="%23d1e3f7"/></pattern><rect width="100%" height="100%" fill="url(%23pattern)" /></svg>');
  opacity: 0.1;
  pointer-events: none;
}

.welcome-content {
  margin: 0 auto;
  position: relative;
}

.welcome-message {
  font-size: 1.3rem;
  line-height: 1.4;
  color: #2c3e50;
  margin-bottom: 0;
  font-weight: 500;
  letter-spacing: 0.02em;
  position: relative;
}

.welcome-message::after {
  content: "";
  position: absolute;
  bottom: -0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: #5241e194;
  border-radius: 1.5px;
  opacity: 0;
  transition: opacity 0.4s ease, width 0.4s ease;
}

.welcome-message:hover::after {
  opacity: 1;
  width: calc(100% - 2rem);
}

.university-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.logo-container {
  padding: 0.5rem;
  background: white;
  border-radius: 50%;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
  animation: float 3s ease-in-out infinite;
}

.logo-container img {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border-radius: 50%;
}

.university-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: #5442e4;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  line-height: 1.2;
  text-shadow: 0 2px 4px rgba(41, 128, 185, 0.2);
  margin: 0;
  position: relative;
}

.university-name::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #d33030, transparent);
  opacity: 0.7;
}

.test-info {
  margin-top: 2rem;
  padding: 1.2rem;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.test-description {
  font-size: 1.1rem;
  line-height: 1.5;
  color: #34495e;
  margin: 0;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.test-description strong {
  color: #2980b9;
  font-weight: 700;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  .welcome {
    padding: 1.5rem 1rem;
  }

  .welcome-message,
  .test-description {
    font-size: 1.05rem;
    line-height: 1.4;
  }

  .university-name {
    font-size: 1.25rem;
  }

  .logo-container img {
    width: 120px;
    height: 120px;
  }

  .test-info {
    padding: 1rem;
  }
}

.question {
  margin-bottom: 25px;
  padding: 20px;
  background: #f8f9fa;
  border: 1px solid #667eea;
  border-radius: 12px;
}

.question.has-selection {
  border-color: #28a745;
}

.question.has-error {
  border: 2px solid #dc3545;
  background-color: #f8d7da;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

.question-text {
  font-weight: bold;
  margin-bottom: 15px;
  color: #333;
  font-size: 16px;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #666;
  font-size: 13px;
}

.options {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.option {
  flex: 1;
  text-align: center;
  padding: 12px 5px;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.option:hover {
  border-color: #28a745;
  background: #f0f4ff;
}

.option.selected {
  background: #28a745;
  color: white;
  border-color: #28a745;
}

.buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  gap: 15px;
}

button {
  padding: 15px 30px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}
button[data-nav] {
  width: 100%;
}
button[data-nav]:hover {
  transform: translateY(-2px);
}

.btn-indigo {
  background-color: #3f6dbf;
  color: #ffffff;
  border-color: #3f6dbf;
}
.btn-outline-indigo {
  background-color: #ffffff;
  color: #3f6dbf;
  border-color: #3f6dbf;
}
.btn-indigo:hover,
.btn-indigo:focus,
.btn-indigo:active,
.btn-outline-indigo:hover,
.btn-outline-indigo:focus,
.btn-outline-indigo:active {
  background-color: #2f73ec;
  color: #ffffff;
}

.btn-secondary {
  background: #f8f9fa;
  color: #333;
  border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
  background: #e9ecef;
  color: #333;
  border-color: #e0e0e0;
}

/* Состояние: кнопка активна (enabled) */
button[data-nav="results"].enabled {
  /* background-color: #28a745; */
  box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

button[data-nav="results"].enabled:hover {
  background-color: #218837;
}

button[data-nav="results"].enabled:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(40, 167, 69, 0.15);
}

/* Состояние: кнопка заблокирована (disabled) */
button[data-nav="results"].disabled {
  background-color: #6c757d; /* Серый */
  cursor: not-allowed;
  box-shadow: none;
}

button[data-nav="results"].disabled:hover {
  background-color: #5a6268;
  transform: none;
}

/* Фокус для доступности (клавиатурное управление) */
button[data-nav="results"]:focus {
  outline: 2px solid #0056b3;
  outline-offset: 2px;
}

button[data-nav="results"].disabled:focus {
  outline: 2px dashed #495057;
}

/* Основной контейнер индикатора AJAX загрузки */
.loader-dots {
  display: none; /* Исходное состояние — полностью скрыт */
}

.loader-dots.visible {
  display: flex;
  gap: 0.4rem; /* Уменьшенный отступ между точками */
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease, transform 0.3s ease; /* Плавный переход */
}

/* Каждая точка загрузчика */
.loader-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background-color: #0d6efd;
  animation: pulse 1.2s infinite; /* Анимация пульсации */
}

/* Задержка анимации для создания эффекта "волны" */
.loader-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.loader-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* Анимация: плавное изменение размера и прозрачности */
@keyframes pulse {
  0%,
  100% {
    transform: scale(0.8); /* Уменьшение в начале и конце цикла */
    opacity: 0.6; /* Полупрозрачность в крайних точках */
  }
  50% {
    transform: scale(1.2); /* Увеличение в середине цикла */
    opacity: 1; /* Полная непрозрачность в пике */
  }
}

.progress-container {
  margin-bottom: 32px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #495057;
  font-size: 14px;
  font-weight: 500;
}

.progress-percent {
  color: #007bff;
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background-color: #e9ecef;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.progress {
  height: 100%;
  background: linear-gradient(90deg, #0069d9, #007bff);
  border-radius: 6px;
  transition: width 0.4s ease-in-out;
  width: 0%;
}

.result-item {
  background-color: #f8f9fa;
  padding: 20px;
  margin-bottom: 24px;
  border-radius: 12px;
  border: 1px solid #667eeae3;
}
.result-item.result-error {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.result-title {
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.result-description {
  line-height: 1.5;
  font-size: 16px;
  color: #2c3e50;
  margin-bottom: 0px;
}

.result-profile-name {
  color: #3037a9;
  font-weight: 700;
}

.result-description ol {
  margin-left: 20px;
}

.form-group {
  margin-bottom: 15px;
}

input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
}

input:focus {
  outline: none;
  border-color: #667eea;
}

.thinking-progress-container {
  max-width: 300px;
}
.thinking-type {
  margin: 0 0 8px 0;
  font-size: 1rem;
  color: #dc1e1e;
  font-weight: 700;
}

.thinking-progress-bar {
  width: 100%;
  height: 12px;
  background-color: #e9e9e9;
  border-radius: 6px;
  overflow: hidden;
}

.thinking-progress-fill {
  height: 100%;
  background-color: #2ecc71;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.thinking-progress-label {
  margin: 8px 0 0 0;
  font-size: 1rem;
  color: #7f8c8d;
  text-align: right;
}

/* Контейнер для номера и названия */
.professions-item__header {
  display: flex;
  flex-grow: 1; /* Занимает всё доступное пространство */
  flex-direction: row;
  align-items: center;
}

/* Адаптация для мобильных */
@media (max-width: 767.98px) {
  .professions-item__header {
    flex-direction: row; /* Остаётся в строке на мобильных */
    gap: 1rem; /* Отступ между номером и названием */
    margin-bottom: 0.75rem;
  }

  .professions-item__number,
  .professions-item__name {
    margin-bottom: 0; /* Убираем лишние отступы */
  }
}

/* Для десктопов — сохраняем текущую логику */
@media (min-width: 768px) {
  .professions-item__header {
    margin-right: 1rem; /* Отступ перед кнопкой */
  }
}

/* === БЛОК ПРОФЕССИЙ (основной список и модалки) === */

/* Контейнер элемента профессии */
.professions-item {
  position: relative;
  padding: 0.75rem 1rem;
}

/* Модификатор: приоритетное направление */
.professions-item--priority .professions-item__number {
  background-color: #ff5722; /* Оранжевый для приоритета */
}

.professions-item--priority .professions-item__name {
  color: #ad3711;
  font-weight: 600;
}

/* Заголовок элемента (номер + название) */
.professions-item__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
}

/* Номер направления */
.professions-item__number {
  background-color: #007bff;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  flex-shrink: 0; /* Не сжимаем номер */
  align-items: center;
  font-weight: bold;
  font-size: 14px;
}

/* Название направления */
.professions-item__name {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
  word-wrap: break-word; /* Разрешаем перенос слов */
  flex: 1; /* Занимаем всё оставшееся место */
}

/* Управление (кнопка "Посмотреть специальности") */
.professions-item__control {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
  align-items: center; /* Вертикальное центрирование кнопки */
}

.professions-item__control button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.375rem 0.75rem;
  transition: all 0.2s ease;
  border: 1px solid #007bff;
  background-color: transparent;
  color: #007bff;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap; /* Запрещаем перенос текста в кнопке */
}

.professions-item__control button:hover {
  background-color: #007bff;
  color: white;
}

/* === МОДАЛЬНОЕ ОКНО === */

/* Заголовник модалки */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #dee2e6;
}

/* Кнопка закрытия */
.modal-header .close {
  float: right;
  font-size: 1.5rem;
  font-weight: normal;
  line-height: 1;
  color: #000;
  text-shadow: 0 1px 0 #fff;
  opacity: 0.5;
}

.modal-header .close:hover {
  opacity: 1;
}

/* Тело модального окна */
.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

/* Список специальностей */
.specialty-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Элемент списка специальностей */
.specialty-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
}

/* Код специальности */
.specialty-code {
  background-color: #f8f9fa;
  color: #495057;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
  min-width: 60px;
  text-align: center;
}

/* Название специальности */
.specialty-name {
  flex: 1;
  margin: 0;
  font-size: 1rem;
  color: #212529;
}

/* Ссылки внутри модалки */
.modal-body a {
  color: #007bff;
  text-decoration: none;
}

.modal-body a:hover {
  color: #0056b3;
  text-decoration: underline;
}

/* Дополнительные стили для адаптивности */
@media (max-width: 767.98px) {
  .professions-item__header {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    width: 100%;
  }

  .professions-item__number {
    width: 32px;
    height: 32px;
    margin: 0;
    text-align: center;
  }

  .professions-item__name {
    margin: 0;
    width: 100%; /* Название занимает всю ширину */
    text-align: center;
  }

  .professions-item__control {
    margin-top: 0.5rem;
    justify-content: center;
    padding: 0 1rem;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container-app {
    padding: 20px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  button {
    padding: 12px 20px;
    font-size: 14px;
  }

  .option {
    padding: 10px 3px;
    font-size: 14px;
  }
}
