{% load i18n %}
{% if featured_listings %}
<section data-search-group>
    <div class="flex items-center gap-3 mt-8 mb-4">
        <h3 class="text-xs font-semibold uppercase tracking-widest text-warning">{% trans "Featured" %}</h3>
        <div class="h-px flex-1 bg-base-content/10"></div>
    </div>
    <div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
        {% for listing in featured_listings %}
        <div data-name="{{ listing.eve_type.name|lower }}"
             class="group relative flex items-center gap-3 p-2 rounded-lg bg-base-200 border border-warning/40 hover:border-warning transition">
            <div class="relative shrink-0">
                <img src="https://images.evetech.net/types/{{ listing.eve_type.id }}/icon?size=64"
                     alt="{{ listing.eve_type.name }}" loading="lazy" width="64" height="64"
                     class="w-14 h-14 object-contain rounded bg-base-300/40">
                <span class="absolute -top-1.5 -left-1.5 rounded-full bg-base-100 text-warning text-xs leading-none p-0.5"><i class="ti ti-star-filled"></i></span>
            </div>
            <div class="min-w-0 flex-1">
                <h4 class="font-medium text-sm leading-tight line-clamp-2" title="{{ listing.eve_type.name }}">{{ listing.eve_type.name }}</h4>
                <p class="text-success font-bold text-sm">{{ listing.price_display }} <span class="text-base-content/40 font-normal">· {{ listing.stock }}</span></p>
            </div>
            <a href="{% url 'storefront:module_item' shop.slug listing.pk %}" class="absolute inset-0 z-10" aria-label="{{ listing.eve_type.name }}"></a>
            <div class="relative z-20 shrink-0" data-cart-control data-variant="card"
                 data-id="{{ listing.pk }}" data-name="{{ listing.eve_type.name }}"
                 data-price="{{ listing.price }}" data-price-display="{{ listing.price_display }}"
                 data-type-id="{{ listing.eve_type.id }}" data-section="modules" data-stock="{{ listing.stock }}"></div>
        </div>
        {% endfor %}
    </div>
</section>
{% endif %}
