<?php $__env->startSection('title', 'Dashboard'); ?>
<?php $__env->startSection('page-title', 'Dashboard'); ?>

<?php $__env->startSection('content'); ?>
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3 md:gap-4 lg:gap-6 mb-4 md:mb-6 lg:mb-8">
    <div class="bg-white p-4 md:p-5 lg:p-6 rounded-2xl shadow-md border border-[#d1d5db] hover:shadow-lg transition-shadow">
        <div class="flex items-center justify-between mb-2">
            <h3 class="text-black text-xs md:text-sm font-semibold">Total Products</h3>
            <svg class="w-6 h-6 md:w-8 md:h-8 text-black" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"></path>
            </svg>
        </div>
        <p class="text-2xl sm:text-3xl md:text-4xl font-serif font-bold text-black"><?php echo e($productsCount); ?></p>
    </div>
    <div class="bg-white p-4 md:p-5 lg:p-6 rounded-2xl shadow-md border border-[#d1d5db] hover:shadow-lg transition-shadow">
        <div class="flex items-center justify-between mb-2">
            <h3 class="text-black text-xs md:text-sm font-semibold">Total Categories</h3>
            <svg class="w-6 h-6 md:w-8 md:h-8 text-black" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"></path>
            </svg>
        </div>
        <p class="text-2xl sm:text-3xl md:text-4xl font-serif font-bold text-black"><?php echo e($categoriesCount); ?></p>
    </div>
    <div class="bg-white p-4 md:p-5 lg:p-6 rounded-2xl shadow-md border border-[#d1d5db] hover:shadow-lg transition-shadow">
        <div class="flex items-center justify-between mb-2">
            <h3 class="text-black text-xs md:text-sm font-semibold">Total Orders</h3>
            <svg class="w-6 h-6 md:w-8 md:h-8 text-black" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z"></path>
            </svg>
        </div>
        <p class="text-2xl sm:text-3xl md:text-4xl font-serif font-bold text-black"><?php echo e($ordersCount); ?></p>
        <?php if($pendingOrdersCount > 0): ?>
            <p class="text-xs md:text-sm text-black mt-2 font-medium"><?php echo e($pendingOrdersCount); ?> pending</p>
        <?php endif; ?>
    </div>
    <div class="bg-white p-4 md:p-5 lg:p-6 rounded-2xl shadow-md border border-[#d1d5db] hover:shadow-lg transition-shadow">
        <div class="flex items-center justify-between mb-2">
            <h3 class="text-black text-xs md:text-sm font-semibold">Total Revenue</h3>
            <svg class="w-6 h-6 md:w-8 md:h-8 text-black" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
            </svg>
        </div>
        <p class="text-2xl sm:text-3xl md:text-4xl font-serif font-bold text-black">R<?php echo e(number_format($totalRevenue, 2)); ?></p>
    </div>
</div>

<div class="grid grid-cols-1 sm:grid-cols-2 gap-3 md:gap-4 lg:gap-6 mb-4 md:mb-6 lg:mb-8">
    <div class="bg-white p-4 md:p-5 lg:p-6 rounded-2xl shadow-md border border-[#d1d5db] hover:shadow-lg transition-shadow">
        <div class="flex items-center justify-between mb-2">
            <h3 class="text-black text-xs md:text-sm font-semibold">Total Inquiries</h3>
            <svg class="w-6 h-6 md:w-8 md:h-8 text-black" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"></path>
            </svg>
        </div>
        <p class="text-2xl sm:text-3xl md:text-4xl font-serif font-bold text-black"><?php echo e($inquiriesCount); ?></p>
        <?php if($pendingInquiriesCount > 0): ?>
            <p class="text-xs md:text-sm text-black mt-2 font-medium"><?php echo e($pendingInquiriesCount); ?> pending</p>
        <?php endif; ?>
    </div>
</div>

<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 md:gap-6 mb-4 md:mb-6">
    <!-- Recent Orders -->
    <div class="bg-white rounded-2xl shadow-md border border-[#d1d5db]">
        <div class="p-4 md:p-6 border-b border-[#d1d5db]">
            <h2 class="text-xl md:text-2xl font-serif font-bold text-black">Recent Orders</h2>
        </div>
        <div class="p-4 md:p-6">
            <?php if($recentOrders->count() > 0): ?>
                <!-- Mobile Card View -->
                <div class="lg:hidden space-y-3">
                    <?php $__currentLoopData = $recentOrders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="bg-[#f3f4f6] p-3 rounded-xl border border-[#d1d5db]">
                            <div class="flex justify-between items-start mb-2">
                                <div>
                                    <p class="font-semibold text-black"><?php echo e($order->order_number); ?></p>
                                    <p class="text-sm text-black"><?php echo e($order->customer_name); ?></p>
                                </div>
                                <span class="px-2 py-1 rounded-full text-xs font-semibold <?php echo e($order->status === 'pending' ? 'bg-[#fef3c7] text-[#92400e]' : ($order->status === 'completed' ? 'bg-[#d1fae5] text-[#065f46]' : ($order->status === 'cancelled' ? 'bg-[#fee2e2] text-[#991b1b]' : 'bg-[#dbeafe] text-[#1e40af]'))); ?>">
                                    <?php echo e(ucfirst($order->status)); ?>

                                </span>
                            </div>
                            <p class="text-sm text-black">R<?php echo e(number_format($order->total, 2)); ?> • <?php echo e($order->created_at->format('M d')); ?></p>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
                
                <!-- Desktop Table View -->
                <div class="hidden lg:block">
                    <table class="w-full">
                        <thead>
                            <tr class="border-b border-[#d1d5db]">
                                <th class="text-left py-2 px-3 text-black font-semibold text-sm">Order</th>
                                <th class="text-left py-2 px-3 text-black font-semibold text-sm">Customer</th>
                                <th class="text-left py-2 px-3 text-black font-semibold text-sm">Total</th>
                                <th class="text-left py-2 px-3 text-black font-semibold text-sm">Status</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $recentOrders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr class="border-b border-[#d1d5db] hover:bg-[#f3f4f6] transition-colors">
                                    <td class="py-2 px-3 text-black text-sm">
                                        <a href="<?php echo e(route('admin.orders.show', $order->id)); ?>" class="hover:text-black transition-colors font-semibold">
                                            <?php echo e($order->order_number); ?>

                                        </a>
                                    </td>
                                    <td class="py-2 px-3 text-black text-sm"><?php echo e($order->customer_name); ?></td>
                                    <td class="py-2 px-3 text-black font-semibold text-sm">R<?php echo e(number_format($order->total, 2)); ?></td>
                                    <td class="py-2 px-3">
                                        <span class="px-2 py-1 rounded-full text-xs font-semibold <?php echo e($order->status === 'pending' ? 'bg-[#fef3c7] text-[#92400e]' : ($order->status === 'completed' ? 'bg-[#d1fae5] text-[#065f46]' : ($order->status === 'cancelled' ? 'bg-[#fee2e2] text-[#991b1b]' : 'bg-[#dbeafe] text-[#1e40af]'))); ?>">
                                            <?php echo e(ucfirst($order->status)); ?>

                                        </span>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
                <div class="mt-4">
                    <a href="<?php echo e(route('admin.orders.index')); ?>" class="text-black hover:text-black transition-colors font-medium inline-flex items-center gap-2 text-sm">
                        View All Orders
                        <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
                        </svg>
                    </a>
                </div>
            <?php else: ?>
                <p class="text-black text-center py-6 text-sm">No orders yet.</p>
            <?php endif; ?>
        </div>
    </div>

    <!-- Recent Inquiries -->
    <div class="bg-white rounded-2xl shadow-md border border-[#d1d5db]">
        <div class="p-4 md:p-6 border-b border-[#d1d5db]">
            <h2 class="text-xl md:text-2xl font-serif font-bold text-black">Recent Inquiries</h2>
        </div>
    <div class="p-4 md:p-6">
        <?php if($recentInquiries->count() > 0): ?>
            <!-- Mobile Card View -->
            <div class="lg:hidden">
                <?php echo $__env->make('admin.dashboard.partials.mobile-inquiries', ['recentInquiries' => $recentInquiries], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
            </div>
            
            <!-- Desktop Table View -->
            <div class="hidden lg:block overflow-x-auto">
                <table class="w-full">
                    <thead>
                        <tr class="border-b border-[#d1d5db]">
                            <th class="text-left py-3 px-4 xl:px-6 text-black font-semibold text-sm md:text-base">Name</th>
                            <th class="text-left py-3 px-4 xl:px-6 text-black font-semibold text-sm md:text-base">Email</th>
                            <th class="text-left py-3 px-4 xl:px-6 text-black font-semibold text-sm md:text-base">Product</th>
                            <th class="text-left py-3 px-4 xl:px-6 text-black font-semibold text-sm md:text-base">Status</th>
                            <th class="text-left py-3 px-4 xl:px-6 text-black font-semibold text-sm md:text-base">Date</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $recentInquiries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $inquiry): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr class="border-b border-[#d1d5db] hover:bg-[#f3f4f6] transition-colors">
                                <td class="py-3 px-4 xl:px-6 text-black text-sm md:text-base"><?php echo e($inquiry->name); ?></td>
                                <td class="py-3 px-4 xl:px-6 text-black text-sm md:text-base break-words"><?php echo e($inquiry->email); ?></td>
                                <td class="py-3 px-4 xl:px-6 text-black text-sm md:text-base"><?php echo e($inquiry->product ? $inquiry->product->name : 'General'); ?></td>
                                <td class="py-3 px-4 xl:px-6">
                                    <span class="px-2 md:px-3 py-1 rounded-full text-xs font-semibold <?php echo e($inquiry->status === 'pending' ? 'bg-[#fef3c7] text-[#92400e]' : 'bg-[#d1fae5] text-[#065f46]'); ?>">
                                        <?php echo e(ucfirst($inquiry->status)); ?>

                                    </span>
                                </td>
                                <td class="py-3 px-4 xl:px-6 text-black text-sm md:text-base"><?php echo e($inquiry->created_at->format('M d, Y')); ?></td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
            <div class="mt-4 md:mt-6">
                <a href="<?php echo e(route('admin.inquiries.index')); ?>" class="text-black hover:text-black transition-colors font-medium inline-flex items-center gap-2 text-sm md:text-base">
                    View All Inquiries
                    <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
                    </svg>
                </a>
            </div>
        <?php else: ?>
            <p class="text-black text-center py-6 md:py-8 text-sm md:text-base">No inquiries yet.</p>
        <?php endif; ?>
    </div>
</div>

<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 md:gap-6">
    <a href="<?php echo e(route('admin.products.create')); ?>" class="bg-black text-white p-6 md:p-8 rounded-2xl shadow-lg text-center hover:bg-black transition-all transform hover:scale-105 border border-black active:scale-95">
        <svg class="w-10 h-10 md:w-12 md:h-12 mx-auto mb-3 md:mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
        </svg>
        <h3 class="text-lg md:text-xl font-serif font-semibold mb-2">Add New Product</h3>
        <p class="text-xs md:text-sm opacity-90">Create a new product listing</p>
    </a>
    <a href="<?php echo e(route('admin.categories.create')); ?>" class="bg-black text-white p-6 md:p-8 rounded-2xl shadow-lg text-center hover:bg-[#1a1a1a] transition-all transform hover:scale-105 border border-[#d1d5db] active:scale-95">
        <svg class="w-10 h-10 md:w-12 md:h-12 mx-auto mb-3 md:mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path>
        </svg>
        <h3 class="text-lg md:text-xl font-serif font-semibold mb-2">Add New Category</h3>
        <p class="text-xs md:text-sm opacity-90">Create a new product category</p>
    </a>
</div>
<?php $__env->stopSection(); ?>



<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\catalogue-builder\resources\views/admin/dashboard/index.blade.php ENDPATH**/ ?>