<div class="ui-page">
    <div class="mx-auto flex max-w-7xl flex-col gap-6 px-4 py-8">
        @include('filament.partials.page-header', [
            'kicker' => '教材管理',
            'title' => '教材管理中心',
            'subtitle' => '集中管理教材信息、版本状态与目录结构',
            'actions' => view('filament.partials.density-toggle'),
        ])

        @php
            $textbooks = $this->table->getRecords();
            $total = $textbooks->count();
            $published = $textbooks->where('status', 'published')->count();
            $draft = $textbooks->where('status', 'draft')->count();
            $archived = $textbooks->where('status', 'archived')->count();
        @endphp

        <div class="grid grid-cols-1 gap-4 md:grid-cols-4">
            <div class="ui-stat">
                <div class="ui-stat-label">总教材数</div>
                <div class="ui-stat-value">{{ $total }}</div>
            </div>
            <div class="ui-stat">
                <div class="ui-stat-label">已发布</div>
                <div class="ui-stat-value text-emerald-600">{{ $published }}</div>
            </div>
            <div class="ui-stat">
                <div class="ui-stat-label">草稿</div>
                <div class="ui-stat-value text-amber-600">{{ $draft }}</div>
            </div>
            <div class="ui-stat">
                <div class="ui-stat-label">已归档</div>
                <div class="ui-stat-value text-slate-500">{{ $archived }}</div>
            </div>
        </div>

        <div class="ui-card">
            <div class="ui-card-header">
                <div>
                    <div class="ui-section-title">教材列表</div>
                    <div class="ui-subtitle">封面、基础信息与状态标签一并展示</div>
                </div>
                <div class="ui-badge-muted">支持批量操作</div>
            </div>
            <div class="ui-card-body">
                {{ $this->table }}
            </div>
        </div>
    </div>
    @include('filament.partials.loading-overlay')
</div>
