.contact-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 9999;
  overflow-y: auto;
  padding: 40px 20px;
  box-sizing: border-box;
  overflow: auto;
  animation: fadeIn 0.3s ease;
}

.contact-modal-content {
  position: relative;
  background: #1e1e1e;
  color: #fff;
  padding: 40px;
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.7);
  font-family: 'JosefinSans', sans-serif;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: auto;
  margin-bottom: auto;
}

.contact-modal-content h2 {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 20px;
}

.contact-modal-content input,
.contact-modal-content select,
.contact-modal-content textarea {
  font-family: 'JosefinSans', sans-serif;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: #333;
  color: white;
  font-size: 1rem;
  box-sizing: border-box;
  transition: border 0.3s, box-shadow 0.3s;
}

.contact-modal-content textarea {
  resize: vertical;
  min-height: 100px;
}

/* Выпадающий список стрелочка */
.contact-modal-content select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg%20width%3D'12'%20height%3D'8'%20xmlns%3D'http%3A//www.w3.org/2000/svg'%3E%3Cpath%20d%3D'M1%201l5%205%205-5'%20stroke%3D'%23fff'%20stroke-width%3D'2'%20fill%3D'none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
  cursor: pointer;
}

/* Валидация только после взаимодействия */
input:invalid:not(:focus):not(:placeholder-shown),
textarea:invalid:not(:focus):not(:placeholder-shown),
select:invalid:not(:focus) {
  border: none;
  box-shadow: none;
}

input:invalid:focus,
textarea:invalid:focus,
select:invalid:focus {
  border: 1px solid red;
  box-shadow: 0 0 7px red;
}

/* Placeholder видимый и помогает отсечь :invalid */
input::placeholder,
textarea::placeholder {
  color: #aaa;
}

/* Кнопка отправки */
.contact-modal-content button {
  background-color: white;
  color: black;
  font-weight: bold;
  border: none;
  padding: 14px;
  font-size: 1.1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
  width: 100%;
}

.contact-modal-content button:hover {
  background-color: #ccc;
  transform: translateY(-2px);
}

/* Крестик */
.close-contact {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2rem;
  cursor: pointer;
  color: #bbb;

  z-index: 1000;
}

.close-contact:hover {

  color: white;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Адаптация */
@media (max-width: 768px) {
  .contact-modal-content {
    padding: 30px 20px;
    font-size: 0.95rem;
    border-radius: 16px;
  }

  .close-contact {
    top: 15px;
    right: 20px;
    font-size: 1.8rem;
  }

  .contact-modal-content button {
    font-size: 1rem;
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .contact-modal-content {
    padding: 20px 15px;
    font-size: 0.9rem;
    gap: 12px;
  }

  .close-contact {
    top: 10px;
    right: 15px;
    font-size: 1.6rem;
  }

  .contact-modal-content button {
    font-size: 0.95rem;
    padding: 10px;
  }
}

/*  добавляем пространство между полями формы */
.contact-modal-content input,
.contact-modal-content select,
.contact-modal-content textarea {
  margin-bottom: 1rem;    /* вертикальный отступ под каждым полем */
}

/*  чтобы кнопка не прилипала к полям сверху */
.contact-modal-content button#submitBtn {
  margin-top: 1rem;
}

/*  дополнительный внутренний отступ у контейнера формы */
.contact-modal-content {
  padding: 2rem;          /* увеличиваем паддинг вокруг всей формы */
  gap: 0.75rem;           /* если используется flex-контейнер, обеспечит равный gap */
}
