/* Модальные окна: callback, surveyor, success. Поток 5.
   Поля формы - общие классы из base.css (.field .input .check .hp-field .form-error). */

/* Блокировка прокрутки страницы, пока открыто окно (класс ставит js на <html>) */
html.modal__lock { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal[hidden] { display: none; }

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 55, 61, .75);
  animation: modal-fade .2s ease-out;
}

.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 40px 20px 24px;
  background: var(--c-white);
  color: var(--c-text);
  border-radius: var(--radius-card);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  animation: modal-in .22s ease-out;
}
.modal__dialog:focus { outline: none; }
@media (min-width: 768px) { .modal__dialog { padding: 44px 40px 36px; } }

.modal__close {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--c-primary);
  transition: background-color .2s;
}
.modal__close:hover { background: var(--c-light); }

.modal__title {
  font-weight: 800;
  font-size: 22px;
  line-height: 28px;
  text-transform: uppercase;
  color: var(--c-primary);
  margin: 0 32px 12px 0;
}
@media (min-width: 768px) { .modal__title { font-size: 26px; line-height: 32px; } }

.modal__text { font-weight: 500; font-size: var(--fs-body); line-height: var(--lh-body); margin-bottom: 20px; }
@media (min-width: 768px) { .modal__text { margin-bottom: 24px; } }

.modal__form { display: flex; flex-direction: column; gap: 16px; }
.modal__form .field__label { color: var(--c-primary); }

/* Переключатель «Telegram / Звонок» */
.modal__switch { border: 0; margin: 0; padding: 0; min-width: 0; }
.modal__switch legend { padding: 0; margin-bottom: 6px; }
.modal__options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.modal__option { position: relative; display: block; cursor: pointer; }
.modal__option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}
.modal__option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-btn);
  background: var(--c-white);
  color: var(--c-primary);
  font-weight: 600;
  font-size: 15px;
  line-height: 20px;
  text-align: center;
  transition: background-color .2s, color .2s, border-color .2s;
}
.modal__option:hover span { border-color: var(--c-primary); }
.modal__option input:checked + span { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-white); }
.modal__option input:focus-visible + span { outline: 3px solid var(--c-accent); outline-offset: 2px; }

.modal__form .check { margin-top: 4px; }
.modal__submit, .modal__ok { width: 100%; }
.modal__submit { margin-top: 4px; }   /* после согласия: 16 + 4 = 20 px, от 768 - 24 px */
@media (min-width: 768px) { .modal__submit { margin-top: 8px; } }

/* Окно «Заявка принята» */
.modal__dialog--success { text-align: center; padding-top: 48px; }
.modal__dialog--success .modal__title { margin-right: 0; }
.modal__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--c-light);
  color: var(--c-primary);
}

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* Баннер cookie (доработка 3, поток 6). Ниже модалок (z-index 1000), выше шапки. */
.cookie {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 8px 8px 14px;
  border: 1px solid rgba(104, 173, 173, .35);
  border-radius: var(--radius-card);
  background: var(--c-dark);
  color: var(--c-white);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.cookie[hidden] { display: none; }
/* Пока баннер виден, подвал длиннее на его высоту, чтобы баннер не закрывал низ страницы (переменную ставит js/app.js) */
.footer { padding-bottom: calc(32px + var(--cookie-space, 0px)); }
.cookie__text { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 13px; line-height: 18px; }
.cookie__text a { color: var(--c-accent); text-decoration: underline; text-underline-offset: 2px; }
.cookie__ok {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--c-accent);
  color: var(--c-dark);
  font-family: var(--font);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.cookie__ok:hover { background: var(--c-white); }
@media (min-width: 768px) {
  .cookie { bottom: 16px; padding: 10px 10px 10px 20px; gap: 16px; }
  .cookie__text { font-size: 14px; line-height: 20px; }
}
