@props(['product'])
@if ($product)
@php
$oldPrice = (float) ($product->old_price ?? 0);
$newPrice = (float) ($product->new_price ?? 0);
$discount = ($oldPrice > 0) ? round((($oldPrice - $newPrice) / $oldPrice) * 100) : 0;
$firstImg = $product->images->first()->image ?? 'placeholder.jpg';
$favouriteIds = $favouriteIds ?? []; // Ensure variable exists
@endphp
merge(['class' => 'v-product-card group relative bg-white rounded-[12px] border border-black/[0.06] flex flex-col h-full overflow-hidden transition-all duration-500 ease-[cubic-bezier(0.2,1,0.3,1)] hover:-translate-y-[5px] hover:shadow-[0_20px_40px_rgba(43,45,66,0.08)] hover:border-[#2B2D42]/20']) }}>
@if ($discount > 0)
-{{ $discount }}%
@endif
{{ $product->name }}
৳{{ number_format($newPrice) }}
@if ($oldPrice > $newPrice)
৳{{ number_format($oldPrice) }}
@endif
{{ $product->category->name ?? 'New Arrival' }}
@endif