/* ===== AUTH PAGE ===== */

/* Hidden input used to "prime" iOS keyboard inside the user-gesture
   of the "Получить код" button tap. Must stay visible to iOS (not
   display:none / visibility:hidden / readonly), so we use opacity:0
   with 1px box positioned in viewport. */
.otp-primer {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  pointer-events: none;
  font-size: 16px; /* avoid iOS zoom on focus */
}


/* Фон — фирменное поле (--brand-login-* в theme.css); карточка по центру, строка с копирайтом внизу. */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--brand-login-shade), var(--brand-login-glow);
  color: var(--text-primary);
  display: grid;
  grid-template-rows: 1fr auto;
  -webkit-font-smoothing: antialiased;
}
.login-main {
  padding: 64px 24px 40px;
}
.login-bottom {
  padding: 0 24px 28px;
  font-size: 12px;
  color: var(--brand-field-text-muted);
}

/* Card */
.auth-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: var(--shadow-modal);
}

/* Logo */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
/* Знак не квадратный: плашка задаёт поле, сам знак — по высоте. */
.auth-logo-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  background: var(--bg);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.auth-logo-icon img {
  width: auto;
  height: 54px;
}
.auth-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Title */
.auth-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 8px;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 32px;
}
.auth-subtitle strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Form Group */
.form-group {
  margin-bottom: 24px;
}

/* MudBlazor input overrides */
.auth-field .mud-input-outlined-border {
  border-width: 1px !important;
  border-radius: 10px !important;
}
.auth-field:focus-within .mud-input-outlined-border {
  border-width: 1px !important;
}

/* Error State */
.form-group.has-error .auth-field .mud-input-outlined-border {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px var(--danger-bg);
}
.form-error {
  display: none;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--danger);
}
.form-error svg { flex-shrink: 0; }
.form-error--visible {
  display: flex;
}

/* Submit Button */
.submit-btn {
  width: 100%;
  height: 48px;
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.submit-btn:hover {
  background: var(--accent-hover);
}
.submit-btn:active {
  background: var(--accent-hover);
  transform: scale(0.98);
}
.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Button spinner */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* OTP */
.otp-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}
.otp-digit {
  width: 56px;
  height: 64px;
  background: var(--bg-panel);
  border: 1px solid var(--border-input);
  border-radius: 10px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  caret-color: var(--accent);
}
.otp-digit:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.otp-digit.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
  animation: shake 0.4s;
}

.otp-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 20px;
}

/* Back button */
.auth-back {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.2s ease;
}
.auth-back:hover { color: var(--text-secondary); }

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-divider span {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Help */
.auth-help {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}
.auth-help a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}
.auth-help a:hover {
  color: var(--accent-hover);
}

/* Shake */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Responsive */
@media (max-width: 600px) {
  .login-page {
    background: var(--brand-login-shade), var(--brand-login-glow-phone);
  }
  .login-main {
    padding: 64px 16px 34px;
  }
}
@media (max-width: 480px) {
  .auth-card {
    padding: 32px 24px;
  }
  .auth-title {
    font-size: 24px;
  }
  .otp-digit {
    width: 48px;
    height: 56px;
    font-size: 20px;
  }
}
