/* ===================== ОБЩИЕ СТИЛИ ===================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #FFF5EE;
  min-height: 100vh;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ===================== КОНТЕЙНЕР ===================== */
.container {
  background-color: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  text-align: center;
  max-width: 400px;
  width: 100%;
}

/* ===================== ЗАГОЛОВКИ ===================== */
h1 {
  color: #333;
  margin-bottom: 30px;
  font-size: 28px;
}

/* ===================== ФОРМЫ ===================== */
form {
  text-align: left;
}

label {
  display: block;
  color: #555;
  font-weight: 500;
  margin-bottom: 5px;
  font-size: 14px;
}

input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  padding: 12px 15px;
  margin-bottom: 20px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: #d38b5d;
}

/* ===================== КНОПКИ ===================== */
button,
.green-button,
.red-button,
.blue-button {
  display: inline-block;
  padding: 12px 30px;
  margin: 10px 5px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s;
  color: white;
  background-color: #d38b5d;
}

button:hover,
.green-button:hover,
.red-button:hover,
.blue-button:hover {
  background-color: #c17a4d;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(211, 139, 93, 0.4);
}

/* Основная кнопка (submit в формах) */
button[type="submit"] {
  background-color: #d38b5d;
  width: auto;
  padding: 12px 50px;
  margin-top: 10px;
  margin-bottom: 10px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

button[type="submit"]:hover {
  background-color: #c17a4d;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(211, 139, 93, 0.4);
}

/* Кнопка logout на home */
#logoutBtn {
  background-color: #d38b5d;
  margin-top: 20px;
}

#logoutBtn:hover {
  background-color: #c17a4d;
}

/* ===================== ТЕКСТ И ССЫЛКИ ===================== */
p {
  margin-top: 15px;
  margin-bottom: 0;
  color: #666;
  font-size: 14px;
}

p a {
  color: #d38b5d;
  text-decoration: none;
  font-weight: 600;
}

.url-link {
  text-decoration: none;
}

p a:hover {
  text-decoration: none;
}

/* ===================== WELCOME PAGE ===================== */
.container h1 {
  margin-bottom: 40px;
}

/* ===================== АДАПТИВНОСТЬ ===================== */
@media (max-width: 480px) {
  .container {
    padding: 30px 20px;
  }

  h1 {
    font-size: 24px;
  }

  button,
  .green-button,
  .red-button,
  .blue-button {
    padding: 10px 20px;
    font-size: 14px;
  }
}

/* ===================== MODAL ===================== */
.modal {
  display: none; /* Скрыто по умолчанию */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);

  /* ← КЛЮЧЕВЫЕ СТИЛИ ДЛЯ ЦЕНТРИРОВАНИЯ */
  justify-content: center;
  align-items: center;

  animation: fadeIn 0.3s;
}

/* Когда модалка активна - показываем flex */
.modal[style*="display: flex"] {
  display: flex !important;
}

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

.modal-content {
  background-color: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  max-height: 90vh; /* ← ДОБАВЛЕНО: Ограничение высоты */
  overflow-y: auto; /* ← ДОБАВЛЕНО: Скролл если контент длинный */
  animation: slideDown 0.3s;

  /* ← УБЕДИТЕСЬ ЧТО НЕТ POSITION */
  position: relative; /* Только для внутренних элементов */
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  margin: 0;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #333;
}
