{# @var edition \Ferienpass\CoreBundle\Entity\Edition #}
{# @var variant string 'badge' (list view title strip — gray badge styling) or 'plain' (table view edition column — hover-chip only). #}

{% set variant = variant|default('badge') %}
{% set itemClasses = 'group flex items-center mx-1 my-0.5 border-0 rounded-md px-2 py-1.5 text-sm leading-5 font-normal text-gray-700 dark:text-gray-100/70 hover:bg-gray-100 dark:hover:bg-gray-900 hover:text-gray-900 dark:hover:text-gray-100' %}

<details {{ stimulus_controller('ferienpass/admin-chip-menu') }}
         data-action="click@window->ferienpass--admin-chip-menu#closeIfOutside keydown@window->ferienpass--admin-chip-menu#closeOnEscape"
         oncontextmenu="event.stopPropagation()"
         class="inline-block relative align-baseline group/chip">
    {% if variant == 'badge' %}
        {# List view title strip — single scope chip per row, badge styling
           makes the edition visually distinct from the surrounding offer
           name + status badges. #}
        <summary class="cursor-pointer list-none [&::-webkit-details-marker]:hidden inline-block">
            <span class="inline-flex items-center whitespace-nowrap font-medium text-xs rounded-md px-1.5 py-0.5 ring-1 ring-inset text-gray-700 bg-gray-50 ring-gray-600/20 dark:text-gray-400 dark:bg-gray-400/10 dark:ring-gray-400/20 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors group-open/chip:bg-gray-100 dark:group-open/chip:bg-gray-800">
                {{ edition.name }}
            </span>
        </summary>
    {% else %}
        {# Table view edition column — the column header already labels
           the value as "Edition", so the cell value reads as plain text
           with hover affordance only (same pattern as the host chip). #}
        <summary class="cursor-pointer inline-flex items-center hover:bg-gray-100 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-gray-100 rounded-md px-1.5 py-0.5 -mx-1.5 -my-0.5 transition-colors list-none [&::-webkit-details-marker]:hidden group-open/chip:bg-gray-100 dark:group-open/chip:bg-gray-800">
            {{ edition.name }}
        </summary>
    {% endif %}
    <div class="absolute left-0 mt-2 z-20 w-64 rounded-md bg-white dark:bg-gray-950 shadow-lg outline-1 outline-black/5 dark:outline-white/10 py-1">
        <a href="{{ path('admin_editions_show', { alias: edition.alias }) }}"
           data-turbo-frame="slideover"
           class="{{ itemClasses }}">
            <span class="mr-2 size-4 flex-shrink-0">{{ ux_icon('ph:eye') }}</span>
            <span class="text-left leading-tight">Saison ansehen</span>
        </a>
        <a href="{{ path('admin_offers_index', { edition: edition.alias }) }}"
           class="{{ itemClasses }}">
            <span class="mr-2 size-4 flex-shrink-0">{{ ux_icon('ph:funnel') }}</span>
            <span class="text-left leading-tight">Nach Saison filtern …</span>
        </a>
    </div>
</details>
