<div class="space-y-6">
    <!-- 搜索框 -->
    <div class="bg-white p-4 rounded-lg border">
        <div class="flex items-center space-x-4">
            <input
                type="text"
                wire:model.live.debounce.300ms="search"
                placeholder="搜索题目..."
                class="flex-1 border rounded p-2"
            >
            <span class="text-sm text-gray-500">找到 {{ count($this->questions) }} 个结果</span>
        </div>
    </div>

    <!-- 题目列表 -->
    <div class="bg-white rounded-lg border overflow-hidden">
        <table class="min-w-full divide-y divide-gray-200">
            <thead class="bg-gray-50">
                <tr>
                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">题目编号</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">题目内容</th>
                    <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">难度</th>
                </tr>
            </thead>
            <tbody class="bg-white divide-y divide-gray-200">
                @forelse($this->questions as $question)
                    <tr>
                        <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
                            {{ $question['code'] }}
                        </td>
                        <td class="px-6 py-4">
                            <x-math-render :content="$question['content']" class="text-sm" />
                        </td>
                        <td class="px-6 py-4 whitespace-nowrap">
                            @php
                                $difficulty = $question['difficulty'];
                                $label = match (true) {
                                    $difficulty <= 0.4 => '基础',
                                    $difficulty <= 0.7 => '中等',
                                    default => '拔高',
                                };
                                $color = match (true) {
                                    $difficulty <= 0.4 => 'green',
                                    $difficulty <= 0.7 => 'yellow',
                                    default => 'red',
                                };
                            @endphp
                            <span class="px-2 py-1 text-xs font-semibold rounded-full bg-{{ $color }}-100 text-{{ $color }}-800">
                                {{ $label }}
                            </span>
                        </td>
                    </tr>
                @empty
                    <tr>
                        <td colspan="3" class="px-6 py-12 text-center text-gray-500">
                            暂无数据
                        </td>
                    </tr>
                @endforelse
            </tbody>
        </table>
    </div>

    <!-- 实时编辑演示 -->
    <div class="bg-white p-4 rounded-lg border">
        <h3 class="text-lg font-semibold mb-4">实时编辑演示</h3>
        <x-math-render
            content="初始内容：$f(x) = x^2$"
            class="mb-4 p-4 bg-gray-50 rounded"
        />
        <p class="text-sm text-gray-600">
            题目内容会在组件更新后自动重新渲染数学公式。
        </p>
    </div>
</div>
