@extends('siswa.layouts.app')

@section('title', 'Materi')

@push('styles')
<style>
    .page-title {
        font-size: 22px;
        font-weight: 700;
        color: #1e293b;
        margin-bottom: 24px;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .mapel-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }

    .mapel-card {
        background: #fff;
        border-radius: 20px;
        padding: 24px;
        box-shadow: 0 2px 12px rgba(0,0,0,0.06);
        text-decoration: none;
        color: inherit;
        display: flex;
        flex-direction: column;
        gap: 12px;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        border-top: 4px solid #2b8ef3;
    }

    .mapel-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(43,142,243,0.15);
        color: inherit;
    }

    .mapel-icon {
        width: 48px;
        height: 48px;
        background: #e6f0ff;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mapel-nama {
        font-size: 16px;
        font-weight: 700;
        color: #1e293b;
        margin: 0;
    }

    .mapel-guru {
        font-size: 13px;
        color: #64748b;
        margin: 0;
    }

    .mapel-badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: #e6f0ff;
        color: #2b8ef3;
        font-size: 12px;
        font-weight: 600;
        padding: 4px 10px;
        border-radius: 99px;
        width: fit-content;
    }

    .empty-state {
        text-align: center;
        padding: 60px 20px;
        color: #94a3b8;
    }

    .empty-state .empty-icon {
        margin-bottom: 12px;
        display: flex;
        justify-content: center;
    }
</style>
@endpush

@section('content')

<h1 class="page-title">
    <img src="{{ asset('images/icon/siswam/stacked.png') }}" alt="Ikon mata pelajaran" class="icon-md">
    Mata Pelajaran
</h1>

@if($mapelList->isEmpty())
    <div class="empty-state">
        <div class="empty-icon">
            <img src="{{ asset('images/icon/siswam/mailbox.png') }}" alt="Belum ada mata pelajaran" class="icon-mascot" style="width:80px; margin-top:0;">
        </div>
        <p>Belum ada mata pelajaran untuk kelasmu.</p>
    </div>
@else
    <div class="mapel-grid">
        @foreach($mapelList as $mapel)
            <a href="{{ route('siswa.materi.show', $mapel['id_mengajar']) }}" class="mapel-card">
                <div class="mapel-icon">
                    <img src="{{ asset('images/icon/siswam/mapel.png') }}" alt="Ikon mapel" class="icon-md">
                </div>
                <div>
                    <p class="mapel-nama">{{ $mapel['nama_mapel'] }}</p>
                    <p class="mapel-guru">{{ $mapel['nama_guru'] }}</p>
                </div>
                <div class="mapel-badge">
                    <img src="{{ asset('images/icon/siswam/jml-m.png') }}" alt="Jumlah materi" class="icon-sm">
                    {{ $mapel['jumlah_materi'] }} Materi
                </div>
            </a>
        @endforeach
    </div>
@endif

@endsection