@extends('layouts.admin')

@section('title', 'Admin Dashboard')

@push('styles')
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap" rel="stylesheet">
<style>
    body {
        font-family: 'Poppins', sans-serif;
    }
    .card-stat {
        transition: transform 0.2s ease-in-out;
    }
    .card-stat:hover {
        transform: scale(1.03);
    }
    .stat-title {
        font-size: 0.9rem;
        color: rgba(255,255,255,0.85);
    }
    .stat-value {
        font-size: 2rem;
        font-weight: 600;
    }
</style>
@endpush

@section('content')
<div class="container py-4">
    <h2 class="mb-4 text-center text-primary fw-bold">Admin Dashboard</h2>

    <div class="row g-4">
        @php
            $tiles = [
                ['title' => 'Registered Students', 'value' => $totalStudents, 'icon' => 'fas fa-user-graduate', 'bg' => '#17a2b8'],
                ['title' => 'Programmes Offered', 'value' => $totalProgrammes, 'icon' => 'fas fa-book-open', 'bg' => '#28a745'],
                ['title' => 'Total Courses', 'value' => $totalCourses, 'icon' => 'fas fa-chalkboard-teacher', 'bg' => '#ffc107', 'color' => '#000'],
                ['title' => 'Accommodation Requests', 'value' => $totalAccommodation, 'icon' => 'fas fa-bed', 'bg' => '#6f42c1'],
                ['title' => 'Deferment Requests', 'value' => $totalDeferments, 'icon' => 'fas fa-envelope-open-text', 'bg' => '#dc3545'],
                ['title' => 'Published Notices', 'value' => $totalNotices, 'icon' => 'fas fa-bullhorn', 'bg' => '#20c997'],
                ['title' => 'Downloadable Files', 'value' => $totalDownloads, 'icon' => 'fas fa-folder-open', 'bg' => '#fd7e14'],
                ['title' => 'Coursework Entries', 'value' => $totalCoursework, 'icon' => 'fas fa-tasks', 'bg' => '#007bff'],
                ['title' => 'Exam Results Posted', 'value' => $totalExams, 'icon' => 'fas fa-poll', 'bg' => '#6610f2'],
                ['title' => 'Fees Paid ($)', 'value' => number_format($feesPaid, 2), 'icon' => 'fas fa-money-bill-wave', 'bg' => '#198754'],
                ['title' => 'Fees Due ($)', 'value' => number_format($feesDue, 2), 'icon' => 'fas fa-hand-holding-usd', 'bg' => '#d63384'],
            ];
        @endphp

        @foreach ($tiles as $tile)
        <div class="col-md-6 col-lg-4 d-flex">
            <div class="card text-white w-100 shadow-sm border-0 card-stat" style="background-color: {{ $tile['bg'] }}; color: {{ $tile['color'] ?? '#fff' }};">
                <div class="card-body d-flex align-items-center">
                    <div class="me-3">
                        <i class="{{ $tile['icon'] }} fa-2x"></i>
                    </div>
                    <div>
                        <div class="stat-title">{{ $tile['title'] }}</div>
                        <div class="stat-value">{{ $tile['value'] }}</div>
                    </div>
                </div>
            </div>
        </div>
        @endforeach
    </div>

    <div class="mt-5 text-muted text-center small">
        Logged in as <strong>{{ Auth::user()->name }}</strong> ({{ Auth::user()->email }})
    </div>
</div>
@endsection
