@if(!empty($similarQuestions))
<div class="bg-gradient-to-r from-indigo-50 to-blue-50 border border-indigo-200 rounded-lg p-5">
    <h3 class="text-lg font-semibold text-gray-900 mb-4 flex items-center justify-between">
        <span class="flex items-center">
            <svg class="w-5 h-5 mr-2 text-indigo-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
            </svg>
            相似题目推荐
        </span>
        @if(!empty($knowledgePoint))
        <span class="text-sm text-indigo-600 font-medium">
            知识点: {{ $knowledgePoint['name'] }}
        </span>
        @endif
    </h3>

    <div class="space-y-3">
        @foreach($similarQuestions as $index => $question)
        <div class="bg-white rounded-lg p-4 border border-gray-200 hover:shadow-md transition-all duration-200 hover:scale-[1.02]">
            <div class="flex items-start justify-between mb-3">
                <div class="flex items-center space-x-2">
                    <span class="text-gray-400 text-lg">#{{ $index + 1 }}</span>
                    <span class="inline-flex items-center px-2 py-1 rounded text-xs font-medium bg-{{ $question['difficulty_color'] ?? 'blue' }}-100 text-{{ $question['difficulty_color'] ?? 'blue' }}-800">
                        难度: {{ $question['difficulty'] }}
                    </span>
                    <span class="inline-flex items-center px-2 py-1 rounded text-xs font-medium bg-gray-100 text-gray-700">
                        {{ $question['question_type'] }}
                    </span>
                </div>
                <div class="text-right space-y-1">
                    <span class="text-xs text-gray-500 block">{{ $question['estimated_time'] }}</span>
                    <span class="text-xs font-semibold text-indigo-600">{{ $question['score'] }}分</span>
                </div>
            </div>

            <h4 class="text-sm font-medium text-gray-900 mb-2 line-clamp-2">
                {{ $question['title'] }}
            </h4>

            <div class="flex items-center justify-between mt-3">
                <div class="flex items-center space-x-3">
                    @if(!empty($question['knowledge_point']))
                    <span class="text-xs text-gray-500">
                        <svg class="w-4 h-4 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
                        </svg>
                        {{ $question['knowledge_point'] }}
                    </span>
                    @endif
                </div>

                <button
                    onclick="window.location.href='{{ route('filament.admin.pages.recommendation-list', ['kp' => $knowledgePoint['code'] ?? '']) }}'"
                    class="inline-flex items-center px-3 py-1.5 text-xs font-medium text-indigo-600 bg-indigo-50 rounded-md hover:bg-indigo-100 transition-colors duration-200">
                    开始练习
                    <svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"></path>
                    </svg>
                </button>
            </div>
        </div>
        @endforeach
    </div>

    @if(!empty($knowledgePoint))
    <div class="mt-4 pt-4 border-t border-indigo-200">
        <div class="flex items-center justify-between">
            <p class="text-xs text-gray-600">
                <svg class="w-4 h-4 inline mr-1 text-indigo-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
                </svg>
                基于知识点"{{ $knowledgePoint['name'] }}"智能推荐，帮助你针对性提升
            </p>
            <a href="{{ route('filament.admin.pages.recommendation-list', ['kp' => $knowledgePoint['code'] ?? '']) }}"
               class="text-sm text-indigo-600 hover:text-indigo-800 font-medium inline-flex items-center">
                查看更多推荐
                <svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"></path>
                </svg>
            </a>
        </div>
    </div>
    @endif
</div>
@endif