/* =============================================
   ФОРМА ЗАЯВКИ/ОБРАТНОГО ЗВОНКА XMT-ARGO
   Адаптирована из стилей карточек проектов
   ============================================= */

/* МОДАЛЬНОЕ ОКНО КОНТЕЙНЕР - ПОЭТАПНАЯ АНИМАЦИЯ */
.contact-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0); /* Начинаем с прозрачного фона */
  backdrop-filter: blur(0px); /* Начинаем без блюра */
  z-index: 15000; /* Выше навигации (10000) */
  opacity: 0;
  visibility: hidden;
  transition: 
    opacity 0.3s ease-out,
    visibility 0.3s ease-out;
  display: flex;
  justify-content: flex-end; /* Прижимаем к правому краю */
  align-items: center;
}

.contact-modal-overlay.active {
  opacity: 1;
  visibility: visible;
  background: rgba(0, 0, 0, 0.8); /* Фон появляется */
  backdrop-filter: blur(15px); /* Сильный блюр */
  transition: 
    opacity 0.3s ease-out,
    visibility 0.3s ease-out,
    background 0.5s ease-out 0.15s, /* Фон появляется с задержкой */
    backdrop-filter 0.6s ease-out 0.15s; /* Блюр тоже с задержкой */
}

/* МОДАЛЬНОЕ ОКНО - АДАПТИВНАЯ ВЫСОТА */
.contact-modal {
  width: 400px;
  max-height: calc(100vh - 40px); /* Адаптивная высота под экран */
  /* ДИЗАЙН: Скругление только левых углов */
  border-radius: 20px 0 0 20px;
  background: rgba(15, 23, 42, 0.9); /* Точный цвет карточек проектов */
  backdrop-filter: blur(20px);
  border: 2px solid transparent;
  border-right: none; /* Убираем правую границу */
  
  /* Точные цвета свечения как у карточек проектов */
  box-shadow: 
    0 0 20px rgba(45, 212, 191, 0.3),
    0 0 40px rgba(45, 212, 191, 0.1),
    inset 0 0 20px rgba(45, 212, 191, 0.05);
  
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Плавный ease-out */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.contact-modal-overlay.active .contact-modal {
  transform: translateX(0);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Плавный ease-out */
}

/* АНИМАЦИЯ ЗАКРЫТИЯ - ОБРАТНЫЙ ПОРЯДОК */
.contact-modal-overlay.closing {
  background: rgba(0, 0, 0, 0) !important; /* Убираем фон сначала */
  backdrop-filter: blur(0px) !important; /* Убираем блюр сначала */
  transition: 
    background 0.3s ease-out,
    backdrop-filter 0.3s ease-out,
    opacity 0.3s ease-out 0.2s, /* Прозрачность с задержкой */
    visibility 0.3s ease-out 0.2s;
}

.contact-modal-overlay.closing .contact-modal {
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.55, 0.06, 0.68, 0.19) 0.2s; /* Окно уезжает последним */
}

/* ЭНЕРГЕТИЧЕСКАЯ РАМКА КАК У КАРТОЧЕК */
.contact-modal::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: 0;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    rgba(45, 212, 191, 0.6),
    rgba(96, 165, 250, 0.4),
    rgba(45, 212, 191, 0.6),
    rgba(96, 165, 250, 0.4)
  );
  background-size: 400% 400%;
  border-radius: 22px 0 0 22px;
  z-index: -1;
  animation: energyFlow 4s ease-in-out infinite;
  opacity: 0;
  transition: opacity 0.3s ease-out 0.4s; /* Появляется после окна */
}

/* Энергетическая рамка появляется когда модальное окно активно */
.contact-modal-overlay.active .contact-modal::before {
  opacity: 1;
}

/* При закрытии рамка исчезает сразу */
.contact-modal-overlay.closing .contact-modal::before {
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

/* УБИРАЕМ ХОВЕР ЭФФЕКТ С МОДАЛЬНОГО ОКНА - оставляем только базовое свечение */

@keyframes energyFlow {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Убираем неиспользуемую анимацию energyFlowHover */

/* ЗАГОЛОВОК С ПЕРЕКЛЮЧАТЕЛЕМ - КОМПАКТНЫЙ */
.contact-modal-header {
  position: relative;
  z-index: 2;
  padding: 1rem 1.25rem 0.75rem; /* Еще более компактные отступы */
  border-bottom: 1px solid rgba(45, 212, 191, 0.2); /* Голубая линия как у карточек */
  flex-shrink: 0; /* Не сжимается */
  opacity: 0;
  transform: translateY(-15px);
  transition: 
    opacity 0.3s ease-out 0.25s, /* Заголовок появляется раньше контента */
    transform 0.3s ease-out 0.25s;
}

/* Заголовок появляется когда модальное окно активно */
.contact-modal-overlay.active .contact-modal-header {
  opacity: 1;
  transform: translateY(0);
}

/* При закрытии заголовок исчезает сразу */
.contact-modal-overlay.closing .contact-modal-header {
  opacity: 0;
  transform: translateY(-15px);
  transition: 
    opacity 0.15s ease-out,
    transform 0.15s ease-out;
}

.contact-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  background: rgba(45, 212, 191, 0.1);
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.contact-modal-close:hover {
  background: rgba(251, 146, 60, 0.2);
  color: #fb923c;
  transform: scale(1.1);
}

/* ПЕРЕКЛЮЧАТЕЛЬ ФОРМ - КОМПАКТНЫЙ */
.form-tabs {
  display: flex;
  background: rgba(45, 212, 191, 0.1);
  border-radius: 10px; /* Уменьшаем радиус */
  padding: 3px; /* Уменьшаем padding */
  margin-bottom: 0.75rem; /* Уменьшаем отступ снизу */
}

.tab-button {
  flex: 1;
  padding: 8px 12px; /* Уменьшаем padding кнопок */
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 0.85rem; /* Уменьшаем шрифт */
  cursor: pointer;
  border-radius: 8px; /* Уменьшаем радиус кнопок */
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
  white-space: nowrap; /* Текст в одну строку */
}

.tab-button.active {
  background: rgba(45, 212, 191, 0.2);
  color: #2dd4bf;
  box-shadow: 0 4px 15px rgba(45, 212, 191, 0.2);
}

.tab-button:not(.active):hover {
  background: rgba(251, 146, 60, 0.1);
  color: #fb923c;
}

/* КОНТЕНТ ФОРМЫ - АДАПТИВНЫЙ FLEX */
.contact-modal-content {
  position: relative;
  z-index: 2;
  padding: 0 1rem 1rem; /* Еще более компактные отступы */
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Позволяет flex-элементу сжиматься */
  overflow-y: auto; /* Возвращаем прокрутку для контента */
  opacity: 0;
  transform: translateY(20px);
  transition: 
    opacity 0.4s ease-out 0.3s, /* Контент появляется после окна */
    transform 0.4s ease-out 0.3s;
}

/* Контент появляется когда модальное окно активно */
.contact-modal-overlay.active .contact-modal-content {
  opacity: 1;
  transform: translateY(0);
}

/* При закрытии контент исчезает сразу */
.contact-modal-overlay.closing .contact-modal-content {
  opacity: 0;
  transform: translateY(20px);
  transition: 
    opacity 0.2s ease-out,
    transform 0.2s ease-out;
}

/* СТИЛИ ФОРМ - FLEX LAYOUT */
.form-container {
  display: none;
  flex: 1;
  flex-direction: column;
  justify-content: space-between; /* Распределяем элементы по высоте */
}

.form-container.active {
  display: flex; /* Изменяем на flex */
  animation: fadeInSlide 0.4s ease-out;
}

@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ПОЛЯ ВВОДА - КОМПАКТНЫЕ */
.form-group {
  margin-bottom: 0; /* Убираем margin, используем gap */
}

/* ГРУППА ПОЛЕЙ ДЛЯ FLEX */
.form-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* Размещаем поля сверху */
  gap: 0.6rem; /* Уменьшаем отступы между полями */
}

/* СПЕЦИАЛЬНОЕ ЦЕНТРИРОВАНИЕ ДЛЯ ФОРМЫ ОБРАТНОГО ЗВОНКА */
#callbackForm .form-fields {
  justify-content: center; /* Центрируем поля в форме звонка */
}

/* КНОПКА ОТПРАВКИ В FLEX */
.form-actions {
  flex-shrink: 0; /* Не сжимается */
  margin-top: 0.75rem; /* Уменьшаем отступ */
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  color: #ffffff;
  font-size: 0.9rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid rgba(45, 212, 191, 0.3);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: #ffffff;
  transition: all 0.3s ease;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: #2dd4bf;
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.1);
}

.form-textarea {
  min-height: 60px; /* Еще более компактная высота */
  max-height: 80px; /* Уменьшаем максимальную высоту */
  resize: vertical;
}

/* ВЫПАДАЮЩИЙ СПИСОК */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
}

/* ВАЛИДАЦИЯ */
.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: #ef4444;
  background: rgba(254, 226, 226, 0.8);
}

.form-error {
  color: #ef4444;
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: none;
}

.form-error.visible {
  display: block;
  animation: fadeInError 0.3s ease-out;
}

@keyframes fadeInError {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* МАСКА ТЕЛЕФОНА */
.phone-mask {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 1px;
}

/* ОЧЕНЬ КОМПАКТНАЯ КНОПКА ЗАГРУЗКИ ФАЙЛОВ */
.file-upload-area {
  display: inline-block;
  border: 2px solid rgba(45, 212, 191, 0.3);
  border-radius: 6px; /* Еще меньший радиус */
  padding: 4px 10px; /* Еще меньший padding */
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  color: #2dd4bf;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 0.75rem; /* Еще меньший шрифт */
}

.file-upload-area:hover {
  border-color: #2dd4bf;
  background: rgba(45, 212, 191, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(45, 212, 191, 0.2);
}

.file-upload-area.dragover {
  border-color: #fb923c;
  background: rgba(251, 146, 60, 0.1);
  color: #fb923c;
}

.file-upload-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
}

.file-upload-icon {
  font-size: 1rem;
}

.file-upload-limit {
  display: block;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
}

.file-list {
  margin-top: 1rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(45, 212, 191, 0.2);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-name {
  font-weight: 500;
  color: #ffffff;
  font-size: 0.9rem;
}

.file-size {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
}

.file-remove {
  background: none;
  border: none;
  color: #fb923c;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.file-remove:hover {
  background: rgba(251, 146, 60, 0.1);
  color: #ffffff;
}

/* ПРОГРЕСС ЗАГРУЗКИ */
.upload-progress {
  width: 100%;
  height: 4px;
  background: rgba(249, 115, 22, 0.2);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-orange), #fb923c);
  border-radius: 2px;
  transition: width 0.3s ease;
  transform-origin: left;
}

/* КНОПКА ОТПРАВКИ */
.submit-button {
  width: 100%;
  padding: 12px 24px; /* Уменьшаем padding для компактности */
  background: linear-gradient(135deg, #2dd4bf, #06b6d4);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 0.95rem; /* Немного уменьшаем размер */
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  margin-top: 1rem;
  
  /* Свечение как у карточек */
  box-shadow: 
    0 4px 15px rgba(45, 212, 191, 0.3),
    0 0 20px rgba(45, 212, 191, 0.1);
}

.submit-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.submit-button:hover::before {
  left: 100%;
}

.submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 25px rgba(45, 212, 191, 0.4),
    0 0 30px rgba(45, 212, 191, 0.2);
  background: linear-gradient(135deg, #fb923c, #f59e0b); /* Оранжевый ховер как у карточек */
}

.submit-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.submit-button:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* SUCCESS STATE */
.success-container {
  display: none;
  text-align: center;
  padding: 3rem 2rem;
  position: relative;
  z-index: 2;
}

.success-container.active {
  display: block;
  animation: successFadeIn 0.6s ease-out;
}

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

.success-checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  animation: checkmarkBounce 0.8s ease-out;
}

@keyframes checkmarkBounce {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.success-title {
  font-family: 'Montserrat Alternates', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #2dd4bf, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.success-message {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  line-height: 1.5;
}

/* АДАПТИВНОСТЬ */
@media (max-width: 768px) {
  .contact-modal-overlay {
    justify-content: center; /* Центрируем на мобильных */
    align-items: stretch; /* Растягиваем по высоте */
  }
  
  .contact-modal {
    width: 100%;
    height: 100vh; /* Полная высота на мобильных */
    border-radius: 0;
    border: none;
    transform: translateX(100%);
  }
  
  .contact-modal-overlay.active .contact-modal {
    transform: translateX(0);
  }
  
  .contact-modal-header,
  .contact-modal-content {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  
  .contact-modal-header {
    padding-top: 1.25rem;
    padding-bottom: 0.75rem;
  }
  
  .form-group {
    margin-bottom: 1rem; /* Более компактно на мобильных */
  }
  
  .file-upload-area {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .contact-modal-header,
  .contact-modal-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .tab-button {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
  
  .form-input,
  .form-select,
  .form-textarea {
    padding: 10px 14px;
    font-size: 0.85rem;
  }
}

/* LOADING STATE */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s ease-in-out infinite;
  margin-right: 0.5rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.submit-button.loading {
  pointer-events: none;
}

.submit-button.loading .button-text {
  opacity: 0;
}

.submit-button.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s ease-in-out infinite;
} 