/* === Modal base === */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;                 /* top:0; right:0; bottom:0; left:0 */
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
}

.modal.is-visible {
  display: flex;
}

/* === Overlay === */
.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

/* === Dialog === */
.modal__content {
  position: relative;
  z-index: 1;
  background: #fff;

  /* паддинги и скругления */
  padding: clamp(16px, 2vw, 32px);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18);

  /* ключ: паддинги входят в ширину */
  box-sizing: border-box;

  /* адаптивная ширина (не прилипает к краям) */
  width: min(400px, 92vw);                   /* альтернатива: width: clamp(220px, 92vw, 400px); */

  /* динамический шрифт внутри модалки */
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  line-height: 1.4;
}

/* Заголовок модалки */
.modal__content h2 {
  margin: 0 0 1rem 0;
  font-size: clamp(1.2rem, 2.1vw, 1.3rem);
  font-weight: 700;
  color: #222;
}

/* Кнопка закрытия */
.modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #222;
}

.modal__close:hover {
  opacity: .8;
}

/* Поля формы в модалке (логин + обратная связь) */
.modal__content input,
.modal__content select,
.modal__content textarea {
  width: 100%;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #dcdcdc;
  border-radius: 6px;
  box-sizing: border-box;
  font: inherit;
  background-color: #eaf3ff; /* мягкий голубой, можешь подобрать свой оттенок */
}

/* Фокус для всех полей */
.modal__content input:focus,
.modal__content select:focus,
.modal__content textarea:focus {
  outline: none;
  border-color: #111;
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}



/* Кнопка отправки */
.modal__content button[type="submit"] {
  width: 100%;
  padding: 12px;
  background-color: #4CAF50;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

.modal__content button[type="submit"]:hover {
  opacity: .9;
}

/* Размер шрифта в поле "Тема" */
#contact-modal #contact-subject {
  font-size: clamp(0.8rem, 1vw, 0.95rem);
}

/* Плейсхолдер в "Тема" того же размера */
#contact-modal #contact-subject::placeholder {
  font-size: inherit;
}




/* Мелкие правки для совсем узких экранов */
@media (max-width: 360px) {
  .modal__content {
    width: calc(100vw - 20px); /* чуть больше воздуха у краёв */
    padding: 16px;
  }
}

/* Кнопка "Выйти" в модалке обратной связи — отдельный стиль */
#contact-modal .contact-logout-form {
  margin: 6px 0 12px;
}

#contact-modal .contact-logout-btn {
  background: none;
  border: none;
  padding: 0;
  width: auto;
  display: inline-block;

  font-size: 13px;
  font-weight: 400;
  color: #777;
  cursor: pointer;
  text-decoration: none;
}

#contact-modal .contact-logout-btn:hover {
  color: #555;
  text-decoration: underline;
}

/* Цвет подсказок (placeholder) в модалке */
.modal__content input::placeholder,
.modal__content textarea::placeholder {
  color: #808080; /* поставь сюда любой цвет */
}


/* Размер шрифта в поле "Текст сообщения" */
#contact-modal #contact-message {
  font-size: clamp(0.8rem, 1vw, 0.95rem);
}

/* И плейсхолдер там же, чтобы не был больше */
#contact-modal #contact-message::placeholder {
  font-size: inherit;
}


/* Размер шрифта в выпадающем списке "Тип сообщения" */
#contact-modal #contact-type {
  font-size: clamp(0.8rem, 1vw, 0.95rem);
}

/* Элементы списка того же размера */
#contact-modal #contact-type option {
  font-size: inherit;
}


.flash-messages {
  max-width: 600px;
  margin: 16px auto;
  padding: 0 16px;
}

.flash-message {
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

/* Успех */
.flash-success {
  background: #e6f4ea;
  color: #1e7b34;
  border: 1px solid #b7e1c0;
}

/* Ошибка */
.flash-error {
  background: #fdecea;
  color: #b3261e;
  border: 1px solid #f5c2c0;
}


/* Счётчики символов в форме обратной связи */
.contact-counter {
  margin-top: 4px;
  text-align: right;
  font-size: 0.75rem;
  color: #999;
}

.contact-counter.contact-counter-warning {
  color: #b3261e;
}
