/* Authentication pages styles - auth-pages.css
   Used by: public/login.php, public/register.php
   Goals: centered card, responsive, accessible contrast, captcha & fingerprint helpers,
   loading overlay, password strength bar, and success box.
*/

html,
body {
  height: 100%;
  background: linear-gradient(180deg, #f5f7fb 0%, #eef3fb 100%);
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans',
    sans-serif;
  color: #333;
}

.login-page-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(28, 40, 57, 0.08);
  overflow: hidden;
  border: 1px solid rgba(39, 57, 80, 0.04);
}

.login-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  /* Match main site page-header: blue gradient */
  background: linear-gradient(135deg, #6ab1e8 0%, #2c6bc9 100%);
  color: #fff;
  text-align: center; /* 居中标题 */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.login-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #fff; /* 白色文字，参考 page-header */
}

.login-subtitle {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.9);
}

.login-body {
  padding: 20px 22px 26px;
}

.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #253343;
}
.form-control {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid #d7e0ee;
  background: #fff;
  transition:
    box-shadow 0.12s ease,
    border-color 0.12s ease;
}
.form-control:focus {
  outline: none;
  border-color: #6aa0ff;
  box-shadow: 0 0 0 3px rgba(106, 160, 255, 0.12);
}

.btn-login {
  padding: 10px 12px;
  font-size: 15px;
  border-radius: 6px;
}
.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-back-link {
  color: #6b7fa3;
  text-decoration: none;
}
.login-back-link:hover {
  text-decoration: underline;
}

.login-attempts-warning {
  background: #fff8e6;
  border-left: 4px solid #ffd47a;
  padding: 10px 12px;
  border-radius: 4px;
  color: #6a4e00;
  margin-bottom: 12px;
}

.fingerprint-status {
  margin-top: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #6b7fa3;
}

/* Captcha area */
#captcha-container {
  margin-top: 8px;
}
#captcha-container img {
  max-height: 80px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: block;
}
#captcha-container .captcha-spinner {
  width: 18px;
  height: 18px;
  display: none;
  border: 3px solid rgba(0, 0, 0, 0.08);
  border-top-color: #567ef8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#captcha-error {
  color: #b45309;
  background: #fff7ed;
  padding: 8px 10px;
  border-radius: 4px;
}

/* Loading overlay for register page */
.loading-overlay {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(12, 20, 30, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.loading-overlay .loading-content {
  background: rgba(255, 255, 255, 0.98);
  padding: 18px 22px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(12, 26, 44, 0.22);
  display: flex;
  gap: 12px;
  align-items: center;
}
.loading-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.08);
  border-top-color: #2b6ef6;
  animation: spin 0.9s linear infinite;
}
.loading-overlay[aria-hidden='false'],
.loading-overlay.show {
  display: flex;
}

/* Success box (register) */
.success-box {
  text-align: center;
  padding: 16px 18px;
}
.success-box i {
  font-size: 40px;
  color: #28a745;
  display: block;
  margin-bottom: 8px;
}
.success-box h3 {
  margin: 6px 0;
  font-size: 18px;
  color: #1f2d3d;
}
.success-box p {
  color: #4b5b6b;
  margin: 6px 0 0;
}

/* Password strength */
#password-strength {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.strength-meter {
  flex: 1;
}
.strength-bar {
  width: 100%;
  height: 8px;
  background: #eef2f7;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.strength-bar::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  transition:
    width 0.24s ease,
    background-color 0.24s ease;
}
.strength-bar.strength-weak::after {
  background: #f5b7b1;
  width: 33%;
}
.strength-bar.strength-medium::after {
  background: #ffd07a;
  width: 66%;
}
.strength-bar.strength-strong::after {
  background: #8dd47a;
  width: 100%;
}
#strength-text {
  font-size: 12px;
  color: #5a6b7c;
  white-space: nowrap;
  flex-shrink: 0;
}
#password-strength.strength-weak #strength-text {
  color: #dc3545;
}
#password-strength.strength-medium #strength-text {
  color: #ffc107;
}
#password-strength.strength-strong #strength-text {
  color: #28a745;
}

/* Small screens adjustments */
@media (max-width: 480px) {
  .login-card {
    max-width: 96%;
    border-radius: 10px;
  }
  .login-header h2 {
    font-size: 18px;
  }
  .login-body {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .strength-bar .level,
  .form-control,
  .btn-login {
    transition: none !important;
  }
  .captcha-spinner,
  .loading-spinner {
    animation: none !important;
  }
}

/* Helper small states */
.alert-info {
  background: #e9f5ff;
  color: #0b5fa5;
  border-radius: 4px;
  padding: 8px 10px;
}
.alert-warning {
  background: #fff7e6;
  color: #6a4e00;
  border-radius: 4px;
  padding: 8px 10px;
}

/* Accessibility helpers for focus-visible */
:focus-visible {
  outline: 3px solid rgba(39, 110, 255, 0.18);
  outline-offset: 2px;
}

/* Minor utilities kept local to auth pages to avoid leaking into global styles */
.login-card .btn {
  box-shadow: none;
}
