{{--
    Discover section-switcher pills.

    Expected variable:  $section  (string) — the active section slug, e.g. 'trending', 'for-you'
    Expected variable:  $isAuthenticated (bool, optional) — whether the user is logged in
--}}

@php
    $active = $section ?? '';
    $isAuth = $isAuthenticated ?? auth()->check();

    $sections = collect([
        'for-you'         => ['label' => 'For You',         'icon' => 'fa-wand-magic-sparkles', 'auth' => true,  'activeClass' => 'bg-yellow-500/20 text-yellow-300 border border-yellow-400/20'],
        'following'       => ['label' => 'Following',       'icon' => 'fa-user-group',          'auth' => true,  'activeClass' => 'bg-sky-600 text-white'],
        'trending'        => ['label' => 'Trending',        'icon' => 'fa-fire',                'auth' => false, 'activeClass' => 'bg-sky-600 text-white'],
        'rising'          => ['label' => 'Rising',          'icon' => 'fa-rocket',              'auth' => false, 'activeClass' => 'bg-sky-600 text-white'],
        'fresh'           => ['label' => 'Fresh',           'icon' => 'fa-bolt',                'auth' => false, 'activeClass' => 'bg-sky-600 text-white'],
        'top-rated'       => ['label' => 'Top Rated',       'icon' => 'fa-medal',               'auth' => false, 'activeClass' => 'bg-sky-600 text-white'],
        'most-downloaded' => ['label' => 'Most Downloaded', 'icon' => 'fa-download',            'auth' => false, 'activeClass' => 'bg-sky-600 text-white'],
        'on-this-day'     => ['label' => 'On This Day',     'icon' => 'fa-calendar-day',        'auth' => false, 'activeClass' => 'bg-sky-600 text-white'],
    ]);
@endphp

<div class="flex flex-wrap items-center gap-2 text-sm">
    @foreach($sections as $slug => $meta)
        @if($meta['auth'] && !$isAuth)
            @continue
        @endif
        <a href="{{ route('discover.' . $slug) }}"
           class="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors
                  {{ $active === $slug
                        ? $meta['activeClass']
                        : 'bg-white/[0.05] text-white/60 hover:bg-white/[0.1] hover:text-white' }}">
            <i class="fa-solid {{ $meta['icon'] }} text-xs {{ $active === $slug && $slug === 'for-you' ? '' : '' }}"></i>
            {{ $meta['label'] }}
        </a>
    @endforeach
</div>
