import{o as g,u as h,r as n,j as e,A as p}from"./index-XAQEFxR0.js";const j=()=>{const{token:u}=g(),x=h(),[a,m]=n.useState(""),[d,b]=n.useState(""),[o,s]=n.useState("idle"),[i,r]=n.useState(""),f=async t=>{if(t.preventDefault(),a!==d){s("error"),r("Passwords do not match");return}if(a.length<6){s("error"),r("Password must be at least 6 characters");return}s("loading"),r("");try{const l=await fetch(`${p}/api/auth/reset-password/${u}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:a})}),c=await l.json();l.ok?(s("success"),r(c.message||"Password reset successfully."),setTimeout(()=>x("/login"),3e3)):(s("error"),r(c.message||"Failed to reset password."))}catch{s("error"),r("An error occurred. Please try again.")}};return e.jsxs("div",{className:"min-h-screen bg-infosec-bg flex items-center justify-center px-4 relative overflow-hidden",children:[e.jsxs("div",{className:"absolute top-0 left-0 w-full h-full overflow-hidden z-0 pointer-events-none",children:[e.jsx("div",{className:"absolute top-[-10%] right-[-10%] w-[40%] h-[40%] bg-infosec-accent/10 rounded-full blur-[100px]"}),e.jsx("div",{className:"absolute bottom-[-10%] left-[-10%] w-[40%] h-[40%] bg-blue-600/10 rounded-full blur-[100px]"})]}),e.jsxs("div",{className:"max-w-md w-full bg-[#1a1b1e]/80 backdrop-blur-xl border border-gray-800 rounded-2xl p-8 shadow-2xl relative z-10",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h2",{className:"text-3xl font-bold text-white mb-2",children:"Reset Password"}),e.jsx("p",{className:"text-gray-400",children:"Enter your new password below."})]}),o==="success"?e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-green-500/10 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx("svg",{className:"w-8 h-8 text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M5 13l4 4L19 7"})})}),e.jsx("div",{className:"p-4 bg-green-500/10 border border-green-500/50 rounded-lg text-green-500 text-sm mb-6",children:i}),e.jsx("p",{className:"text-gray-400 text-sm",children:"Redirecting to login..."})]}):e.jsxs("form",{onSubmit:f,className:"space-y-6",children:[o==="error"&&e.jsx("div",{className:"p-4 bg-red-500/10 border border-red-500/50 rounded-lg text-red-500 text-sm",children:i}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:"New Password"}),e.jsx("input",{type:"password",required:!0,className:"w-full px-4 py-3 bg-[#0e0f11]/50 border border-gray-700 rounded-xl text-white focus:ring-2 focus:ring-infosec-accent focus:border-transparent transition",placeholder:"••••••••",value:a,onChange:t=>m(t.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:"Confirm New Password"}),e.jsx("input",{type:"password",required:!0,className:"w-full px-4 py-3 bg-[#0e0f11]/50 border border-gray-700 rounded-xl text-white focus:ring-2 focus:ring-infosec-accent focus:border-transparent transition",placeholder:"••••••••",value:d,onChange:t=>b(t.target.value)})]}),e.jsx("button",{type:"submit",disabled:o==="loading",className:"w-full py-3 px-4 bg-gradient-to-r from-infosec-accent to-purple-600 hover:from-infosec-accentHover hover:to-purple-700 text-white font-bold rounded-xl shadow-lg shadow-infosec-accent/20 transition transform hover:scale-[1.02] disabled:opacity-50 disabled:cursor-not-allowed",children:o==="loading"?"Resetting...":"Reset Password"})]})]})]})};export{j as default};
