import{$ as p,K as e,P as b,M as h,e as f,g as j,ag as y,a9 as l,o as N}from"./index-CqfREQhZ.js";function v(){const[n,o]=p.useState(!1);async function i(s){s.preventDefault();const a=s.currentTarget,t=new FormData(a),c=(t.get("name")||"").toString().trim(),m=(t.get("email")||"").toString().trim(),u=(t.get("subject")||"").toString().trim(),x=(t.get("message")||"").toString().trim();if(!c||!m||!x){l.error("Please fill in all required fields.");return}o(!0);try{const r=await N("/api/contact",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:c,email:m,subject:u,message:x})});if(!r.ok){const g=await r.json().catch(()=>({error:"Unable to send message"}));throw new Error(g?.error||"Unable to send message")}l.success("Message sent! We'll be in touch shortly."),a.reset()}catch(r){l.error(r instanceof Error?r.message:"Unable to send message.")}finally{o(!1)}}return e.jsxs("div",{className:"container mx-auto px-4 py-12",children:[e.jsxs("div",{className:"text-center max-w-2xl mx-auto mb-12",children:[e.jsx("h1",{className:"text-4xl font-bold text-primary",children:"Get in touch"}),e.jsx("p",{className:"text-muted-foreground mt-3",children:"We'd love to hear from you. Send us a message or chat with us on WhatsApp."})]}),e.jsxs("div",{className:"grid lg:grid-cols-[380px_1fr] gap-8",children:[e.jsxs("div",{className:"space-y-4",children:[[{I:b,t:"Call Us",v:"+971 50 864 1669"},{I:h,t:"Email",v:"info@amazingsoko.com"},{I:f,t:"Office",v:"KN 4 Ave, Kigali, Rwanda"}].map(({I:s,t:a,v:t})=>e.jsxs("div",{className:"bg-card border border-border rounded-2xl p-5 flex gap-4 items-start",children:[e.jsx("div",{className:"w-11 h-11 rounded-xl bg-brand/10 grid place-items-center text-brand",children:e.jsx(s,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:a}),e.jsx("div",{className:"font-semibold mt-0.5",children:t})]})]},a)),e.jsxs("a",{href:y("Hi Amazing Soko!"),target:"_blank",rel:"noreferrer",className:"flex items-center justify-center gap-2 bg-[#25D366] text-white py-3 rounded-2xl font-semibold",children:[e.jsx(j,{className:"w-5 h-5"})," Chat on WhatsApp"]})]}),e.jsxs("form",{onSubmit:i,className:"bg-card border border-border rounded-3xl p-8 space-y-4",children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsx(d,{label:"Name",name:"name",required:!0}),e.jsx(d,{label:"Email",name:"email",type:"email",required:!0})]}),e.jsx(d,{label:"Subject",name:"subject"}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Message"}),e.jsx("textarea",{name:"message",rows:6,required:!0,className:"mt-1 w-full bg-secondary rounded-xl px-4 py-3 text-sm outline-none"})]}),e.jsx("button",{disabled:n,className:"w-full bg-primary text-primary-foreground py-3 rounded-full font-semibold hover:opacity-90 transition disabled:cursor-not-allowed disabled:opacity-60",children:n?"Sending…":"Send Message"})]})]})]})}function d({label:n,name:o,type:i="text",required:s}){return e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:[n,s&&" *"]}),e.jsx("input",{name:o,type:i,required:s,className:"mt-1 w-full bg-secondary rounded-xl px-4 py-3 text-sm outline-none"})]})}export{v as component};
