:root {
  --primary-dark: #0b8fd1;
  --text: #13233a;
  --muted: #5b6b7d;
  --bg: #f5f9fc;
  --white: #fff;
  --radius: 28px;
  --shadow: 0 20px 60px rgba(22, 54, 92, 0.12);
  --transition: 0.25s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background: #fff;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input {
  font: inherit;
}

.container {
  width: min(1200px, calc(100% - 40px));
  margin: auto;
}

/* ===== OPEN LESSON ===== */
.open-lesson {
  padding: 90px 0;
  background: var(--bg);
  color-scheme: light;
}

.open-lesson__wrapper {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 60px;
  align-items: center;
  background: #fff;
  border-radius: 40px;
  padding: 20px 0 0 70px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.open-lesson__label {
  display: inline-block;
  padding: 10px 10px;
  border-radius: 99px;
  background: #1189bf;
  font-family:
    "Nunito",
    system-ui,
    -apple-system,
    sans-serif;
  text-transform: uppercase;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
}

.open-lesson__label-second {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 99px;
  font-family:
    "Nunito",
    system-ui,
    -apple-system,
    sans-serif;
  text-transform: uppercase;
  color: #1189bf;
  font-weight: 700;
  font-size: 22px;
}

.open-lesson__title {
  font-family:
    "Nunito",
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 42px;
  color: #1189bf;
  line-height: 1.05;
  margin: 22px 0;
}

.open-lesson__title-highlight {
  font-family:
    "Nunito",
    system-ui,
    -apple-system,
    sans-serif;
  font-weight: 900;
  font-size: 56px;
  text-transform: uppercase;
  color: #0f3077;
}

.open-lesson__description {
  font-size: 20px;
  line-height: 1.7;
  color: #000;
  max-width: 540px;
}

.open-lesson__text-container {
  display: flex;
  gap: 20px;
  flex-wrap: nowrap;
}

.open-lesson__button {
  margin-top: 40px;
  border: none;
  background: #fdbd24;
  color: #000;
  min-width: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 34px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  line-height: 1.2;
}

.open-lesson__button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.open-lesson__button svg {
  transition: 0.3s;
  flex-shrink: 0;
}

.open-lesson__button:hover svg {
  transform: translateX(4px);
}

.open-lesson__image {
  position: relative;
  display: flex;
  justify-content: center;
}

.open-lesson__photo {
  position: relative;
  z-index: 2;
  width: 530px;
  max-width: 100%;
}

/* ===== MODALS ===== */
.success-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.lesson-modal.is-open,
.success-modal.is-open {
  display: flex;
}

.success-modal__window {
  position: relative;
  background: #fff;
  border-radius: 28px;
  box-shadow: var(--shadow);
  z-index: 2;
  color-scheme: light;
  color: #13233a;
  padding: 50px;
  text-align: center;
  width: min(420px, 90%);
}

.lesson-modal__title {
  font-size: 40px;
  margin: 0 0 10px;
}

.lesson-modal__subtitle {
  color: var(--muted);
  margin-bottom: 28px;
}

/* ===== CALENDAR ===== */
.calendar {
  border: 1px solid #e8edf3;
  border-radius: 20px;
  padding: 20px;
}

.calendar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.calendar__prev,
.calendar__next {
  border: none;
  background: #eef7fd;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.calendar__weekdays,
.calendar__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar__weekdays span {
  text-align: center;
  font-size: 13px;
  color: #7a8b9d;
}

.calendar__days button {
  height: 42px;
  border: none;
  border-radius: 12px;
  background: #f4f7fa;
  cursor: pointer;
  font-size: 15px;
}

.calendar__days button.active {
  background: var(--primary-dark);
  color: #fff;
}

.calendar__days button.available {
  outline: 2px solid #9adfff;
}

.selected-date {
  margin-top: 20px;
  padding: 16px;
  background: #f7fbfe;
  border-radius: 16px;
}

/* ===== FORM ===== */
.lesson-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid #d7e1ea;
  border-radius: 14px;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6b7d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.form-group input {
  background-image: none;
  padding-right: 16px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-dark);
}

.lesson-info {
  display: flex;
  gap: 18px;
  padding: 24px;
  background: #f7fbfe;
  border-radius: 20px;
}

.lesson-info__icon img {
  width: 56px;
}

.lesson-info ul {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.lesson-info li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.lesson-info li img {
  width: 18px;
  margin-top: 2px;
}

.lesson-form__submit {
  border: none;
  background: var(--primary-dark);
  color: #fff;
  padding: 18px;
  border-radius: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.lesson-form__submit:hover {
  background: #0a7ab5;
}

.success-modal__window h3 {
  margin: 0 0 12px;
  font-size: 24px;
  color: #13233a;
}

.success-modal__window p {
  margin: 0 0 24px;
  color: #13233a;
  font-size: 16px;
  line-height: 1.5;
}

.success-modal__button {
  border: none;
  background: var(--primary-dark);
  color: #fff;
  padding: 14px 36px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.success-modal__button:hover {
  background: #0a7ab5;
}

.success-modal__icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: #14b8ff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 700;
}

/* ============================================ */
/* ===== АДАПТАЦИЯ ===== */
/* ============================================ */

/* --- Планшеты и маленькие ноутбуки --- */
@media (max-width: 992px) {
  .open-lesson__wrapper {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 40px 40px 20px;
  }

  .open-lesson__image {
    order: -1;
  }

  .open-lesson__title {
    font-size: 38px;
  }

  .open-lesson__title-highlight {
    font-size: 44px;
  }

  .open-lesson__photo {
    width: 80%;
    margin: 0 auto;
  }

  .lesson-modal__body {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .lesson-modal__window {
    padding: 30px;
  }

  .lesson-modal__title {
    font-size: 32px;
  }
}

/* --- Мобильные (768px и меньше) --- */
@media (max-width: 768px) {
  .open-lesson {
    padding: 50px 0;
  }

  .container {
    width: min(100% - 24px, 1200px);
  }

  .open-lesson__wrapper {
    padding: 28px 20px 20px;
    border-radius: 28px;
    gap: 24px;
  }

  .open-lesson__label {
    font-size: 14px;
    padding: 6px 14px;
  }

  .open-lesson__label-second {
    font-size: 16px;
    padding: 6px 14px;
  }

  .open-lesson__title {
    font-size: 28px;
    margin: 16px 0;
  }

  .open-lesson__title-highlight {
    font-size: 32px;
  }

  .open-lesson__description {
    font-size: 16px;
    max-width: 100%;
  }

  .open-lesson__text-container {
    /* flex-direction: column; */
    gap: 12px;
  }

  .open-lesson__button {
    min-width: unset;
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    justify-content: center;
    margin-top: 24px;
  }

  .open-lesson__image {
    order: -1;
  }

  .open-lesson__photo {
    width: 100%;
    max-width: 400px;
  }

  .open-lesson__arc {
    display: none;
  }

  .lesson-modal__title {
    font-size: 26px;
  }

  .lesson-modal__subtitle {
    font-size: 15px;
  }

  .lesson-modal__body {
    gap: 20px;
  }

  .lesson-info {
    flex-direction: column;
    padding: 18px;
  }

  .calendar {
    padding: 14px;
  }

  .calendar__days button {
    height: 36px;
    font-size: 13px;
  }

  .calendar__weekdays span {
    font-size: 11px;
  }

  .success-modal__window {
    padding: 30px 20px;
  }

  .success-modal__icon {
    width: 60px;
    height: 60px;
    font-size: 32px;
  }
}

/* --- Очень маленькие телефоны (480px и меньше) --- */
@media (max-width: 480px) {
  .open-lesson {
    padding: 32px 0;
  }

  .container {
    width: min(100% - 16px, 1200px);
  }

  .open-lesson__wrapper {
    padding: 20px 14px 16px;
    border-radius: 20px;
    gap: 18px;
  }

  .open-lesson__title {
    font-size: 22px;
  }

  .open-lesson__title-highlight {
    font-size: 26px;
  }

  .open-lesson__description {
    font-size: 14px;
    line-height: 1.6;
  }

  .open-lesson__button {
    padding: 14px 18px;
    font-size: 14px;
    gap: 10px;
    border-radius: 50px;
  }

  .open-lesson__button svg {
    width: 18px;
    height: 18px;
  }

  .open-lesson__label {
    font-size: 12px;
    padding: 4px 12px;
  }

  .open-lesson__label-second {
    font-size: 13px;
    padding: 4px 12px;
  }

  .lesson-modal__title {
    font-size: 22px;
  }

  .lesson-modal__window {
    padding: 16px 12px;
  }

  .form-group input,
  .form-group select {
    padding: 12px 14px;
    font-size: 15px;
  }

  .lesson-form__submit {
    padding: 14px;
    font-size: 16px;
  }
}

/* ===== МОДАЛКА ===== */

.lesson-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
  --header-height: 0px;
}

.lesson-modal.is-open {
  display: flex;
}

.lesson-modal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1;
}

.lesson-modal__window {
  position: relative;
  background: #fff;
  border-radius: 32px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  z-index: 2;
  color-scheme: light;
  color: #13233a;
  width: min(1100px, 100%);
  max-height: 90vh;
  max-height: 90svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lesson-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: #eef4f8;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  flex-shrink: 0;
  transition: background 0.2s;
}

.lesson-modal__close:hover {
  background: #ddeaf4;
}

.lesson-modal__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 48px 56px 40px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

/* ===== АДАПТАЦИЯ МОДАЛКИ ===== */

/* --- Планшеты и телефоны (≤900px) --- */
@media (max-width: 900px) {
  .lesson-modal {
    --header-height: 80px;
    padding: 10px;
    padding-top: calc(var(--header-height) + 12px);
    align-items: flex-start;
  }

  .lesson-modal__window {
    max-height: calc(100vh - var(--header-height) - 20px);
    max-height: calc(100svh - var(--header-height) - 20px);
    border-radius: 24px;
  }

  .lesson-modal__body {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 28px 24px 16px;
  }

  /* Кнопка всегда видна — прилипает к низу скроллируемой области */
  .lesson-form__submit {
    position: sticky;
    bottom: 0;
    margin-top: 8px;
    box-shadow: 0 -12px 20px rgba(255, 255, 255, 0.95);
  }
}

/* --- Мобильные телефоны (≤600px) --- */
@media (max-width: 600px) {
  .lesson-modal {
    --header-height: 80px;
    padding: 6px;
    padding-top: calc(var(--header-height) + 8px);
    padding-bottom: env(safe-area-inset-bottom, 12px);
    align-items: flex-start;
  }

  .lesson-modal__window {
    max-height: calc(100vh - var(--header-height) - 16px);
    max-height: calc(100svh - var(--header-height) - 16px);
    border-radius: 20px;
  }

  .lesson-modal__body {
    padding: 20px 16px 12px;
    gap: 16px;
  }

  .lesson-form__submit {
    padding-bottom: max(18px, env(safe-area-inset-bottom, 18px));
  }
}

/* --- Очень маленькие телефоны (≤400px) --- */
@media (max-width: 400px) {
  .lesson-modal {
    padding: 4px;
    padding-top: calc(var(--header-height) + 6px);
    padding-bottom: env(safe-area-inset-bottom, 8px);
  }

  .lesson-modal__window {
    max-height: calc(100vh - var(--header-height) - 12px);
    max-height: calc(100svh - var(--header-height) - 12px);
    border-radius: 18px;
  }

  .lesson-modal__body {
    padding: 16px 12px 8px;
    gap: 14px;
  }
}
