.modals {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  pointer-events: none;
}

.auth-form,
.password-recovery-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  row-gap: 20px;
}

.auth-messages,
.recovery-messages {
  margin-bottom: 16px;
}

.auth-messages .error,
.recovery-messages .error {
  padding: 12px 16px;
  background-color: #fee;
  border: 1px solid #fca;
  border-radius: 8px;
  color: #c33;
  font-size: 14px;
  font-weight: 500;
}

.auth-messages .success,
.recovery-messages .success {
  padding: 12px 16px;
  background-color: #efe;
  border: 1px solid #cfc;
  border-radius: 8px;
  color: #363;
  font-size: 14px;
  font-weight: 500;
}

.recovery-success {
  margin-bottom: 16px;
}

.success-message {
  padding: 12px 20px;
  background-color: #ebf8ec;
  border-radius: 10px;
  font-family: "Onest", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  color: #34b945;
  text-align: center;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.modal.modal--active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);

  cursor: pointer;
}

.modal__container {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 10001;
}

.modal__content {
  background-color: var(--white);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.modal__close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey);
  transition: all 0.2s ease;
  z-index: 10;
}

.modal__close-btn:hover {
  background-color: var(--grey-light);
  color: var(--text);
}

.modal__close-btn:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.modal__title {
  font-size: 24px;
  display: block;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 20px;
}

/* Маленькое модальное окно */
.modal--small .modal__container {
  max-width: 350px;
}

/* Среднее модальное окно (по умолчанию) */
.modal--medium .modal__container {
  max-width: 600px;
}

/* Большое модальное окно */
.modal--large .modal__container {
  max-width: 800px;
}

/* Полноэкранное модальное окно */
.modal--full .modal__container {
  max-width: none;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
}

.modal--full .modal__content {
  height: 100%;
  border-radius: 0;
}

/* Адаптивность */
@media (max-width: 768px) {
  .modal {
    padding: 10px;
  }

  .modal__container {
    max-height: 95vh;
  }

  .modal__title {
    font-size: 20px;
  }

  .modal__close-btn {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
  }

  /* Маленькое модальное окно на мобильных */
  .modal--small .modal__container {
    max-width: none;
    width: 100%;
  }

  /* Среднее модальное окно на мобильных */
  .modal--medium .modal__container {
    max-width: none;
    width: 100%;
  }

  /* Большое модальное окно на мобильных */
  .modal--large .modal__container {
    max-width: none;
    width: 100%;
  }
}

/* Анимации для появления/исчезновения */
.modal--fade-in {
  animation: modalFadeIn 0.3s ease forwards;
}

.modal--fade-out {
  animation: modalFadeOut 0.3s ease forwards;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes modalFadeOut {
  from {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
}

/* Стили для действий в модальном окне */
.modal__actions {
  display: flex;
  gap: 12px;
  flex-direction: column;
}

/* Фокус для accessibility */
.modal:focus {
  outline: none;
}

.modal__content:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Скрываем скроллбар для iOS */
.modal__container::-webkit-scrollbar {
  display: none;
}

.modal__container {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
