// Reset-password page — rendered when pathname = /reset-password (Firebase action-code flow) function ResetPasswordOverlay({ oobCode }) { const [checkedEmail, setCheckedEmail] = React.useState(null); // null while checking, '' if invalid const [codeError, setCodeError] = React.useState(null); const [password, setPassword] = React.useState(''); const [confirm, setConfirm] = React.useState(''); const [status, setStatus] = React.useState(null); // null | 'loading' | 'error' | 'success' const [errMsg, setErrMsg] = React.useState(''); React.useEffect(() => { if (!oobCode) { setCodeError('Este enlace de recuperación no es válido.'); return; } window.fbAuth.verifyPasswordResetCode(oobCode) .then(email => setCheckedEmail(email)) .catch(() => setCodeError('Este enlace de recuperación no es válido o ya expiró.')); }, [oobCode]); async function submit(e) { e?.preventDefault?.(); if (!password || !confirm) { setStatus('error'); setErrMsg('Complete todos los campos.'); return; } if (password !== confirm) { setStatus('error'); setErrMsg('Las contraseñas no coinciden.'); return; } if (password.length < 6) { setStatus('error'); setErrMsg('La contraseña debe tener al menos 6 caracteres.'); return; } setStatus('loading'); setErrMsg(''); try { await window.fbAuth.confirmPasswordReset(oobCode, password); setStatus('success'); setTimeout(() => { window.location.href = '/'; }, 2200); } catch (err) { setStatus('error'); setErrMsg(err.code === 'auth/weak-password' ? 'Contraseña muy débil (mín. 6 caracteres).' : (err.message || 'Error al restablecer la contraseña.')); } } const wrapStyle = { position:'fixed', inset:0, display:'flex', alignItems:'center', justifyContent:'center', background:'linear-gradient(135deg,#0F1524 0%, #142036 50%, #0A0E1A 100%)', zIndex:9999 }; const cardStyle = { width:420, background:BC.surface, borderRadius:12, boxShadow:'0 30px 80px rgba(0,0,0,.5)', overflow:'hidden', position:'relative', zIndex:1 }; const bgGlow = { position:'absolute', inset:0, backgroundImage:'radial-gradient(circle at 20% 30%, rgba(34,144,206,.18) 0%, transparent 40%)', pointerEvents:'none' }; const brandStrip = (