@extends('layouts.app')

@section('page_title', 'Dashboard')

@section('content')
<!-- Stat Cards -->
<div class="row">
    <div class="col-6 col-md-4 col-lg-2 mb-4">
        <a href="{{ route('admin.data.siswa') }}" class="text-decoration-none">
            <div class="stat-card" style="border-top: 3px solid #0284c7;">
                <div class="stat-icon" style="color: #0284c7;"><i class="bi bi-people"></i></div>
                <div class="stat-value">{{ $total_siswa }}</div>
                <div class="stat-label">Total Siswa</div>
            </div>
        </a>
    </div>
    <div class="col-6 col-md-4 col-lg-2 mb-4">
        <a href="{{ route('admin.data.kelas') }}" class="text-decoration-none">
            <div class="stat-card" style="border-top: 3px solid #10b981;">
                <div class="stat-icon" style="color: #10b981;"><i class="bi bi-building"></i></div>
                <div class="stat-value">{{ $total_kelas }}</div>
                <div class="stat-label">Total Kelas</div>
            </div>
        </a>
    </div>
    <div class="col-6 col-md-4 col-lg-2 mb-4">
        <a href="{{ route('admin.data.guru') }}" class="text-decoration-none">
            <div class="stat-card" style="border-top: 3px solid #f59e0b;">
                <div class="stat-icon" style="color: #f59e0b;"><i class="bi bi-person-badge"></i></div>
                <div class="stat-value">{{ $total_guru }}</div>
                <div class="stat-label">Total Guru</div>
            </div>
        </a>
    </div>
    <div class="col-6 col-md-4 col-lg-2 mb-4">
        <a href="{{ route('admin.data.wali_kelas') }}" class="text-decoration-none">
            <div class="stat-card" style="border-top: 3px solid #f97316;">
                <div class="stat-icon" style="color: #f97316;"><i class="bi bi-person"></i></div>
                <div class="stat-value">{{ $total_wali }}</div>
                <div class="stat-label">Total Wali Kelas</div>
            </div>
        </a>
    </div>
    <div class="col-6 col-md-4 col-lg-2 mb-4">
        <a href="{{ route('admin.data.admin') }}" class="text-decoration-none">
            <div class="stat-card" style="border-top: 3px solid #475569;">
                <div class="stat-icon" style="color: #475569;"><i class="bi bi-shield-lock"></i></div>
                <div class="stat-value">{{ $total_user }}</div>
                <div class="stat-label">Total User</div>
            </div>
        </a>
    </div>
    <div class="col-6 col-md-4 col-lg-2 mb-4">
        <a href="{{ route('admin.laporan.absen_mapel') }}" class="text-decoration-none">
            <div class="stat-card" style="border-top: 3px solid #10b981;">
                <div class="stat-icon" style="color: #10b981;"><i class="bi bi-journal-text"></i></div>
                <div class="stat-value" style="font-size: 16px;">Laporan</div>
                <div class="stat-label">Absen Mapel</div>
            </div>
        </a>
    </div>
</div>

<!-- Quick Overview Cards -->
<div class="row mt-2">
    <div class="col-md-6 mb-4">
        <div class="card-flat">
            <h6 class="fw-bold mb-3" style="font-size:14px;"><i class="bi bi-calendar-check me-2 text-primary"></i>Absensi Hari Ini</h6>
            <div class="d-flex gap-3 flex-wrap">
                <div class="text-center p-3" style="background:#f0fdf4; border-radius:8px; flex:1; min-width:100px;">
                    <div class="fw-bold text-success" style="font-size:22px;">{{ \App\Models\AbsenSiswa::whereDate('tgl_absen', today())->count() }}</div>
                    <div class="text-muted" style="font-size:11px;">Hadir</div>
                </div>
                <div class="text-center p-3" style="background:#fef2f2; border-radius:8px; flex:1; min-width:100px;">
                    <div class="fw-bold text-danger" style="font-size:22px;">{{ \App\Models\AbsenSiswa::whereDate('tgl_absen', today())->where('keterangan', 'Sakit')->count() }}</div>
                    <div class="text-muted" style="font-size:11px;">Sakit</div>
                </div>
                <div class="text-center p-3" style="background:#fffbeb; border-radius:8px; flex:1; min-width:100px;">
                    <div class="fw-bold" style="font-size:22px; color:#f59e0b;">{{ \App\Models\AbsenSiswa::whereDate('tgl_absen', today())->where('keterangan', 'Izin')->count() }}</div>
                    <div class="text-muted" style="font-size:11px;">Izin</div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-6 mb-4">
        <div class="card-flat">
            <h6 class="fw-bold mb-3" style="font-size:14px;"><i class="bi bi-clock-history me-2 text-primary"></i>Pulang Hari Ini</h6>
            <div class="d-flex gap-3 flex-wrap">
                <div class="text-center p-3" style="background:#eff6ff; border-radius:8px; flex:1; min-width:100px;">
                    <div class="fw-bold text-primary" style="font-size:22px;">{{ \App\Models\AbsenPulang::whereDate('tgl_absen', today())->count() }}</div>
                    <div class="text-muted" style="font-size:11px;">Sudah Pulang</div>
                </div>
                <div class="text-center p-3" style="background:#f8fafc; border-radius:8px; flex:1; min-width:100px;">
                    <div class="fw-bold" style="font-size:22px; color:#64748b;">{{ \App\Models\AbsenPulang::count() }}</div>
                    <div class="text-muted" style="font-size:11px;">Total Absen Pulang</div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
