/* === Задний фон модалки === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 25, 0.5);
  backdrop-filter: blur(16px) saturate(180%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9999;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

/* === Основной блок модалки === */
.form-modal {
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 24px 20px;
  width: min(340px, 90%);
  color: #fff;
  text-align: center;
  box-shadow: 0 0 25px rgba(0, 255, 200, 0.12);
  transform: translateY(15px) scale(0.96);
  opacity: 0;
  animation: modalIn 0.45s cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
}

/* Анимация появления окна */
@keyframes modalIn {
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* === Логотип === */
.form-modal-logo {
  width: 56px;
  height: auto;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 8px rgba(0, 255, 200, 0.6));
  animation: logoGlow 3.5s ease-in-out infinite, logoAppear 0.6s ease forwards;
}

@keyframes logoAppear {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes logoGlow {
  0%, 100% {
    filter: drop-shadow(0 0 10px rgba(0, 255, 200, 0.5))
            drop-shadow(0 0 20px rgba(0, 200, 255, 0.3));
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 18px rgba(0, 255, 200, 0.9))
            drop-shadow(0 0 30px rgba(150, 100, 255, 0.6));
    transform: scale(1.04);
  }
}

/* === Текст === */
.form-modal h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: #fff;
}

.form-modal p {
  font-size: 0.9rem;
  color: #cfd6e0;
  margin: 14px 0 22px;
  line-height: 1.4;
}

/* === Кнопка === */
.form-modal footer {
  display: flex;
  justify-content: center;
}

.form-modal button.btn {
  background: linear-gradient(120deg, #00ffe0, #9b6bff);
  color: #fff;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 9px 26px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 0 10px rgba(0, 255, 200, 0.4);
}

.form-modal button.btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(0, 255, 200, 0.6);
}

/* === Плавное появление/исчезновение модалки === */
#formModal {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#formModal.show {
  opacity: 1;
  visibility: visible;
}

#formModal.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* 💚 Эффект зелёного свечения при успехе */
.success-glow .form-modal {
  animation: successPulse 0.9s ease-in-out 2;
}

@keyframes successPulse {
  0%, 100% {
    box-shadow: 0 0 25px rgba(0, 255, 200, 0.15);
  }
  50% {
    box-shadow: 0 0 35px rgba(0, 255, 150, 0.55);
  }
}

/* === FIX: разморозка страницы после закрытия модалки === */
body.modal-open {
  overflow: hidden;
  transform: scale(0.97);
  filter: blur(1px);
  transition: transform 0.3s ease, filter 0.3s ease;
}

body:not(.modal-open) {
  overflow: visible !important;
  transform: none !important;
  filter: none !important;
}

#formModal {
  opacity: 0;
  transition: opacity 0.25s ease;
}

#formModal.show {
  opacity: 1;
}

body.no-scroll {
  overflow: hidden;
}

/* --- Упрощённая и согласованная логика отображения --- */
#formModal {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
#formModal.show {
  opacity: 1;
  visibility: visible;
}
body.modal-open {
  overflow: hidden;
}

