/* ==========================================================
   Forgot Password Page (fully scoped)
   Every rule starts with .fp-page, so nothing here can affect
   other pages (login, register, header, footer, etc.).
   Spacing scale (8px base): 4 / 8 / 12 / 16 / 24 / 32 / 40
   Save as: static/css/pages/forgot_password.css
   ========================================================== */

.fp-page {
  --fp-primary: #1d4ed8;
  --fp-primary-hover: #1e40af;
  --fp-text: #0f172a;
  --fp-muted: #64748b;
  --fp-border: #cbd5e1;
  --fp-surface: #ffffff;
  --fp-bg: #f1f5f9;
  --fp-error-bg: #fef2f2;
  --fp-error-text: #b91c1c;
  --fp-error-border: #fecaca;
  --fp-success-bg: #f0fdf4;
  --fp-success-text: #15803d;
  --fp-success-border: #bbf7d0;

  --fp-space-2: 8px;
  --fp-space-3: 12px;
  --fp-space-4: 16px;
  --fp-space-5: 24px;
  --fp-space-6: 32px;
  --fp-space-7: 40px;

  --fp-radius: 8px;
  --fp-radius-lg: 12px;
  --fp-control-height: 48px;

  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: var(--fp-space-7) var(--fp-space-4);
  background: var(--fp-bg);
  color: var(--fp-text);
}

.fp-page *,
.fp-page *::before,
.fp-page *::after {
  box-sizing: border-box;
}

/* ---------- Card ---------- */
.fp-page .fp-card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: var(--fp-space-6);
  background: var(--fp-surface);
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius-lg);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* ---------- Heading ---------- */
.fp-page .fp-top {
  margin: 0 0 var(--fp-space-5);
  text-align: center;
}

.fp-page .fp-top h1 {
  margin: 0 0 var(--fp-space-2);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.25;
}

.fp-page .fp-top p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--fp-muted);
}

/* ---------- Message box ---------- */
.fp-page #messageBox {
  margin: 0 0 var(--fp-space-4);
  padding: var(--fp-space-3) var(--fp-space-4);
  border: 1px solid transparent;
  border-radius: var(--fp-radius);
  font-size: 0.9rem;
  line-height: 1.5;
}

.fp-page #messageBox.err {
  background: var(--fp-error-bg);
  color: var(--fp-error-text);
  border-color: var(--fp-error-border);
}

.fp-page #messageBox.success-message {
  background: var(--fp-success-bg);
  color: var(--fp-success-text);
  border-color: var(--fp-success-border);
}

/* ---------- Steps ---------- */
.fp-page #step1,
.fp-page #step2,
.fp-page #step3,
.fp-page #step4 {
  display: flex;
  flex-direction: column;
  gap: var(--fp-space-4);
}

/* JS sets inline display:none / block.
   Keep the flex layout whenever a step is visible. */
.fp-page #step1[style*="block"],
.fp-page #step2[style*="block"],
.fp-page #step3[style*="block"],
.fp-page #step4[style*="block"] {
  display: flex !important;
}

/* ---------- Fields ---------- */
.fp-page .field {
  display: flex;
  flex-direction: column;
  gap: var(--fp-space-2);
  margin: 0;
}

.fp-page .field label {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

.fp-page .field input {
  width: 100%;
  height: var(--fp-control-height);
  margin: 0;
  padding: 0 var(--fp-space-4);
  background: var(--fp-surface);
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius);
  font: inherit;
  font-size: 1rem;
  color: var(--fp-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fp-page .field input::placeholder {
  color: #94a3b8;
}

.fp-page .field input:focus {
  outline: none;
  border-color: var(--fp-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.18);
}

.fp-page #id_otp {
  text-align: center;
  font-size: 1.25rem;
  letter-spacing: 0.4em;
}

/* ---------- Buttons ---------- */
.fp-page .btn,
.fp-page #resendOtpBtn,
.fp-page #backToStep1 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--fp-control-height);
  margin: 0;
  padding: 0 var(--fp-space-5);
  border-radius: var(--fp-radius);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.fp-page .btn {
  background: var(--fp-primary);
  border: 1px solid var(--fp-primary);
  color: #ffffff;
}

.fp-page .btn:hover {
  background: var(--fp-primary-hover);
  border-color: var(--fp-primary-hover);
}

/* Secondary buttons: Resend OTP, Change details */
.fp-page #resendOtpBtn,
.fp-page #backToStep1 {
  background: transparent;
  border: 1px solid var(--fp-border);
  color: var(--fp-text);
}

.fp-page #resendOtpBtn:hover,
.fp-page #backToStep1:hover {
  background: var(--fp-bg);
}

.fp-page #resendOtpBtn[style*="inline-block"] {
  display: inline-flex !important;
}

.fp-page button:disabled,
.fp-page .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.fp-page .btn:focus-visible,
.fp-page #resendOtpBtn:focus-visible,
.fp-page #backToStep1:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.35);
  outline-offset: 2px;
}

/* ---------- OTP timer ---------- */
.fp-page #step2 > p {
  margin: 0;
  font-size: 0.9rem;
  text-align: center;
  color: var(--fp-muted);
}

.fp-page #otpTimer {
  color: var(--fp-text);
  font-variant-numeric: tabular-nums;
}

/* ---------- Success step ---------- */
.fp-page #step4 {
  align-items: stretch;
  text-align: center;
}

.fp-page #step4 h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.fp-page #step4 p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--fp-muted);
}

/* ---------- Back to login ---------- */
.fp-page .back {
  margin: var(--fp-space-5) 0 0;
  padding-top: var(--fp-space-4);
  border-top: 1px solid var(--fp-border);
  text-align: center;
  font-size: 0.9rem;
}

.fp-page .back a {
  color: var(--fp-primary);
  font-weight: 600;
  text-decoration: none;
}

.fp-page .back a:hover {
  text-decoration: underline;
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .fp-page {
    padding: var(--fp-space-5) var(--fp-space-3);
    align-items: flex-start;
  }

  .fp-page .fp-card {
    padding: var(--fp-space-5) var(--fp-space-4);
    border-radius: var(--fp-radius);
  }

  .fp-page .fp-top h1 {
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fp-page .field input,
  .fp-page .btn,
  .fp-page #resendOtpBtn,
  .fp-page #backToStep1 {
    transition: none;
  }
}