/* === Общие стили для всех модальных окон === */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.modal {
  background: var(--background-white);
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  position: relative;
  transform: translateY(30px);
  transition: 
      transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.5),
      opacity 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
      box-shadow 0.3s ease;
  box-shadow: 0 25px 80px -20px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  opacity: 0;
  will-change: transform, opacity;
}

.modal-overlay.active .modal {
  transform: translateY(0);
  opacity: 1;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.7);
}

/* Эффект закрытия - плавное исчезание */
.modal-overlay.closing .modal {
  transform: translateY(20px);
  opacity: 0;
  box-shadow: 0 15px 50px -30px rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: 
      all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
      transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  flex-shrink: 0;
  will-change: transform, background;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1) rotate(3deg);
}

.modal-close:active {
  transform: scale(0.95);
}

.modal-close svg {
  width: 20px;
  height: 20px;
  stroke: white;
  stroke-width: 2;
  transition: transform 0.3s ease;
}

.modal-close:hover svg {
  transform: rotate(90deg);
}

.modal-content {
  padding: 2.5rem;
  max-height: 80vh;
  overflow-y: auto;
  will-change: transform;
}

/* Кастомизация для разных типов модальных окон */

/* Модальное окно для заявок */
.modal--request {
  max-width: 600px;
  transform-origin: center top;
}

.modal--request .modal-content {
  padding: 2.5rem;
}

.request-form {
  font-family: Arial, sans-serif;
  color: var(--text-dark);
}

.form-title {
  font-size: 28px;
  font-weight: bold;
  color: var(--text-dark);
  margin-bottom: 20px;
  line-height: 1.2;
}

.form-description {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-light);
  margin-bottom: 25px;
}

.form-phone {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
  white-space: nowrap;
}

.form-phone:hover {
  text-decoration: underline;
}

.form-divider {
  margin: 25px 0;
  position: relative;
}

.form-divider span {
  display: block;
  height: 1px;
  background: linear-gradient(90deg, 
      transparent 0%, 
      var(--border-light) 20%, 
      var(--border-light) 80%, 
      transparent 100%
  );
}

.form-group {
  margin-bottom: 25px;
}

.form-label {
  display: block;
  font-size: 16px;
  font-weight: bold;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  background: var(--background-white);
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--shadow-color);
}

.form-input::placeholder {
  color: var(--text-light);
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  margin: 25px 0 30px;
  gap: 12px;
}

.checkbox-input {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.checkbox-label {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-light);
  cursor: pointer;
  user-select: none;
}

.checkbox-label a {
  color: var(--primary-color);
  text-decoration: none;
}

.checkbox-label a:hover {
  text-decoration: underline;
}

.form-submit-btn {
  width: 100%;
  padding: 16px;
  background: var(--primary-color);
  color: var(--background-white);
  border: none;
  border-radius: 10px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.form-submit-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px var(--shadow-dark);
}

.form-submit-btn:active {
  transform: translateY(0);
}

/* Модальное окно для проектов */
.modal--project {
  max-width: 1200px !important;
  display: flex;
  flex-direction: column;
  transform-origin: center;
}

.modal--project .modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.modal--project .modal-image-container {
  flex: 0 0 40%;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  min-height: 400px;
  max-height: 80vh;
  transition: background 0.3s ease;
}

.modal--project .modal-image {
  max-width: 100%;
  max-height: 100%;
  display: block;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal--project:hover .modal-image {
  transform: scale(1.02);
}

.modal--project .modal-text-container {
  flex: 0 0 60%;
  padding: 2.5rem;
  overflow-y: auto;
  background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
  color: white;
  display: flex;
  flex-direction: column;
  transition: background 0.3s ease;
}

.modal--project .modal-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  color: white;
  animation: fadeInUp 0.5s ease forwards;
}

.modal--project .modal-description {
  font-size: 1.1rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  flex: 1;
  animation: fadeIn 0.6s ease forwards 0.1s;
}

.modal--project .modal-description p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.modal--project .modal-description strong {
  color: var(--primary-color);
  font-weight: 700;
}

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

@keyframes fadeIn {
  from {
      opacity: 0;
  }
  to {
      opacity: 1;
  }
}

/* Анимация появления контента */
.modal-content {
  opacity: 0;
  transform: translateY(10px);
  transition: 
      opacity 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s,
      transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.5) 0.1s;
}

.modal-overlay.active .modal-content {
  opacity: 1;
  transform: translateY(0);
}

/* Адаптивность для всех модальных окон */
@media (max-width: 768px) {
  .modal-overlay {
      padding: 10px;
      padding-top: 60px;
  }
  
  .modal {
      max-width: 95%;
      margin: 0 auto;
      border-radius: 12px;
      box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  }
  
  .modal-content {
      padding: 1.5rem;
  }
  
  .modal-close {
      top: 15px;
      right: 15px;
      width: 40px;
      height: 40px;
  }
  
  .modal-close svg {
      width: 18px;
      height: 18px;
  }
  
  /* Адаптивность для модального окна заявок */
  .modal--request {
      max-width: 95% !important;
  }
  
  .modal--request .form-title {
      font-size: 24px;
  }
  
  .modal--request .form-description {
      font-size: 14px;
  }
  
  /* Адаптивность для модального окна проектов */
  .modal--project .modal-body {
      flex-direction: column;
  }
  
  .modal--project .modal-image-container,
  .modal--project .modal-text-container {
      flex: 1 0 100%;
      min-height: 250px;
      max-height: 45vh;
      width: 100%;
  }
  
  .modal--project .modal-image {
      max-height: 90%;
      object-fit: contain;
  }
  
  .modal--project .modal-title {
      font-size: 1.8rem;
  }
}

@media (max-width: 480px) {
  .modal-content {
      padding: 1rem;
  }
  
  .modal-close {
      top: 12px;
      right: 12px;
      width: 36px;
      height: 36px;
  }
  
  .modal-close svg {
      width: 16px;
      height: 16px;
  }
  
  /* Адаптивность для модального окна заявок */
  .modal--request .form-title {
      font-size: 22px;
  }
  
  .modal--request .form-input {
      padding: 12px 14px;
      font-size: 15px;
  }
  
  .modal--request .form-submit-btn {
      padding: 14px;
      font-size: 16px;
  }
  
  /* Адаптивность для модального окна проектов */
  .modal--project .modal-image-container,
  .modal--project .modal-text-container {
      min-height: 200px;
      padding: 1rem;
  }
  
  .modal--project .modal-title {
      font-size: 1.6rem;
  }
  
  .modal--project .modal-description {
      font-size: 1rem;
  }
}