* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #f4f7fa;
  font-family: 'Inter', 'Open Sans', sans-serif;
  color: #1e2b37;
  line-height: 1.5;
}

.wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 32px;
}

/* ========== ШАПКА ========== */
.header {
  background: white;
  border-radius: 28px;
  padding: 24px 32px;
  margin-bottom: 28px;
  box-shadow: 0 6px 16px rgba(0,40,20,0.04);
  border: 1px solid #e2e9f2;
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* Новый блок между верхней и средней частью шапки */
.header-message {
  margin: 20px 0 12px 0;
  text-align: left;
  border-top: 1px solid #dde5ed;
  padding-top: 18px;
}

.header-message h2 {
  font-size: 2rem;
  font-weight: 700;
  color: #0a3629;
  margin-bottom: 12px;
  line-height: 1.2;
}

.info-note {
  background: #f0f7fc;
  border: 1px solid #d5e6f1;
  border-radius: 40px;
  padding: 10px 20px;
  display: inline-block;
  font-size: 0.9rem;
  color: #315569;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-area .logo {
  height: 52px;
  width: auto;
}

.logo-area h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #0a3629;
  letter-spacing: -0.02em;
}

.header-contacts {
  display: flex;
  gap: 30px;
  color: #2f4f4b;
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.header-contacts i {
  margin-right: 6px;
  color: #1b6b4f;
}

.header-contacts a {
  color: inherit;
  text-decoration: none;
}

.sub-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #dde5ed;
  padding-top: 18px;
}

.program-count {
  background: #e5f0ea;
  border-radius: 40px;
  padding: 8px 18px;
  font-weight: 500;
  color: #0a3629;
  white-space: nowrap;
}

/* Поле поиска */
.search-wrapper {
  min-width: 280px;
  max-width: 400px;
  flex: 1 1 auto;
  background: #f2f6fc;
  border-radius: 60px;
  border: 1px solid #d2deea;
  padding: 0 4px 0 22px;
  height: 56px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

.search-wrapper input {
  border: none;
  background: transparent;
  padding: 12px 0;
  font-size: 0.95rem;
  flex: 1;
  outline: none;
}

.quick-filters {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

/* Чекбокс "Только бюджет" */
.budget-checkbox-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f2f6fc;
  padding: 0 16px;
  border-radius: 40px;
  border: 1px solid #d2deea;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.2s;
  height: 56px;
  box-sizing: border-box;
}

.budget-checkbox-inline:hover {
  background: #e6eef9;
}

.budget-checkbox-inline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #1b6b4f;
  margin: 0;
}

/* Контейнер ползунка с надписью сверху */
.price-slider-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  padding: 6px 12px;
  height: 56px;
  background: #f2f6fc;
  border-radius: 40px;
  border: 1px solid #d2deea;
  min-width: 280px;
  box-sizing: border-box;
}

/* Надпись "Стоимость обучения" */
.price-slider-container .price-label {
  font-size: 0.7rem;
  color: #0a3629;
  font-weight: 500;
  margin-bottom: 2px;
  padding-left: 2px;
  line-height: 1.2;
}

/* Ряд с ползунком и ценой */
.price-slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Ползунок внутри ряда – занимает всё доступное место */
.price-slider-row #priceSlider {
  flex: 1;
  min-width: 60px;
  width: auto;
  height: 4px;
}

/* Цена внутри ряда – фиксированная ширина по содержимому, с отступом */
.price-slider-row .price-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0a3629;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 8px;
  min-width: auto; /* отменяем фиксированную ширину, если была */
}

/* Стили для noUiSlider (ползунок) */
#priceSlider .noUi-connect {
  background: #1b6b4f;
}

#priceSlider .noUi-handle {
  width: 16px !important;
  height: 16px !important;
  border-radius: 50% !important;
  background: #1b6b4f !important;
  box-shadow: none !important;
  border: 2px solid white !important;
  top: -6px !important;
  right: -8px !important;
}

#priceSlider .noUi-handle::before,
#priceSlider .noUi-handle::after {
  display: none !important;
}

/* ========== ОСНОВНОЙ МАКЕТ ========== */
.main-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 28px;
  align-items: start;
}

/* ===== ФИЛЬТР ===== */
.filter-sidebar {
  background: white;
  border-radius: 28px;
  padding: 24px 18px;
  border: 1px solid #e4ecf3;
  box-shadow: 0 4px 14px rgba(0,30,20,0.02);
  position: sticky;
  top: 20px;
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.filter-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0f3b2c;
}

.reset-btn {
  background: none;
  border: 1px solid #b9ccda;
  border-radius: 30px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1e3f4a;
  cursor: pointer;
}

.reset-btn:hover {
  background: #f1f5f9;
}

.filter-tabs {
  display: flex;
  background: #edf3f9;
  border-radius: 40px;
  padding: 4px;
  margin: 18px 0 20px;
}

.filter-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 40px;
  cursor: pointer;
  transition: 0.2s;
}

.filter-tab.active {
  background: white;
  color: #0f4c3a;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.subject-group h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #557489;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
}

.subject-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.subject-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #1b6b4f;
}

.score-input {
  width: 100px;
  padding: 6px 10px;
  border: 1px solid #d2deea;
  border-radius: 30px;
  font-size: 0.85rem;
  outline: none;
  margin-left: auto;
  display: none;
}

.subject-checkbox input[type="checkbox"]:checked ~ .score-input {
  display: inline-block;
}

.score-input:focus {
  border-color: #1b6b4f;
  box-shadow: 0 0 0 2px rgba(27,107,79,0.1);
}

.score-input.error {
  border-color: #dc3545;
  background-color: #fff8f8;
}

.score-error {
  color: #dc3545;
  font-size: 0.7rem;
  margin-top: 2px;
  margin-left: 26px;
  width: 100%;
}

/* Скрываем старые блоки бюджета и цены в сайдбаре */
.budget-checkbox,
.price-range {
  display: none;
}

/* Достижения */
.achievement-item {
  margin-bottom: 16px;
  padding: 8px;
  border-bottom: 1px solid #e4ecf3;
}

.achievement-main {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  width: 100%;
}

.achievement-checkbox {
  width: 18px;
  flex-shrink: 0;
}

.achievement-title {
  flex: 1;
  text-align: left;
}

.achievement-score {
  color: #1b6b4f;
  font-weight: 700;
  text-align: right;
  min-width: 40px;
  flex-shrink: 0;
}

.achievement-desc {
  font-size: 0.8rem;
  color: #557489;
  margin-left: 30px;
  margin-top: 2px;
}

#achievementsTotal {
  margin-top: 16px;
  padding: 12px;
  background: #e5f0ea;
  border-radius: 30px;
  text-align: center;
  font-weight: 600;
}

/* ===== КАРТОЧКИ ===== */
.program-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.program-card {
  background: white;
  border-radius: 28px;
  padding: 24px;
  border: 1px solid #e4ecf3;
  box-shadow: 0 6px 14px rgba(0,20,10,0.02);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.program-card:hover {
  transform: translateY(-6px);
  border-color: #b8cfde;
  box-shadow: 0 20px 28px -10px rgba(20,80,50,0.25);
}

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f3b2c;
  margin-bottom: 4px;
}

.card-header .profile {
  color: #3f5d70;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.card-meta {
  display: flex;
  gap: 8px;
  margin: 10px 0 16px;
  flex-wrap: wrap;
}

.info-badge {
  background: #f0f7fc;
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  border: 1px solid #d5e6f1;
  display: inline-block;
}

.info-badge i {
  margin-right: 4px;
  font-size: 0.9rem;
}

.card-forms {
  display: flex;
  gap: 8px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.form-badge {
  background: #eaf3fc;
  padding: 6px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: 0.2s;
  border: 1px solid transparent;
}

.form-badge:hover {
  background: #d5e6f1;
}

.form-badge.active {
  background: #1b6b4f;
  color: white;
  border-color: #1b6b4f;
}

.subjects-title {
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  color: #4d6a80;
  font-weight: 600;
  margin-bottom: 12px;
}

.subject-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-bottom: 18px;
}

.subject-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.7rem;
}

.subject-icon i {
  font-size: 1.25rem;
  color: #1b6b4f;
  margin-bottom: 4px;
}

.subject-icon span {
  background: #e5f0ea;
  padding: 4px 8px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  height: 32px;
  line-height: 1;
  box-sizing: border-box;
}

.subject-icon.required i {
  color: #0f4c3a;
  font-weight: 900;
}

.subject-icon.required span {
  background: #c5e0d3;
  font-weight: 700;
}

.subject-icon.required span::before {
  content: "★ ";
  color: #0f4c3a;
  font-size: 0.9rem;
  margin-right: 2px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  background: #f8fcfd;
  border-radius: 20px;
  padding: 16px 12px;
  border: 1px solid #d5e6f1;
  margin: 8px 0 18px;
}

.stat-item {
  text-align: center;
}

.stat-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  color: #5f7f94;
}

.stat-value {
  font-weight: 700;
  font-size: 1.2rem;
  color: #0f3b2c;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.budget-badge {
  background: #c5e0d3;
  color: #0f5c40;
  padding: 6px 14px;
  border-radius: 40px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(27, 107, 79, 0.25);
}

.budget-badge.hidden {
  display: none;
}

.detail-btn {
  background: none;
  border: 1.5px solid #b8cfde;
  padding: 10px 24px;
  border-radius: 40px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.detail-btn:hover {
  background: #0f4c3a;
  border-color: #0f4c3a;
  color: white;
}

/* Сообщение об отсутствии программ */
.no-programs-message {
  grid-column: 1 / -1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 28px;
  padding: 40px;
  text-align: left;
  color: #1e2b37;
  box-shadow: 0 4px 14px rgba(0,30,20,0.02);
}

.no-programs-message h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #0a3629;
  margin-bottom: 12px;
}

.no-programs-message p {
  color: #315569;
  margin-bottom: 24px;
}

.instruction-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 24px;
}

.instruction-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  background: #f0f7fc;
  padding: 10px 24px;
  border-radius: 40px;
  border: 1px solid #d5e6f1;
  width: fit-content;
}

.instruction-item i {
  color: #1b6b4f;
  font-size: 1.2rem;
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,20,15,0.5);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 24px;
  max-width: 1100px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-close {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  border: none;
  background: #f0f7fc;
  color: #1e2b37;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}

.modal-close:hover {
  background: #e0eaf3;
}

.modal-action {
  background: #0f4c3a;
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 40px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.modal-action:hover {
  background: #1b6b4f;
}

.modal-title-block {
  margin-bottom: 24px;
}

.modal-title-block h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: #0a3629;
  margin-bottom: 8px;
  line-height: 1.2;
}

.modal-subtitle {
  font-size: 1rem;
  color: #1b6b4f;
  margin-bottom: 16px;
}

.modal-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.modal-meta .badge {
  background: #e5f0ea;
  padding: 8px 12px;
  border-radius: 40px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-meta .badge i {
  color: #1b6b4f;
  font-size: 1rem;
}

.modal-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.form-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-card:hover {
  border-color: #b8cfde;
  background: #f0f7fc;
}

.form-card.selected {
  border-color: #1b6b4f;
  background: #f0faf5;
}

.form-card .form-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.form-card .form-radio input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: #1b6b4f;
}

.form-stats {
  display: flex;
  gap: 16px;
  color: #4a5b6e;
  font-size: 0.9rem;
}

.form-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 32px 0;
}

.stat-card {
  background: #f8fafc;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid #e2e8f0;
}

.stat-card .stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4a5b6e;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #0a3629;
}

.stat-card .stat-value small {
  font-size: 1rem;
  color: #6b7c8b;
}

.modal-tabs {
  display: flex;
  gap: 32px;
  border-bottom: 2px solid #e2e8f0;
  margin: 32px 0 24px;
}

.modal-tab {
  padding: 8px 0 12px;
  font-weight: 600;
  color: #4a5b6e;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-tab.active {
  color: #0f4c3a;
  border-bottom-color: #1b6b4f;
}

.modal-tab-content {
  display: none;
  line-height: 1.6;
  color: #2d3f4e;
}

.modal-tab-content.active {
  display: block;
}

.modal-tab-content ul {
  margin: 16px 0;
  padding-left: 20px;
}

.modal-tab-content li {
  margin-bottom: 8px;
}

/* подвал */
.footer {
  margin-top: 40px;
  background: white;
  border-radius: 28px;
  padding: 24px 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  border: 1px solid #deeaf3;
  color: #315569;
}

.footer a {
  color: #0a3629;
  text-decoration: none;
  font-weight: 500;
}

.footer a:hover {
  text-decoration: underline;
}

/* ===== АДАПТАЦИЯ ===== */
@media (max-width: 1200px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .filter-sidebar {
    position: static;
    margin-bottom: 20px;
  }
  .subject-checkbox {
    flex-wrap: nowrap;
    align-items: center;
  }
  .score-input {
    width: 70px;
    margin-left: 8px;
    margin-top: 0;
    flex-shrink: 0;
  }
}

@media (max-width: 600px) {
  .subject-checkbox {
    flex-wrap: wrap;
  }
  .score-input {
    width: 100%;
    margin-left: 0;
    margin-top: 4px;
  }
}

@media (max-width: 768px) {
  .wrapper {
    padding: 16px;
  }
  .header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .logo-area {
    flex-direction: column;
    align-items: flex-start;
  }
  .logo-area h1 {
    font-size: 1.2rem;
  }
  .sub-header {
    flex-direction: column;
    align-items: stretch;
  }
  .search-wrapper {
    min-width: 100%;
    max-width: 100%;
  }
  .quick-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .budget-checkbox-inline {
    justify-content: center;
    width: 100%;
  }
  .price-slider-container {
    width: 100%;
  }
  .program-grid {
    grid-template-columns: 1fr;
  }
  .modal-content {
    padding: 20px;
    width: 95%;
  }
  .modal-title-block h2 {
    font-size: 1.8rem;
  }
  .modal-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .modal-forms {
    grid-template-columns: 1fr;
  }
  .modal-tabs {
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .modal-tab {
    white-space: nowrap;
  }
  .search-wrapper,
  .budget-checkbox-inline,
  .price-slider-container {
    height: 52px; /* можно подобрать нужную высоту */
  }
}

@media (max-width: 480px) {
  .header {
    padding: 16px;
  }
  .header-contacts {
    flex-direction: column;
    gap: 8px;
  }
  .program-card {
    padding: 16px;
  }
  .stats-row {
    flex-direction: column;
    gap: 12px;
  }
  .stat-item {
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .stat-value {
    font-size: 1rem;
  }
}