<?php $__env->startSection('title', $product->name ?? 'Product Detail'); ?>

<?php $__env->startSection('content'); ?>
<div class="container py-8">

    
    <div class="row mb-6">
        
        <div class="col-md-6">
            <?php if($product->images->count()): ?>
            <div id="productImagesCarousel" class="carousel slide" data-bs-ride="carousel">
                <div class="carousel-inner">
                    <?php $__currentLoopData = $product->images; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k => $image): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="carousel-item <?php echo e($k === 0 ? 'active' : ''); ?>">
                        <img src="<?php echo e(asset('storage/'.$image->image_path)); ?>" class="d-block w-100" style="height:400px; object-fit:cover;" alt="<?php echo e($product->name); ?>">
                    </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
                <button class="carousel-control-prev" type="button" data-bs-target="#productImagesCarousel" data-bs-slide="prev">
                    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                    <span class="visually-hidden">Previous</span>
                </button>
                <button class="carousel-control-next" type="button" data-bs-target="#productImagesCarousel" data-bs-slide="next">
                    <span class="carousel-control-next-icon" aria-hidden="true"></span>
                    <span class="visually-hidden">Next</span>
                </button>
            </div>
            <?php else: ?>
            <img src="<?php echo e(asset('images/no-image.png')); ?>" class="w-100 shadow-sm" style="height:400px;object-fit:cover;" alt="No Image Available">
            <?php endif; ?>
        </div>

        
        <div class="col-md-6">
            <h1 class="fw-bold mb-3"><?php echo e($product->name); ?></h1>
            <p class="text-green-700 fw-bold h4 mb-3">$<?php echo e(number_format($product->price, 2)); ?></p>
            <?php if($product->category): ?>
                <p class="mb-3"><strong>Category:</strong> <?php echo e($product->category->name); ?></p>
            <?php endif; ?>
            <p class="mb-4"><?php echo e($product->description); ?></p>
            <a href="#" class="btn btn-success btn-lg">Add to Cart</a>
        </div>
    </div>

    
    <?php if(isset($relatedProducts) && $relatedProducts->count()): ?>
    <div class="mt-8">
        <h3 class="fw-bold mb-4">Related Products</h3>
        <div class="row g-4">
            <?php $__currentLoopData = $relatedProducts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rProduct): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="col-md-3">
                <div class="card h-100 shadow-sm text-center">
                    <?php if($rProduct->images->first()): ?>
                    <img src="<?php echo e(asset('storage/'.$rProduct->images->first()->image_path)); ?>" class="card-img-top" style="height:200px;object-fit:cover;" alt="<?php echo e($rProduct->name); ?>">
                    <?php else: ?>
                    <img src="<?php echo e(asset('images/no-image.png')); ?>" class="card-img-top" style="height:200px;object-fit:cover;" alt="No Image">
                    <?php endif; ?>
                    <div class="card-body">
                        <h6><?php echo e($rProduct->name); ?></h6>
                        <p class="text-green-700 fw-bold">$<?php echo e(number_format($rProduct->price, 2)); ?></p>
                        <a href="<?php echo e(route('frontend.product_detail', $rProduct->id)); ?>" class="btn btn-success btn-sm">View Details</a>
                    </div>
                </div>
            </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    </div>
    <?php endif; ?>

</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('frontend.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /usr/local/var/www/memafarms/resources/views/frontend/product_detail.blade.php ENDPATH**/ ?>