{% extends "base.html" %}

{% block title %}ZJPB - 焦提示词 - 发现最好用的AI产品{% endblock %}

{% block content %}
<main class="flex-1 flex flex-col items-center w-full px-6 lg:px-10 py-8">
    <div class="w-full max-w-[1200px] flex flex-col gap-10">
        <!-- Hero Section -->
        <div class="flex flex-col md:flex-row items-start md:items-end justify-between gap-6 pb-6 border-b border-border-dark/50">
            <div class="flex flex-col gap-2 max-w-2xl">
                <h1 class="text-4xl md:text-5xl lg:text-6xl font-black tracking-tighter text-white mb-2">
                    ZJPB - <span class="text-gradient">焦提示词</span>
                </h1>
                <p class="text-gray-400 text-lg md:text-xl font-light">
                    发现最新最好用的AI工具和产品
                </p>
            </div>
        </div>

        <!-- Filter Chips -->
        <div class="w-full overflow-x-auto pb-2 scrollbar-hide">
            <div class="flex gap-3 min-w-max">
                <a href="{{ url_for('index') }}" class="flex items-center h-9 px-5 rounded-full {% if not selected_tag %}bg-primary text-background-dark shadow-[0_0_10px_rgba(37,192,244,0.4)]{% else %}bg-surface-dark border border-border-dark text-gray-300 hover:text-white hover:border-gray-500{% endif %} font-bold text-sm transition-all">
                    全部
                </a>
                {% for tag in tags %}
                <a href="{{ url_for('index', tag=tag.slug) }}" class="flex items-center gap-2 h-9 px-5 rounded-full {% if selected_tag and selected_tag.id == tag.id %}bg-primary text-background-dark shadow-[0_0_10px_rgba(37,192,244,0.4)]{% else %}bg-surface-dark border border-border-dark text-gray-300 hover:text-white hover:border-gray-500{% endif %} font-medium text-sm transition-all">
                    {% if tag.icon %}<span class="material-symbols-outlined text-sm">{{ tag.icon.replace('fas fa-', '').replace('fab fa-', '') }}</span>{% endif %}
                    {{ tag.name }}
                </a>
                {% endfor %}
            </div>
        </div>

        <!-- Tool Grid -->
        {% if sites %}
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
            {% for site in sites %}
            <div class="group relative flex flex-col gap-4 rounded-xl border border-border-dark bg-surface-dark p-5 card-hover transition-all duration-300 cursor-pointer overflow-hidden" onclick="window.location.href='{{ url_for('site_detail', slug=site.slug) }}'">
                <div class="absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-primary to-secondary opacity-0 group-hover:opacity-100 transition-opacity"></div>

                <div class="flex items-start justify-between">
                    {% if site.logo %}
                    <div class="size-12 rounded-lg bg-cover bg-center shadow-lg" style="background-image: url('{{ site.logo }}');"></div>
                    {% else %}
                    <div class="size-12 rounded-lg bg-gradient-to-br from-primary to-secondary flex items-center justify-center text-black font-bold text-xl shadow-lg">
                        {{ site.name[0] }}
                    </div>
                    {% endif %}
                    <div class="flex items-center justify-center size-8 rounded-full bg-background-dark text-gray-400 group-hover:text-primary group-hover:bg-primary/10 transition-colors">
                        <span class="material-symbols-outlined text-lg">arrow_outward</span>
                    </div>
                </div>

                <div>
                    <h3 class="text-white text-lg font-bold leading-tight group-hover:text-primary transition-colors">{{ site.name }}</h3>
                    <p class="text-gray-400 text-sm mt-2 line-clamp-2">{{ site.short_desc or '暂无描述' }}</p>
                </div>

                <div class="mt-auto flex items-center justify-between pt-4 border-t border-border-dark">
                    <div class="flex gap-2 flex-wrap">
                        {% for tag in site.tags[:2] %}
                        <span class="px-2 py-0.5 rounded text-[10px] font-bold uppercase tracking-wider bg-white/5 text-gray-300 border border-white/10">{{ tag.name }}</span>
                        {% endfor %}
                    </div>
                    <div class="flex items-center gap-1 text-gray-500 text-xs">
                        <span class="material-symbols-outlined text-[14px]">visibility</span>
                        <span>{{ site.view_count }}</span>
                    </div>
                </div>
            </div>
            {% endfor %}
        </div>
        {% else %}
        <div class="text-center py-20">
            <span class="material-symbols-outlined text-6xl text-gray-600 mb-4 block">search_off</span>
            <p class="text-gray-400 text-lg">暂无相关AI工具</p>
        </div>
        {% endif %}
    </div>
</main>
{% endblock %}
