/* Общий контейнер фильтра */
.specialty-filter {
  background-color: #fff;
  padding: 1rem 0;
}

/* Заголовок фильтра */
.specialty-filter h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #4131c3;
  padding: 8px;
  border-bottom: 2px solid #8c142f1c;
}

/* Контейнер переключателя режимов — рамка + фон */
.mode-selection {
  border-radius: 1rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  background-color: #ebedf0;
  border-radius: 5px;
  padding: 10px;
  border: 1px solid #909eb5;
}

/* Группировка радио‑кнопок — вертикальная ориентация */
.form-check-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Каждая радио‑кнопка с подписью */
.form-check {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.form-check:hover label {
  color: #c62828;
}

/* Активное состояние радио‑кнопки */
.form-check input[type="radio"]:checked ~ .form-check-label {
  color: #4a3fa1;
  font-weight: 600;
}

.form-check input[type="radio"]:checked {
  accent-color: #4131c3;
}

/* Подпись к радио‑кнопке */
.form-check-label {
  font-size: 1.05rem;
  color: #495057;
  display: inline-block;
}

/* Стили для селектов (Select2) */
.select2-container .select2-selection {
  border: 2px solid #8d82ff !important;
  border-radius: 0.75rem !important;
  min-height: 48px !important;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.select2-container--focus .select2-selection,
.select2-container--open .select2-selection {
  border-color: #8e82f0 !important;
  box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.1) !important;
}

.select2-container .select2-selection__rendered {
  line-height: 42px !important;
  padding-left: 1rem !important;
  color: #495057;
}

.select2-container .select2-search__field {
  border-radius: 0.75rem !important;
  padding: 0.5rem 1rem !important;
}

.select2-container .select2-results__options {
  font-size: 0.95rem;
  color: #495057;
}

.select2-container .select2-results__option--highlighted {
  background-color: #0d6efd !important;
  color: white !important;
}

/* Отключённое состояние селекта */
.select2-container[disabled] .select2-selection {
  background-color: #e9ecef !important;
  border-color: #dee2e6 !important;
  opacity: 0.6;
}

/* Выравнивание стрелки (стрелочки вниз) по вертикали */
.select2-container .select2-selection__arrow {
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  padding-right: 1.4rem !important; /* Отступ справа от стрелки */
}

/* Выравнивание крестика (очистки выбора) по вертикали */
.select2-container .select2-selection__clear {
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 0.5rem !important; /* Отступы вокруг крестика */
  cursor: pointer;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__placeholder {
  color: #5f56aa;
  font-size: 0.95rem;
}

#selectGroups {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s step-end;
}

#selectGroups.show {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.3s ease,
    visibility 0.3s step-start;
}

#selectGroups label {
  color: #7e4402;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

/* Инструкция */
#instructionBox {
  border-left: 4px solid #4131c3;
  background-color: #e3f2fd;
  color: #1976d2;
  padding: 1rem;
  border-radius: 0.5rem;
  font-size: 1rem;
}

/* Основной контейнер результатов */
#resultsContainer {
  margin-top: 2rem;
}

/* Grid‑контейнер для карточек */
#resultsCards {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

/* Единая карточка результата */
.result-card {
  flex: 0 0 calc(33.333% - 1rem);
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border: 2px solid #624fff42;
  border-radius: 1rem;
  background-color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  text-align: left;
  position: relative;
  overflow: hidden;
}

/* Эффект при наведении на карточку */
.result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  border-color: #8d82ff;
}

/* Заголовок (код специальности) */
.result-card h5 {
  margin: 0 0 0.75rem 0;
  color: #0d6efd;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

/* Название специальности */
.result-card p {
  margin: 0 0 0.3rem 0;
  color: #333;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.5;
  flex-grow: 1;
}

/* Бейдж уровня образования */
.level-badge {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 8px;
  text-align: center;
  margin-top: 0.5rem;
  min-width: 90px;
}

.level-badge.bachelor {
  background-color: #e3f2fd;
  color: #1976d2;
  border: 1px solid #bbdefb;
}

.level-badge.specialist {
  background-color: #ffe0e0;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

/* Индикатор загрузки */
.loader-dots {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  align-items: center;
}

.loader-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background-color: #4131c3;
  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;
  }
}

/* Адаптивность: <768px — 1 карточка в строку */
@media (max-width: 767.98px) {
  .result-card {
    flex: 1 1 100%;
    max-width: 100%;
  }

  .result-card:not(:first-child) {
    margin-top: 0;
  }

  .mode-selection {
    padding: 1rem;
    border-radius: 0.75rem;
  }

  .form-check {
    padding: 0.6rem 0.8rem;
    gap: 0.75rem;
  }

  .select2-container .select2-selection {
    min-height: 44px !important;
    font-size: 0.95rem;
  }

  .select2-container .select2-selection__rendered {
    line-height: 38px !important;
    padding-left: 0.75rem !important;
  }

  .select2-container .select2-search__field {
    padding: 0.4rem 0.75rem !important;
  }
}

/* На экранах 768px–991px — 2 карточки в строку */
@media (min-width: 768px) and (max-width: 991.98px) {
  .result-card {
    flex: 0 0 calc(50% - 0.75rem);
  }

  .mode-selection {
    padding: 1.25rem;
  }

  .select2-container .select2-selection {
    min-height: 46px !important;
  }
}

/* На экранах ≥992px — 3 карточки в строку (базовое состояние) */
@media (min-width: 992px) {
  .result-card {
    flex: 0 0 calc(33.333% - 1rem);
  }

  .mode-selection {
    padding: 1.5rem;
  }
}

/* Дополнительные адаптивные правки для очень маленьких экранов (<576px) */
@media (max-width: 575.98px) {
  .specialty-filter h1 {
    font-size: 1.3rem;
    text-align: center;
  }

  .mode-selection {
    padding: 1.2rem;
    margin-bottom: 1.5rem;
  }

  .form-check-label {
    font-size: 0.95rem;
    margin-left: 0.25rem;
  }

  .select2-container .select2-selection {
    min-height: 42px !important;
    font-size: 0.9rem;
  }

  .select2-container .select2-selection__rendered {
    line-height: 36px !important;
    padding-left: 0.5rem !important;
  }

  #instructionBox {
    padding: 0.75rem;
    font-size: 0.9rem;
  }
}
