<?php $__env->startSection('title', 'Customer Bids CRM – Admin Console'); ?>
<?php $__env->startSection('page_title', 'Customer Bid Management'); ?>

<?php $__env->startSection('content'); ?>
<div class="space-y-6">
    
    <!-- Top Stats Row -->
    <div class="grid grid-cols-2 sm:grid-cols-6 gap-3">
        <a href="<?php echo e(route('admin.bids.index')); ?>" class="p-3 rounded-xl border transition <?php echo e(!request('status') ? 'bg-red-600/20 border-red-500' : 'bg-slate-900 border-white/10 hover:bg-white/5'); ?>">
            <span class="text-[10px] uppercase font-bold text-slate-400 block">All Bids</span>
            <span class="text-xl font-extrabold text-white"><?php echo e($stats['total']); ?></span>
        </a>
        <a href="<?php echo e(route('admin.bids.index', ['status' => 'pending'])); ?>" class="p-3 rounded-xl border transition <?php echo e(request('status') === 'pending' ? 'bg-amber-600/20 border-amber-500' : 'bg-slate-900 border-white/10 hover:bg-white/5'); ?>">
            <span class="text-[10px] uppercase font-bold text-amber-400 block">Pending</span>
            <span class="text-xl font-extrabold text-amber-400"><?php echo e($stats['pending']); ?></span>
        </a>
        <a href="<?php echo e(route('admin.bids.index', ['status' => 'approved'])); ?>" class="p-3 rounded-xl border transition <?php echo e(request('status') === 'approved' ? 'bg-blue-600/20 border-blue-500' : 'bg-slate-900 border-white/10 hover:bg-white/5'); ?>">
            <span class="text-[10px] uppercase font-bold text-blue-400 block">Approved</span>
            <span class="text-xl font-extrabold text-blue-400"><?php echo e($stats['approved']); ?></span>
        </a>
        <a href="<?php echo e(route('admin.bids.index', ['status' => 'submitted'])); ?>" class="p-3 rounded-xl border transition <?php echo e(request('status') === 'submitted' ? 'bg-purple-600/20 border-purple-500' : 'bg-slate-900 border-white/10 hover:bg-white/5'); ?>">
            <span class="text-[10px] uppercase font-bold text-purple-400 block">Floor Live</span>
            <span class="text-xl font-extrabold text-purple-400"><?php echo e($stats['submitted']); ?></span>
        </a>
        <a href="<?php echo e(route('admin.bids.index', ['status' => 'won'])); ?>" class="p-3 rounded-xl border transition <?php echo e(request('status') === 'won' ? 'bg-emerald-600/20 border-emerald-500' : 'bg-slate-900 border-white/10 hover:bg-white/5'); ?>">
            <span class="text-[10px] uppercase font-bold text-emerald-400 block">Won</span>
            <span class="text-xl font-extrabold text-emerald-400"><?php echo e($stats['won']); ?></span>
        </a>
        <a href="<?php echo e(route('admin.bids.index', ['status' => 'lost'])); ?>" class="p-3 rounded-xl border transition <?php echo e(request('status') === 'lost' ? 'bg-slate-700/40 border-slate-500' : 'bg-slate-900 border-white/10 hover:bg-white/5'); ?>">
            <span class="text-[10px] uppercase font-bold text-slate-400 block">Lost / Outbid</span>
            <span class="text-xl font-extrabold text-slate-400"><?php echo e($stats['lost']); ?></span>
        </a>
    </div>

    <!-- Search & Filter Console -->
    <div class="bg-slate-900 border border-white/10 rounded-2xl p-4 flex flex-col sm:flex-row items-center justify-between gap-4">
        <form method="GET" action="<?php echo e(route('admin.bids.index')); ?>" class="w-full sm:w-auto flex-1 flex items-center gap-2">
            <?php if(request('status')): ?>
                <input type="hidden" name="status" value="<?php echo e(request('status')); ?>">
            <?php endif; ?>
            <div class="relative flex-1">
                <i class="fa-solid fa-magnifying-glass absolute left-3.5 top-3 text-slate-400 text-xs"></i>
                <input type="text" name="search" value="<?php echo e(request('search')); ?>" placeholder="Search customer, phone, lot #, model..." class="w-full bg-slate-950 border border-white/10 rounded-xl pl-9 pr-4 py-2 text-white text-xs focus:border-red-500 focus:outline-none">
            </div>
            <button type="submit" class="px-4 py-2 rounded-xl bg-white/10 hover:bg-white/20 text-white font-bold text-xs transition">
                Search
            </button>
            <?php if(request('search') || request('status')): ?>
                <a href="<?php echo e(route('admin.bids.index')); ?>" class="px-3 py-2 rounded-xl text-slate-400 hover:text-white text-xs transition">
                    Clear
                </a>
            <?php endif; ?>
        </form>
    </div>

    <!-- Bids Table -->
    <div class="bg-slate-900 border border-white/10 rounded-2xl overflow-hidden shadow-xl">
        <div class="overflow-x-auto">
            <table class="w-full text-left text-xs">
                <thead class="bg-slate-950 text-slate-400 uppercase tracking-wider text-[10px] border-b border-white/10">
                    <tr>
                        <th class="p-4">Customer Details</th>
                        <th class="p-4">Vehicle / Lot</th>
                        <th class="p-4">Auction House</th>
                        <th class="p-4">Max Authorized JPY</th>
                        <th class="p-4">Estimated Landed BDT</th>
                        <th class="p-4">Deposit Status</th>
                        <th class="p-4">Status</th>
                        <th class="p-4 text-right">Actions</th>
                    </tr>
                </thead>
                <tbody class="divide-y divide-white/5 text-slate-300">
                    <?php $__empty_1 = true; $__currentLoopData = $bids; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $bid): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <tr class="hover:bg-white/5 transition">
                            <td class="p-4">
                                <a href="<?php echo e(route('admin.customers.show', $bid->user->customer->id ?? 1)); ?>" class="font-bold text-white hover:text-red-400">
                                    <?php echo e($bid->user->name ?? 'Customer'); ?>

                                </a>
                                <p class="text-[11px] text-slate-400"><?php echo e($bid->user->phone ?? 'No Phone'); ?></p>
                            </td>
                            <td class="p-4">
                                <p class="font-bold text-white"><?php echo e($bid->auctionVehicle->year ?? ''); ?> <?php echo e($bid->auctionVehicle->brand ?? ''); ?> <?php echo e($bid->auctionVehicle->model ?? 'Vehicle'); ?></p>
                                <span class="text-[10px] text-slate-400">Lot #<?php echo e($bid->auctionVehicle->lot_number ?? 'N/A'); ?> · Grade <?php echo e($bid->auctionVehicle->grade ?? '4.5'); ?></span>
                            </td>
                            <td class="p-4 font-medium text-slate-300">
                                <?php echo e($bid->auctionVehicle->auctionHouse->name ?? 'USS'); ?>

                            </td>
                            <td class="p-4 font-bold text-amber-400">
                                ¥<?php echo e(number_format($bid->max_bid_jpy)); ?>

                            </td>
                            <td class="p-4 font-bold text-white">
                                ৳<?php echo e(number_format($bid->estimated_landed_cost_bdt)); ?>

                            </td>
                            <td class="p-4">
                                <span class="text-[10px] font-bold uppercase px-2 py-0.5 rounded-full <?php echo e($bid->deposit_status === 'verified' ? 'bg-emerald-500/20 text-emerald-400' : 'bg-amber-500/20 text-amber-400'); ?>">
                                    ৳<?php echo e(number_format($bid->deposit_amount_bdt ?? 200000)); ?> (<?php echo e($bid->deposit_status ?? 'pending'); ?>)
                                </span>
                            </td>
                            <td class="p-4">
                                <?php
                                    $badgeStyles = [
                                        'pending' => 'bg-amber-500/20 text-amber-300 border-amber-500/30',
                                        'approved' => 'bg-blue-500/20 text-blue-300 border-blue-500/30',
                                        'submitted' => 'bg-purple-500/20 text-purple-300 border-purple-500/30',
                                        'bidding' => 'bg-red-500/20 text-red-300 border-red-500/30 animate-pulse',
                                        'won' => 'bg-emerald-500/20 text-emerald-300 border-emerald-500/30',
                                        'lost' => 'bg-slate-700/40 text-slate-400 border-slate-600/30',
                                        'rejected' => 'bg-rose-500/20 text-rose-300 border-rose-500/30',
                                        'cancelled' => 'bg-rose-500/20 text-rose-300 border-rose-500/30'
                                    ];
                                ?>
                                <span class="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold uppercase border <?php echo e($badgeStyles[$bid->status] ?? 'bg-slate-800 text-slate-300'); ?>">
                                    <?php echo e($bid->status); ?>

                                </span>
                            </td>
                            <td class="p-4 text-right">
                                <a href="<?php echo e(route('admin.bids.show', $bid->id)); ?>" class="px-3 py-1.5 rounded-lg bg-red-600 hover:bg-red-700 text-white font-bold transition">
                                    Manage
                                </a>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="8" class="p-8 text-center text-slate-400">
                                No bids found matching the selected filters.
                            </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
        <div class="p-4 border-t border-white/10">
            <?php echo e($bids->links()); ?>

        </div>
    </div>

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

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /Users/redwoneferdous/Desktop/MotoSolution/resources/views/admin/bids/index.blade.php ENDPATH**/ ?>