/* ==========================================================================
   Authentication pages (login / signup / password reset / lockout)
   Shared styles — replaces the per-template inline <style> blocks.
   ========================================================================== */

:root {
  --auth-light-bg: #ffffff;
  --auth-input-border: #cbd5e0;
  --auth-text-color: #1f2d3d;
  --auth-muted: #6c757d;
}

/* Full-height centering wrapper */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-color: #f3f3f9;
}

/* Card */
.auth-card {
  background: var(--auth-light-bg);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
}

/* Narrower single-panel card (password reset / lockout) */
.auth-card--single {
  max-width: 480px;
}

/* Left panel: logo + welcome message */
.auth-image {
  flex: 1 1 40%;
  background: rgba(0, 0, 0, 0.04);
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--auth-text-color);
  text-align: center;
  position: relative;
}
.auth-image img {
  max-width: 200px;
  animation: authFadeInDown 1s ease;
}
.auth-image h2 {
  margin-top: 20px;
  font-size: 1.8rem;
  font-weight: 700;
}
.auth-image p {
  font-size: 1rem;
  opacity: 0.9;
}
@keyframes authFadeInDown {
  0%   { opacity: 0; transform: translateY(-20px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Right panel: form */
.auth-form {
  flex: 1 1 60%;
  padding: 40px;
  position: relative;
}
.auth-form h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: center;
  color: var(--auth-text-color);
}
.auth-form .auth-subtitle {
  text-align: center;
  margin-bottom: 30px;
  color: var(--auth-muted);
}

/* Error alert (non-field errors, e.g. wrong credentials) */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.35;
  animation: authShake 0.4s ease, authFadeInDown 0.4s ease;
}
.auth-alert--error {
  background: #fdecec;
  border: 1px solid #f5c2c2;
  color: #b02a37;
}
.auth-alert__icon {
  font-size: 1.15rem;
  line-height: 1.2;
  flex-shrink: 0;
}
.auth-alert__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Field-level validation errors (crispy / Bootstrap) */
.auth-form .invalid-feedback,
.auth-form .errorlist {
  display: block;
  color: #b02a37;
  font-size: 0.82rem;
  margin-top: 0.35rem;
}
.auth-form .errorlist {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}
.auth-form .form-control.is-invalid {
  border-color: #e35d6a;
  background-image: none;
  box-shadow: 0 0 0 0.15rem rgba(220, 53, 69, 0.15);
}

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.auth-form .form-control {
  border: 1px solid var(--auth-input-border);
  border-radius: 8px;
  padding: 10px 15px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.auth-form .form-control:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.2rem rgba(94, 114, 228, 0.25);
}
.auth-form .btn-primary {
  background: var(--bs-primary);
  border: none;
  border-radius: 8px;
  padding: 10px 15px;
  font-weight: 600;
  transition: background 0.3s, opacity 0.3s;
}

/* Password field: show/hide toggle */
.auth-password-wrap {
  position: relative;
}
.auth-password-toggle {
  position: absolute;
  top: 38px;
  right: 12px;
  border: none;
  background: transparent;
  color: var(--auth-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.auth-password-toggle:hover { color: var(--auth-text-color); }

/* Password strength meter */
.auth-strength {
  height: 6px;
  border-radius: 4px;
  background: #e9ecef;
  margin: 8px 0 4px;
  overflow: hidden;
}
.auth-strength__bar {
  height: 100%;
  width: 0;
  transition: width 0.3s, background 0.3s;
}
.auth-strength__label {
  font-size: 0.8rem;
  color: var(--auth-muted);
}

/* Interactive password requirement checklist */
#password-requirements {
  font-size: 0.9rem;
  color: var(--auth-muted);
  padding-left: 1.2rem;
  margin-top: 0.5rem;
}
#password-requirements .requirement { list-style: none; }
#id_password1_helptext { display: none; }

/* Submit button loading state */
.btn.is-loading {
  opacity: 0.7;
  pointer-events: none;
}
.btn.is-loading .btn-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-right: 0.4rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: authSpin 0.6s linear infinite;
  vertical-align: -2px;
}
.btn-spinner { display: none; }
@keyframes authSpin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
  .auth-card { flex-direction: column; }
  .auth-image { display: none; }
  .auth-form {
    flex: 1 1 100%;
    padding: 30px;
  }
}
