/* Общие стили */
*,
*::after,
*::before {
  box-sizing: border-box;
  transition: all ease-in-out 0.3s;
}

html {
  background-color: skyblue;
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}

body {
  width: 100%;
  font-size: 16px;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
  background-color: skyblue;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* Контейнер */
.container {
  opacity: 0;
  animation: fadeIn 0.3s ease-in forwards;
  width: 100%;
  max-width: 1100px;
  background-color: rgb(78, 150, 245);
  padding: 15px;
  border: 3px solid #000000;
  border-radius: 20px;
  will-change: transform;
  backface-visibility: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin: 20px auto;
  align-self: center;
}

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

/* Заголовок */
.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  text-align: center;
  border-bottom: 2px solid #000000;
  padding-bottom: 8px;
  color: #000;
  font-size: 1.5rem;
  flex: 1;
  min-width: 200px;
}

.subtitle {
  text-align: center;
  margin: 0 0 25px 0;
  color: #333;
  font-size: 1rem;
}

/* Контактные кнопки слева */
.contact-buttons-left {
  display: flex;
  gap: 8px;
  align-items: center;
}

.contact-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #000000;
  text-decoration: none;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.contact-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.telegram-btn {
  background-color: #0088cc;
  color: white;
}

.email-btn {
  background-color: #d44638;
  color: white;
}

.contact-icon {
  font-size: 14px;
}

.contact-text {
  display: inline;
}

/* Кнопка возврата справа */
.back-button-right {
  display: flex;
  align-items: center;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #000000;
  text-decoration: none;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
  transition: all 0.2s ease;
  background-color: rgb(224, 146, 1);
  color: white;
}

.back-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  background-color: rgb(179, 116, 0);
}

.back-icon {
  font-size: 14px;
}

.back-text {
  display: inline;
}

/* Контейнер аутентификации */
.auth-container {
  width: 100%;
  border: 2px solid #000000;
  border-radius: 15px;
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
}

/* Выбор режима */
.mode-selector {
  display: flex;
  margin-bottom: 25px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #000000;
}

.mode-btn {
  flex: 1;
  padding: 12px;
  font-size: 16px;
  border: none;
  background-color: rgb(211, 211, 211);
  color: black;
  cursor: pointer;
  font-weight: bold;
}

.mode-btn.active {
  background-color: rgb(0, 108, 209);
  color: white;
}

.mode-btn:hover:not(.active) {
  background-color: rgb(180, 180, 180);
}

/* Формы */
.form-container {
  display: none;
}

.form-container.active {
  display: block;
}

.form-container h2 {
  text-align: center;
  margin: 0 0 20px 0;
  color: #000;
  font-size: 1.4rem;
}

/* Выбор роли */
.role-selector {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.role-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 10px 15px;
  border-radius: 8px;
  background-color: rgb(230, 230, 230);
  border: 2px solid transparent;
}

.role-option:hover {
  background-color: rgb(220, 220, 220);
}

.role-option input[type="radio"] {
  margin: 0;
}

.role-option input[type="radio"]:checked + .role-label {
  font-weight: bold;
  color: rgb(0, 108, 209);
}

.role-option input[type="radio"]:checked ~ .role-label::after {
  content: " ✓";
}

.role-label {
  font-size: 15px;
  color: #333;
}

/* Группы ввода */
.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group input {
  width: 100%;
  padding: 14px 45px 14px 15px;
  border: 2px solid #000000;
  border-radius: 10px;
  font-size: 16px;
  background-color: white;
  outline: none;
}

.input-group input:focus {
  border-color: rgb(0, 108, 209);
  box-shadow: 0 0 0 2px rgba(0, 108, 209, 0.2);
}

.input-group input[readonly] {
  background-color: #f0f0f0;
  color: #666;
}

.show-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 5px;
  color: #666;
}

/* Кнопки */
.auth-btn {
  width: 100%;
  padding: 16px;
  font-size: 17px;
  border-radius: 10px;
  border: 2px solid #000000;
  background-color: rgb(0, 128, 21);
  color: white;
  cursor: pointer;
  font-weight: bold;
  margin: 10px 0 25px 0;
}

.auth-btn:hover {
  background-color: rgb(0, 100, 16);
}

/* Демо входы */
.demo-logins {
  margin: 20px 0;
  padding: 15px;
  border: 2px dashed #000000;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.8);
}

.demo-title {
  text-align: center;
  margin: 0 0 10px 0;
  font-weight: bold;
  color: #333;
}

.demo-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.demo-btn {
  padding: 12px;
  font-size: 14px;
  border-radius: 8px;
  border: 2px solid #000000;
  background-color: rgb(0, 108, 209);
  color: white;
  cursor: pointer;
  font-weight: bold;
}

.demo-btn:hover {
  background-color: rgb(0, 74, 143);
}

/* Ссылки */
.form-links {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.link {
  color: rgb(0, 108, 209);
  text-decoration: none;
  font-size: 14px;
}

.link:hover {
  text-decoration: underline;
}

/* Адаптивность */
@media (max-width: 768px) {
  .container {
    max-width: 95%;
    margin: 20px auto;
    padding: 20px;
  }

  .header-container {
    flex-direction: column;
    gap: 10px;
  }

  .contact-buttons-left,
  .back-button-right {
    width: 100%;
    justify-content: center;
  }

  h1 {
    order: -1;
    width: 100%;
  }

  .auth-container {
    padding: 15px;
  }

  .role-selector {
    flex-direction: column;
    gap: 10px;
  }

  .mode-selector {
    flex-direction: column;
  }

  .mode-btn {
    padding: 10px;
    font-size: 15px;
  }

  .auth-btn {
    padding: 14px;
    font-size: 16px;
  }

  .form-links {
    flex-direction: column;
    align-items: center;
  }

  .contact-text,
  .back-text {
    display: none;
  }

  .contact-icon,
  .back-icon {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .container {
    width: calc(100% - 20px);
    margin: 10px auto;
    padding: 15px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .contact-btn,
  .back-btn {
    padding: 8px 12px;
    font-size: 11px;
  }

  .contact-text,
  .back-text {
    display: none;
  }

  .contact-icon,
  .back-icon {
    font-size: 16px;
  }
}
