function Produit({go,product,addToCart,openProduct}){
const {Breadcrumbs,Card,Button,Badge,PriceTag,QuantityStepper} = window.IDHDesignSystem_6f4674;
const {cartridges} = window.IDH_DATA;
function Icon({name,size=18}){const pascal=name.replace(/(^\w|-\w)/g,c=>c.replace('-','').toUpperCase());const nodes=window.lucide&&window.lucide.icons[pascal];const inner=nodes?nodes.map(([tag,attrs])=>'<'+tag+' '+Object.entries(attrs).map(([k,v])=>k+'="'+v+'"').join(' ')+'/>').join(''):'';const svg='<svg xmlns="http://www.w3.org/2000/svg" width="'+size+'" height="'+size+'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">'+inner+'</svg>';return React.createElement('span',{style:{display:'inline-flex',width:size,height:size},dangerouslySetInnerHTML:{__html:svg}});}

if(!product){
return React.createElement('div',{style:{maxWidth:1240,margin:'0 auto',padding:'32px 32px 80px'}},
React.createElement(Card,{padding:'48px'},
React.createElement('div',{style:{textAlign:'center',color:'var(--text-muted)',fontFamily:'var(--font-body)'}},
'Aucun produit sélectionné.',
React.createElement('div',{style:{marginTop:16}},React.createElement(Button,{variant:'primary',onClick:()=>go('catalogue')},'Parcourir le catalogue'))
)
)
);
}

const [qty,setQty]=React.useState(1);
const stockMap={in:{tone:'success',label:'En stock'},low:{tone:'warning',label:'Stock limité'},out:{tone:'danger',label:'Rupture de stock'}}[product.stock]||{tone:'success',label:'En stock'};

const similar = cartridges.filter(function(p){return p.brand===product.brand && p.ref!==product.ref;}).slice(0,4);

const photo = React.createElement('div',{style:{aspectRatio:'1/1',background:'var(--color-gray-50)',borderRadius:'var(--radius-lg)',border:'1px solid var(--border-default)',display:'flex',alignItems:'center',justifyContent:'center',overflow:'hidden',padding:32}},
React.createElement(window.ProductImage,{icon:product.icon,size:220,photo:product.photo&&('assets/products/'+product.photo)})
);

const specRows = [
{label:'Marque',value:product.brand},
{label:'Référence',value:product.ref},
{label:'Catégorie',value:product.cat||'—'},
{label:'Disponibilité',value:stockMap.label}
];

const specTable = React.createElement(Card,{padding:'20px 22px'},
React.createElement('div',{style:{fontFamily:'var(--font-display)',fontWeight:700,fontSize:15,color:'var(--text-primary)',marginBottom:12}},'Caractéristiques'),
specRows.map(function(r,i){
return React.createElement('div',{key:r.label,style:{display:'flex',justifyContent:'space-between',padding:'9px 0',borderTop:i>0?'1px solid var(--border-default)':'none',fontFamily:'var(--font-body)',fontSize:13.5}},
React.createElement('span',{style:{color:'var(--text-muted)'}},r.label),
React.createElement('span',{style:{color:'var(--text-primary)',fontWeight:600}},r.value)
);
}),
product.description&&React.createElement('div',{style:{marginTop:14,paddingTop:14,borderTop:'1px solid var(--border-default)',fontFamily:'var(--font-body)',fontSize:13.5,color:'var(--text-secondary)',lineHeight:1.6}},product.description)
);

const buyBox = React.createElement(Card,{padding:'26px',elevated:true},
React.createElement('div',{style:{fontFamily:'var(--font-body)',fontSize:12.5,fontWeight:700,color:'var(--color-orange-600)',textTransform:'uppercase',letterSpacing:'var(--tracking-wide)'}},product.brand),
React.createElement('h1',{style:{fontFamily:'var(--font-display)',fontWeight:800,fontSize:24,color:'var(--text-primary)',margin:'8px 0 4px',lineHeight:1.25}},product.name),
React.createElement('div',{style:{fontFamily:'var(--font-body)',fontSize:13,color:'var(--text-muted)',marginBottom:14}},'Réf. ',product.ref),
React.createElement(Badge,{tone:stockMap.tone},stockMap.label),
React.createElement('div',{style:{marginTop:16}},React.createElement(PriceTag,{price:product.price,size:'lg'})),
product.description&&React.createElement('p',{style:{fontFamily:'var(--font-body)',fontSize:14,color:'var(--text-secondary)',lineHeight:1.7,marginTop:16}},product.description),
React.createElement('div',{style:{display:'flex',alignItems:'center',gap:16,marginTop:22}},
React.createElement(QuantityStepper,{value:qty,onChange:setQty}),
React.createElement(Button,{variant:'primary',size:'lg',disabled:product.stock==='out',onClick:function(){for(let i=0;i<qty;i++){addToCart(product);}}},product.stock==='out'?'Indisponible':'Ajouter au panier'))
);

const similarSection = similar.length>0 ? React.createElement('div',{style:{marginTop:56}},
React.createElement('div',{style:{fontFamily:'var(--font-display)',fontWeight:700,fontSize:20,color:'var(--text-primary)',marginBottom:20}},'Autres références '+product.brand),
React.createElement('div',{style:{display:'grid',gridTemplateColumns:'repeat(4,1fr)',gap:18}},
similar.map(function(p){
return React.createElement(window.IDHDesignSystem_6f4674.ProductCard,{
key:p.ref,
image:React.createElement(window.ProductImage,{icon:p.icon,photo:p.photo&&('assets/products/'+p.photo)}),
brand:p.brand,name:p.name,sku:p.ref,price:p.price,stock:p.stock,
onAdd:function(){addToCart(p);},
onOpen:function(){openProduct(p);window.scrollTo(0,0);}
});
})
)
) : null;

return React.createElement('div',{style:{maxWidth:1240,margin:'0 auto',padding:'32px 32px 80px'}},
React.createElement(Breadcrumbs,{items:[{href:'accueil',label:'Accueil'},{href:'catalogue',label:'Fourniture & Consommables'},{href:'produit',label:product.name}],onNavigate:go}),
React.createElement('div',{style:{display:'grid',gridTemplateColumns:'0.9fr 1.1fr',gap:36,marginTop:28,alignItems:'start'}},
photo,
React.createElement('div',{style:{display:'flex',flexDirection:'column',gap:20}},buyBox,specTable)),
similarSection);
}
window.Produit = Produit;
