import{c as d,x as p,e as u,u as h,s as x,j as e,X as f}from"./index-D5aSL5Lk.js";import{B as i}from"./Footer-B625QnUy.js";import{C as g}from"./card-Xe3d9dhi.js";import{O as v}from"./OptimizedImage-BDiwQDT8.js";/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const j=d("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),C=()=>{const{comparisonIds:s,removeFromComparison:o,clearComparison:t}=p(),n=u(),{data:l=[]}=h({queryKey:["comparison-bar-products",s],queryFn:async()=>{if(s.length===0)return[];const{data:a,error:r}=await x.from("products").select("id, name, image_url").in("id",s).eq("is_active",!0);if(r)throw r;return s.map(m=>a.find(c=>c.id===m)).filter(Boolean)},enabled:s.length>0});return s.length===0?null:e.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 bg-background border-t shadow-lg animate-in slide-in-from-bottom",children:e.jsx(g,{className:"border-0 rounded-none",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1 min-w-0",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsxs("p",{className:"text-sm font-semibold",children:["Comparație produse: ",s.length,"/4"]})}),e.jsx("div",{className:"flex items-center gap-2 overflow-x-auto flex-1 min-w-0",children:l.map(a=>e.jsxs("div",{className:"relative flex-shrink-0 group",children:[e.jsx("div",{className:"w-16 h-16 bg-muted rounded overflow-hidden border",children:e.jsx(v,{src:a.image_url||"/placeholder.svg",alt:a.name,className:"w-full h-full",objectFit:"contain",loading:"lazy"})}),e.jsx("button",{onClick:()=>o(a.id),className:"absolute -top-2 -right-2 bg-destructive text-destructive-foreground rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity","aria-label":"Remove from comparison",children:e.jsx(f,{className:"h-3 w-3"})})]},a.id))})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(i,{variant:"ghost",size:"sm",onClick:t,children:"Șterge tot"}),e.jsxs(i,{onClick:()=>n("/compare"),size:"sm",className:"bg-primary text-primary-foreground hover:bg-primary/90",children:["Compară acum",e.jsx(j,{className:"ml-2 h-4 w-4"})]})]})]})})})})};export{j as A,C};