@props(['recordData'])

<div class="grid grid-cols-2 md:grid-cols-4 gap-3">
    <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-3">
        <p class="text-xs text-gray-500">总题目</p>
        <p class="text-lg font-bold text-gray-900">{{ $recordData['total_questions'] ?? 0 }}</p>
    </div>

    @php
        // 已答题：排除"未作答"，但包含空答案（OCR中的空白选项也是有效答题）
        $answeredCount = collect($recordData['questions'] ?? [])
            ->filter(fn($q) => ($q['student_answer'] ?? '未作答') !== '未作答')
            ->count();
        $correctCount = collect($recordData['questions'] ?? [])
            ->filter(fn($q) => $q['is_correct'] ?? false)
            ->count();
        // 错误：已答题中减去正确的就是错误的
        $wrongCount = $answeredCount - $correctCount;
    @endphp

    <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-3">
        <p class="text-xs text-gray-500">已答题</p>
        <p class="text-lg font-bold text-green-600">{{ $answeredCount }}</p>
    </div>

    <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-3">
        <p class="text-xs text-gray-500">正确</p>
        <p class="text-lg font-bold text-green-600">{{ $correctCount }}</p>
    </div>

    <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-3">
        <p class="text-xs text-gray-500">错误</p>
        <p class="text-lg font-bold text-red-600">{{ $wrongCount }}</p>
    </div>
</div>
