@extends('admin.admin_master')
@section('admin')
<div class="page-content">
    <div class="container-fluid">
        <h2 class="mb-4 d-flex align-items-center">
            <span class="dashboard-title-icon">
                <span class="dashboard-title-icon-dot"></span>
            </span>
            Admin Dashboard
        </h2>
        <div class="row mb-4">
            <div class="col-md-3">
                <div class="card text-center shadow">
                    <div class="card-body">
                        <h6>Total Workflows</h6>
                        <h2>{{ $workflowCount }}</h2>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="card text-center shadow">
                    <div class="card-body">
                        <h6>Total Folders</h6>
                        <h2>{{ $folderCount }}</h2>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="card text-center shadow">
                    <div class="card-body">
                        <h6>Total Documents</h6>
                        <h2>{{ $documentCount }}</h2>
                    </div>
                </div>
            </div>
            <div class="col-md-3">
                <div class="card text-center shadow">
                    <div class="card-body">
                        <h6>Total Users</h6>
                        <h2>{{ $userCount }}</h2>
                    </div>
                </div>
            </div>
        </div>
        <div class="row mb-4">
            <div class="col-md-6">
                <div class="card shadow">
                    <div class="card-header bg-primary text-white">Recent Workflows</div>
                    <div class="card-body">
                        <ul class="list-group">
                            @foreach($recentWorkflows as $wf)
                                <li class="list-group-item d-flex justify-content-between align-items-center">
                                    <span>{{ $wf->name }}</span>
                                    <span class="badge bg-secondary">{{ $wf->created_at->format('Y-m-d') }}</span>
                                </li>
                            @endforeach
                        </ul>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="card shadow">
                    <div class="card-header bg-success text-white">Recent Folders</div>
                    <div class="card-body">
                        <ul class="list-group">
                            @foreach($recentFolders as $folder)
                                <li class="list-group-item d-flex justify-content-between align-items-center">
                                    <span>{{ $folder->name }}</span>
                                    <span class="badge bg-info">{{ $folder->created_at->format('Y-m-d') }}</span>
                                </li>
                            @endforeach
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="row mb-4">
            <div class="col-md-12">
                <div class="card shadow">
                    <div class="card-header bg-info text-white">Recent Documents</div>
                    <div class="card-body">
                        <ul class="list-group">
                            @foreach($recentDocuments as $doc)
                                <li class="list-group-item d-flex justify-content-between align-items-center">
                                    <span>{{ $doc->title }}</span>
                                    <span class="badge bg-warning">{{ $doc->created_at->format('Y-m-d') }}</span>
                                </li>
                            @endforeach
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
