<?php
/**
 * Enfhess Marketplace - Author Dynamic Financial & Asset Metric Cards Component
 * Path: seller/report-card.php
 */

if (!isset($totalSold) || !isset($totalNetIncome) || !isset($currentBalance)) {
    die('Structural data interface hydration values context array parameters missing.');
}

// Process relative milestones profiles configuration bounds
$salesGoalTarget = 500;
$salesPercentage = $totalSold > 0 ? round(($totalSold / $salesGoalTarget) * 100, 1) : 0.0;
?>

<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-6">
    
    <div class="glass-card p-6 rounded-2xl border border-slate-800/80 relative overflow-hidden group bg-gradient-to-b from-slate-950/40 to-slate-950/80 shadow-xl">
        <div class="absolute -top-4 -right-4 w-24 h-24 bg-nftAccentCyan/5 rounded-full blur-xl pointer-events-none transition-all group-hover:bg-nftAccentCyan/10"></div>
        <div class="flex items-center justify-between">
            <div class="space-y-1.5">
                <p class="text-[10px] font-bold text-nftTextGray uppercase tracking-widest">// Available Balance</p>
                <h3 class="text-2xl font-black text-white tracking-tight font-mono">
                    <?php echo htmlspecialchars(format_currency($currentBalance), ENT_QUOTES, 'UTF-8'); ?>
                </h3>
            </div>
            <div class="w-11 h-11 rounded-xl bg-nftAccentCyan/10 border border-nftAccentCyan/20 flex items-center justify-center text-nftAccentCyan text-lg shadow-inner">
                <i class="fa-solid fa-wallet"></i>
            </div>
        </div>
        <div class="mt-5 pt-4 border-t border-slate-900/60 flex items-center text-[10px] text-emerald-400 font-bold tracking-wide uppercase">
            <i class="fa-solid fa-money-bill-transfer mr-1.5 text-xs animate-pulse"></i> 
            <span>Cleared Escrow Balance Asset Pool</span>
        </div>
    </div>

    <div class="glass-card p-6 rounded-2xl border border-slate-800/80 relative overflow-hidden group bg-gradient-to-b from-slate-950/40 to-slate-950/80 shadow-xl">
        <div class="absolute -top-4 -right-4 w-24 h-24 bg-nftAccentPurple/5 rounded-full blur-xl pointer-events-none transition-all group-hover:bg-nftAccentPurple/10"></div>
        <div class="flex items-center justify-between">
            <div class="space-y-1.5">
                <p class="text-[10px] font-bold text-nftTextGray uppercase tracking-widest">// Total Units Sold</p>
                <h3 class="text-2xl font-black text-white tracking-tight font-mono">
                    <?php echo number_format($totalSold); ?> <span class="text-xs text-slate-500 font-normal">items</span>
                </h3>
            </div>
            <div class="w-11 h-11 rounded-xl bg-nftAccentPurple/10 border border-nftAccentPurple/20 flex items-center justify-center text-nftAccentPurple text-lg shadow-inner">
                <i class="fa-solid fa-bag-shopping"></i>
            </div>
        </div>
        <div class="mt-5 pt-4 border-t border-slate-900/60 flex items-center justify-between text-[10px] text-nftTextGray">
            <div class="w-4/5 bg-slate-950 h-1.5 rounded-full overflow-hidden relative border border-slate-900">
                <div class="bg-gradient-to-r from-nftAccentCyan to-nftAccentPurple h-full rounded-full" style="width: <?php echo min($salesPercentage, 100); ?>%"></div>
            </div>
            <span class="font-mono font-bold text-white text-[10px] ml-2"><?php echo $salesPercentage; ?>%</span>
        </div>
    </div>

    <div class="glass-card p-6 rounded-2xl border border-slate-800/80 relative overflow-hidden group bg-gradient-to-b from-slate-950/40 to-slate-950/80 shadow-xl">
        <div class="absolute -top-4 -right-4 w-24 h-24 bg-emerald-500/5 rounded-full blur-xl pointer-events-none transition-all group-hover:bg-emerald-500/10"></div>
        <div class="flex items-center justify-between">
            <div class="space-y-1.5">
                <p class="text-[10px] font-bold text-nftTextGray uppercase tracking-widest">// Calculated Net Income</p>
                <h3 class="text-2xl font-black bg-clip-text text-transparent bg-gradient-to-r from-white via-white to-nftAccentCyan tracking-tight font-mono">
                    <?php echo htmlspecialchars(format_currency($totalNetIncome), ENT_QUOTES, 'UTF-8'); ?>
                </h3>
            </div>
            <div class="w-11 h-11 rounded-xl bg-emerald-500/10 border border-emerald-500/20 flex items-center justify-center text-emerald-400 text-lg shadow-inner">
                <i class="fa-solid fa-chart-line"></i>
            </div>
        </div>
        <div class="mt-5 pt-4 border-t border-slate-900/60 flex items-center justify-between text-[10px] text-nftTextGray font-medium tracking-wide">
            <span class="text-slate-500">Net Adjusted After System Splits</span>
            <i class="fa-solid fa-arrow-trend-up text-emerald-400 text-xs"></i>
        </div>
    </div>

</div>
