/* Модальное окно */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
  /* ← включается только когда модалка открыта */
}

.modal-content {
  background: var(--card);
  border-radius: 24px;
  padding: 32px;
  width: 420px;
  max-width: 90%;
  max-height: 90vh;
  /* ← не вылезает за экран */
  overflow-y: auto;
  /* ← скролл если не влезает */
  position: relative;
  box-shadow: 0 20px 35px -8px rgba(0, 0, 0, 0.2);
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Кнопка закрытия */

.close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    color 0.2s;
  padding: 0;
}

.close svg {
  width: 16px;
  height: 16px;
}

.close:hover {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
}

/* Табы */

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s;
  position: relative;
}

.tab-btn:hover {
  color: var(--btn-bg);
}

.tab-btn.active {
  color: var(--btn-bg);
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--btn-bg);
  border-radius: 2px;
}

/* Контент табов */

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Формы */

.auth-form input {
  width: 100%;
  padding: 14px 16px;
  margin: 8px 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  font-size: 1rem;
  transition: all 0.2s;
  font-family: inherit;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--btn-bg);
  box-shadow: 0 0 0 3px var(--focus);
}

.auth-form input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.auth-form button {
  width: 100%;
  padding: 14px;
  background: var(--btn-bg);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

.auth-form button:hover {
  background: var(--btn-hover);
}

/* Кнопка открытия модалки */

.auth-btn {
  background: var(--primary-2);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
}

.user-icon {
  width: 22px;
  height: 22px;
  stroke: #000;
  fill: none;
}

.user-icon-img {
  width: 22px;
  height: 22px;
  display: block;
  filter: brightness(0) invert(1);
  /* если svg темный */
}

/* Сообщение об ошибке */

.auth-error {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  border-left: 3px solid var(--danger);
}

/* Успешное сообщение */

.auth-success {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  border-left: 3px solid var(--success);
}

/* Разделитель */

.auth-divider {
  text-align: center;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Ошибки под полями */

.field-error {
  color: var(--danger);
  font-size: 0.78rem;
  margin: -10px 0 10px 4px;
}

.auth-form input.input-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Подсказки пароля */

.password-hint {
  list-style: none;
  padding: 10px 14px;
  margin: -10px 0 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.8rem;
  display: none;
  gap: 6px;
  flex-direction: column;
}

.password-hint.visible {
  display: flex;
}

.password-hint li {
  color: var(--muted);
  transition: color 0.2s;
  padding-left: 18px;
  position: relative;
}

.password-hint li::before {
  content: "✕";
  position: absolute;
  left: 0;
  color: var(--danger);
  font-size: 0.7rem;
}

.password-hint li.passed {
  color: var(--success);
}

.password-hint li.passed::before {
  content: "✓";
  color: var(--success);
}
