@extends('layouts.admin')

@section('title', 'Dashboard')

@section('content')
<div class="page-header">
    <h1>Dashboard</h1>
    <p>Platform overview and recent activity</p>
</div>

<div class="stat-grid">
    @foreach([
        ['Total Users', number_format($stats['total_users']), '👤'],
        ['Total Transactions', number_format($stats['total_transactions']), '📊'],
        ['Total Deposit', '$'.number_format($stats['total_deposit'], 2), '➕'],
        ['Pending Deposit', '$'.number_format($stats['pending_deposit'], 2), '⏳'],
        ['Total Withdraw', '$'.number_format($stats['total_withdraw'], 2), '📤'],
        ['Pending Withdraw', '$'.number_format($stats['pending_withdraw'], 2), '➖'],
        ['Total Transfer', '$'.number_format($stats['total_transfer'], 2), '🔄'],
        ['Today Transfer', '$'.number_format($stats['today_transfer'], 2), '📅'],
    ] as [$label, $value, $icon])
    <div class="stat-tile">
        <div><p class="stat-tile-label">{{ $label }}</p><p class="stat-tile-value">{{ $value }}</p></div>
        <div class="stat-tile-icon">{{ $icon }}</div>
    </div>
    @endforeach
</div>

<div class="md-card">
    <div class="md-card-header">Recent System Activity</div>
    <div class="md-card-body" style="padding:0">
        <table class="md-table">
            <tbody>
                @forelse($activities as $activity)
                <tr>
                    <td><strong>{{ $activity->user->name }}</strong><br><small style="color:var(--md-on-surface-variant)">{{ ucfirst($activity->type) }}</small></td>
                    <td style="text-align:right;font-weight:600">${{ number_format($activity->amount, 2) }} {{ $activity->outcome }}</td>
                </tr>
                @empty
                <tr><td colspan="2" style="text-align:center;padding:2rem;color:var(--md-on-surface-variant)">No activity yet</td></tr>
                @endforelse
            </tbody>
        </table>
    </div>
</div>
@endsection
