<?php
$page_title = 'Digital Procurement Marketplace';
require_once __DIR__ . '/../config.php';
if (session_status() === PHP_SESSION_NONE) { session_start(); }
if (!isset($_SESSION['admin_id'])) { redirect(SITE_URL . '/admin/login.php'); }
require_once __DIR__ . '/header.php';
?>
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:24px;">
    <div>
        <h2 style="font-family:'Outfit',sans-serif; font-size:1.8rem; color:#0f172a; margin:0;"><i class="fas fa-store-alt" style="color:#14b8a6; margin-right:10px;"></i>Digital Procurement Marketplace</h2>
        <p style="color:#64748b; font-size:0.95rem; margin-top:5px;">Vendor bidding, reverse auctions, dynamic sourcing, and supplier financing.</p>
    </div>
    <button style="background:linear-gradient(135deg,#14b8a6,#0d9488); color:#fff; border:none; padding:10px 20px; border-radius:8px; font-size:0.9rem; cursor:pointer; font-weight:600;"><i class="fas fa-gavel"></i> New Auction</button>
</div>
<div class="grid-4" style="margin-bottom:24px;">
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #14b8a6;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">ACTIVE BIDS</div>
        <div style="font-size:1.6rem; font-weight:700; color:#0f172a;">24</div>
        <div style="color:#14b8a6; font-size:0.8rem; margin-top:5px;"><i class="fas fa-gavel"></i> ₹8.4 Cr Value</div>
    </div>
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #10b981;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">SAVINGS VIA AUCTION</div>
        <div style="font-size:1.6rem; font-weight:700; color:#10b981;">₹1.8 Cr</div>
        <div style="color:#10b981; font-size:0.8rem; margin-top:5px;"><i class="fas fa-percentage"></i> 12% Avg Savings</div>
    </div>
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #3b82f6;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">REGISTERED VENDORS</div>
        <div style="font-size:1.6rem; font-weight:700; color:#0f172a;">480</div>
        <div style="color:#3b82f6; font-size:0.8rem; margin-top:5px;"><i class="fas fa-users"></i> Verified Suppliers</div>
    </div>
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0; border-top:4px solid #f59e0b;">
        <div style="color:#64748b; font-size:0.8rem; font-weight:600; margin-bottom:8px;">FINANCING</div>
        <div style="font-size:1.6rem; font-weight:700; color:#0f172a;">₹4.2 Cr</div>
        <div style="color:#f59e0b; font-size:0.8rem; margin-top:5px;"><i class="fas fa-hand-holding-usd"></i> Supplier Finance</div>
    </div>
</div>
<div class="grid-2">
    <div style="background:#fff; padding:20px; border-radius:12px; border:1px solid #e2e8f0;">
        <h3 style="margin:0 0 15px; font-size:1.15rem; color:#0f172a;"><i class="fas fa-gavel" style="color:#14b8a6; margin-right:8px;"></i>Live Reverse Auctions</h3>
        <?php
        $auctions = [
            ['HR Coil 500T Lot', '8 bidders', '₹2.4 Cr', '2h 15m left', '#ef4444'],
            ['SS 304 Scrap 200T', '5 bidders', '₹85L', '5h 30m left', '#f59e0b'],
            ['Packaging Material Q2', '12 bidders', '₹42L', '1d 4h left', '#3b82f6'],
        ];
        foreach ($auctions as $a): ?>
        <div style="border:1px solid #e2e8f0; border-radius:8px; padding:15px; margin-bottom:10px; border-left:4px solid <?= $a[4] ?>;">
            <div style="display:flex; justify-content:space-between; margin-bottom:5px;">
                <div style="font-weight:600; font-size:0.9rem;"><?= $a[0] ?></div>
                <span style="background:#fef3c7; color:#b45309; padding:3px 8px; border-radius:6px; font-size:0.7rem; font-weight:bold;"><?= $a[3] ?></span>
            </div>
            <div style="font-size:0.8rem; color:#64748b;"><?= $a[1] ?> · Current best: <?= $a[2] ?></div>
        </div>
        <?php endforeach; ?>
        <h3 style="margin:20px 0 15px; font-size:1.15rem; color:#0f172a;"><i class="fas fa-book" style="color:#3b82f6; margin-right:8px;"></i>Vendor Catalog</h3>
        <p style="color:#64748b; font-size:0.85rem;">480 verified vendors across 42 categories. Search and compare suppliers instantly.</p>
        <button style="background:#3b82f6; color:#fff; border:none; padding:8px 16px; border-radius:6px; font-size:0.85rem; cursor:pointer;">Browse Catalog</button>
    </div>
    <div style="background:linear-gradient(135deg,#14b8a6,#0d9488); color:#fff; padding:25px; border-radius:12px; display:flex; flex-direction:column; justify-content:center;">
        <h3 style="margin:0 0 15px; font-size:1.2rem;"><i class="fas fa-hand-holding-usd"></i> Supplier Financing</h3>
        <p style="margin:0 0 15px; font-size:0.85rem; opacity:0.85;">Early payment programs for strategic suppliers.</p>
        <div style="display:flex; justify-content:space-between; font-size:0.85rem; margin-bottom:8px;">
            <span>Active Programs</span><span style="font-weight:bold;">12</span>
        </div>
        <div style="display:flex; justify-content:space-between; font-size:0.85rem; margin-bottom:8px;">
            <span>Finance Disbursed</span><span style="font-weight:bold;">₹4.2 Cr</span>
        </div>
        <div style="display:flex; justify-content:space-between; font-size:0.85rem;">
            <span>Avg Days Early</span><span style="font-weight:bold;">15 days</span>
        </div>
    </div>
</div>
<?php require_once __DIR__ . '/footer.php'; ?>
