/* ==========================================================================
   AUTH & RECOVERY MODULE CSS — CPE SYSTEM
   Contains styles unique to Login, Register, Forgot Password, & Password Change pages.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --navy: #00025e;
  --navy-mid: #00034a;
  --navy-deep: #00012e;
  --gold: #ffd166;
  --gold-dark: #e6b800;
  --white: #ffffff;
  --danger: #ef4444;
  --success: #16a34a;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

/* OWASP Account Recovery & Login Glassmorphism Body */
body.auth-page,
.recovery-body {
  min-height: 100vh;
  background: #00012e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  position: relative;
  padding: 24px 0;
}

/* Background animated orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: drift 12s ease-in-out infinite alternate;
  pointer-events: none;
}

.bg-orb-1 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #ffd166, #ff9500);
  top: -160px;
  left: -120px;
  animation-delay: 0s;
}

.bg-orb-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #4f8ef7, #00025e);
  bottom: -120px;
  right: -80px;
  animation-delay: -5s;
}

.bg-orb-3 {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, #ffd166, transparent);
  bottom: 60px;
  left: 30%;
  animation-delay: -3s;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(30px, 20px) scale(1.08); }
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 209, 102, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 209, 102, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

/* Glassmorphism Card for Login & Recovery */
.login-card,
.recovery-card {
  position: relative;
  z-index: 10;
  width: min(480px, 94vw);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 209, 102, 0.18);
  border-radius: 20px;
  backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  padding: 40px 40px 36px;
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Logo */
.login-logo,
.recovery-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
  text-align: center;
}

.login-logo-icon,
.recovery-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--gold), #ff9f1c);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(255, 209, 102, 0.35);
  animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(255, 209, 102, 0.35); }
  50% { box-shadow: 0 8px 36px rgba(255, 209, 102, 0.55); }
}

.login-logo h1,
.recovery-logo h1 { font-size: 19px; font-weight: 700; color: #ffffff; margin-bottom: 4px; }
.login-logo p,
.recovery-logo p { font-size: 12px; color: rgba(255, 255, 255, 0.4); }

/* Tab Bar */
.tab-bar {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
}

.tab-btn.active {
  background: var(--gold);
  color: var(--navy-deep);
  box-shadow: 0 2px 10px rgba(255, 209, 102, 0.3);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Alert Boxes in Card */
.alert-box,
.recovery-alert {
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-error,
.recovery-alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-success,
.recovery-alert-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.alert-info {
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.3);
  color: #93c5fd;
}

/* Forms */
.form-group,
.recovery-form-group {
  margin-bottom: 16px;
}

.form-group label,
.recovery-form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
}

.input-wrap,
.recovery-input-wrap {
  position: relative;
}

.input-icon,
.recovery-input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
  transition: color 0.2s;
}

/* Inputs styling */
.login-card input[type="text"],
.login-card input[type="email"],
.login-card input[type="password"],
.login-card input[type="file"],
.login-card select,
.register-card input[type="text"],
.register-card input[type="email"],
.register-card input[type="password"],
.register-card input[type="file"],
.register-card select,
.recovery-card input[type="text"],
.recovery-card input[type="email"],
.recovery-card input[type="password"],
.recovery-card input[type="file"],
.recovery-card select {
  width: 100%;
  padding: 11px 14px 11px 42px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  color: #ffffff;
  font-size: 13.5px;
  font-family: 'Poppins', sans-serif;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  box-shadow: none;
}

.login-card select, .register-card select, .recovery-card select {
  background-color: rgba(15, 23, 42, 0.95);
  color: #ffffff;
}

.login-card select option, .register-card select option, .recovery-card select option {
  background-color: #00025e;
  color: #ffffff;
}

.login-card input[type="file"], .register-card input[type="file"], .recovery-card input[type="file"] {
  padding: 9px 14px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
}

.login-card input::placeholder, .register-card input::placeholder, .recovery-card input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.login-card input:focus,
.login-card select:focus,
.register-card input:focus,
.register-card select:focus,
.recovery-card input:focus,
.recovery-card select:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.12);
}

.input-wrap:focus-within .input-icon,
.recovery-input-wrap:focus-within .recovery-input-icon {
  color: var(--gold);
}

/* Password Visibility Toggle */
.password-toggle,
.eye-toggle {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  user-select: none;
  transition: color 0.2s, transform 0.15s;
  z-index: 2;
}

.password-toggle:hover,
.eye-toggle:hover {
  color: var(--gold);
}

.password-toggle:active,
.eye-toggle:active {
  transform: translateY(-50%) scale(0.9);
}



/* Browser Chrome/Edge Autofill Override (Fixes light yellow/green box on saved credentials) */
.login-card input:-webkit-autofill,
.login-card input:-webkit-autofill:hover, 
.login-card input:-webkit-autofill:focus, 
.login-card input:-webkit-autofill:active,
.register-card input:-webkit-autofill,
.register-card input:-webkit-autofill:hover, 
.register-card input:-webkit-autofill:focus, 
.register-card input:-webkit-autofill:active,
.recovery-card input:-webkit-autofill,
.recovery-card input:-webkit-autofill:hover, 
.recovery-card input:-webkit-autofill:focus, 
.recovery-card input:-webkit-autofill:active {
  -webkit-text-fill-color: #ffffff !important;
  -webkit-box-shadow: 0 0 0 1000px #0a1128 inset !important;
  box-shadow: 0 0 0 1000px #0a1128 inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

.file-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 5px;
}

.divider {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 209, 102, 0.2), transparent);
  margin: 20px 0;
}

/* Submit Buttons */
.login-btn,
.recovery-submit-btn {
  width: 100%;
  padding: 13px;
  margin-top: 4px;
  background: linear-gradient(135deg, var(--gold), #ffb300);
  color: var(--navy-deep);
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
  box-shadow: 0 6px 20px rgba(255, 209, 102, 0.35);
}

.login-btn:hover,
.recovery-submit-btn:hover {
  filter: brightness(1.07);
  box-shadow: 0 8px 28px rgba(255, 209, 102, 0.5);
  transform: translateY(-1px);
}

.login-btn:active,
.recovery-submit-btn:active {
  transform: scale(0.98);
}

.login-footer {
  text-align: center;
  margin-top: 22px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.22);
}

.login-footer span {
  color: rgba(255, 209, 102, 0.5);
}

.recovery-back-link {
  display: block;
  text-align: center;
  margin-top: 22px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.35);
  text-decoration: none;
  transition: color 0.2s;
}

.recovery-back-link:hover {
  color: #ffd166;
}

/* Password Change Forms */
.change-password-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 220px);
  padding: 20px 0;
}

.change-password-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  max-width: 440px;
  width: 100%;
  padding: 36px 32px;
  margin: 0 auto;
  color: #1e293b;
}

.change-password-card .card-header { text-align: center; margin-bottom: 28px; background: transparent; }
.change-password-card .lock-icon { font-size: 36px; margin-bottom: 12px; }
.change-password-card h2 { font-size: 20px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
.change-password-card p { font-size: 13.5px; color: #64748b; line-height: 1.5; }

.change-password-card form {
  width: 100%;
}

.change-password-card .alert {
  margin-bottom: 20px;
}

.change-password-card .form-group {
  width: 100%;
  margin-bottom: 20px;
}

.change-password-card label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #475569; margin-bottom: 6px; }

.change-password-card .input-container { position: relative; width: 100%; }
.change-password-card input { width: 100%; box-sizing: border-box; padding: 11px 40px 11px 14px; border: 1.5px solid #cbd5e1; border-radius: 8px; font-size: 14px; outline: none; transition: border-color 0.2s, box-shadow 0.2s; background: #f8fafc; color: #1e293b; }
.change-password-card input:focus { border-color: #00025e; box-shadow: 0 0 0 3px rgba(0, 2, 94, 0.1); background: #ffffff; }
.change-password-card .eye-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; color: #64748b !important; opacity: 0.85; display: inline-flex; align-items: center; justify-content: center; }
.change-password-card .eye-toggle:hover { color: #00025e !important; opacity: 1; }

.change-password-card .strength-meter { width: 100%; height: 4px; background: #e2e8f0; border-radius: 2px; margin-top: 6px; overflow: hidden; }
.change-password-card .strength-bar { height: 100%; width: 0; transition: width 0.3s ease, background-color 0.3s ease; }
.change-password-card .hint-text { font-size: 11px; color: #94a3b8; display: block; margin-top: 4px; transition: color 0.3s ease; }

/* Password Field ID & Strength Traits */
#current_password,
#new_password_v,
#confirm_password_v {
  width: 100%;
  box-sizing: border-box;
}

#vpw-bar.strength-weak { width: 20%; background-color: #ef4444; }
#vpw-bar.strength-medium { width: 45%; background-color: #f97316; }
#vpw-bar.strength-good { width: 70%; background-color: #eab308; }
#vpw-bar.strength-strong { width: 100%; background-color: #22c55e; }

#vpw-label.strength-weak { color: #ef4444; }
#vpw-label.strength-medium { color: #f97316; }
#vpw-label.strength-good { color: #eab308; }
#vpw-label.strength-strong { color: #22c55e; }

.change-password-card .btn-submit {
  width: 100%;
  padding: 12px;
  background: #00025e;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
}

.change-password-card .btn-submit:hover { background: #00034a; }
.change-password-card .btn-submit:active { transform: scale(0.98); }

@media (max-width: 480px) {
  .login-card,
  .recovery-card { padding: 24px 20px 20px !important; width: 94vw; }
}
