/* ---------- Модальное окно авторизации ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: modalFadeIn 0.25s ease;
}
.modal-overlay[hidden] {
  display: none;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
}

.modal-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.35) 0%, rgba(124, 58, 237, 0.18) 45%, transparent 70%);
  filter: blur(40px);
  pointer-events: none;
  animation: modalGlowPulse 4s ease-in-out infinite;
}
@keyframes modalGlowPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.08); opacity: 1; }
}

.modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 28px;
  box-shadow: 0 32px 80px -20px rgba(15, 23, 42, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  animation: modalScaleIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modalScaleIn {
  from { transform: scale(0.92) translateY(18px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(15, 23, 42, 0.05);
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.modal-close:hover {
  background: rgba(15, 23, 42, 0.1);
  color: var(--text);
  transform: rotate(90deg);
}

.modal-hero {
  text-align: center;
  margin-bottom: 24px;
}
.modal-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px -8px rgba(37, 99, 235, 0.45);
  animation: avatarBounce 1.2s ease infinite alternate;
}
@keyframes avatarBounce {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}
.modal h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--text);
}
.modal-lead {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.auth-tabs {
  position: relative;
  display: flex;
  background: rgba(15, 23, 42, 0.05);
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 24px;
  gap: 2px;
}
.auth-tab-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(33.333% - 2.666px);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.1);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}
.auth-tabs[data-active="register"] .auth-tab-indicator {
  transform: translateX(100%);
}
.auth-tabs[data-active="lostpass"] .auth-tab-indicator {
  transform: translateX(200%);
}
.auth-tabs button {
  position: relative;
  z-index: 1;
  flex: 1;
  border: none;
  background: none;
  padding: 10px 6px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.25s;
}
.auth-tabs button.active,
.auth-tabs button:hover {
  color: var(--text);
}

.auth-forms {
  position: relative;
  min-height: 280px;
}
.auth-form {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(12px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}
.auth-form.active {
  position: relative;
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}
.auth-form[data-direction="prev"] {
  transform: translateX(-12px);
}

.auth-hint {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.5;
}

.field.floating {
  position: relative;
  margin-bottom: 16px;
}
.field.floating .field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  pointer-events: none;
  transition: color 0.2s;
}
.field.floating input {
  width: 100%;
  height: 54px;
  padding: 18px 14px 6px 44px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field.floating input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  background: #fff;
}
.field.floating input:focus + label,
.field.floating input:not(:placeholder-shown) + label,
.field.floating input:-webkit-autofill + label {
  top: 10px;
  left: 44px;
  transform: translateY(0);
  font-size: 11.5px;
  color: var(--primary);
  font-weight: 700;
}
.field.floating input:focus ~ .field-icon {
  color: var(--primary);
}
.field.floating label {
  position: absolute;
  left: 44px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--muted);
  pointer-events: none;
  transition: all 0.2s ease;
}

.password-field {
  position: relative;
}
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  border-radius: 50%;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}
.password-toggle:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

.checkbox-modern {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 18px;
}
.checkbox-modern input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.checkbox-modern .checkmark {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
  flex: 0 0 auto;
}
.checkbox-modern .checkmark::after {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 11px;
  color: #fff;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s, transform 0.2s;
}
.checkbox-modern input:checked + .checkmark {
  border-color: var(--primary);
  background: var(--primary);
}
.checkbox-modern input:checked + .checkmark::after {
  opacity: 1;
  transform: scale(1);
}
.checkbox-modern input:focus + .checkmark {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-glow {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  height: 52px;
  border-radius: 14px;
  box-shadow: 0 8px 24px -8px rgba(37, 99, 235, 0.55);
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -10px rgba(37, 99, 235, 0.65);
}
.btn-glow:active {
  transform: translateY(0);
}
.btn-glow:disabled {
  opacity: 0.75;
  cursor: wait;
}
.btn-glow .btn-text,
.btn-glow .btn-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.2s;
}
.btn-glow[aria-busy="true"] .btn-text {
  opacity: 0;
  transform: translateY(-8px);
}
.btn-glow[aria-busy="true"] .btn-loader {
  position: absolute;
  inset: 0;
  opacity: 1;
  transform: translateY(0);
}
.btn-glow .btn-loader {
  opacity: 0;
  transform: translateY(8px);
}

.auth-sub {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 14px;
  text-align: center;
}
.auth-sub a {
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.auth-sub a:hover {
  text-decoration: underline;
}

.auth-message {
  font-size: 14px;
  margin: 14px 0 0;
  min-height: 20px;
  text-align: center;
  font-weight: 600;
}
.auth-message.ok {
  color: var(--ok);
}
.auth-message.err {
  color: var(--err);
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .modal {
    padding: 24px 20px;
    border-radius: 22px;
  }
  .modal-avatar {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }
  .auth-tabs button {
    font-size: 12px;
    padding: 10px 4px;
  }
}
