@auth
<aside class="sidebar card-modern">
    <div style="display:flex;align-items:center;gap:12px;margin-bottom:14px">
        <div class="brand-logo">KT</div>
        <div>
            <div style="font-weight:700">KonserTix</div>
            <div style="font-size:12px;color:var(--muted)">Ticket Management</div>
        </div>
    </div>

    @php $user = Auth::user(); @endphp

    @if($user && $user->role == 'admin')
        <div class="nav-section">
            <h6>Main</h6>
            <a href="{{ route('dashboard') }}" class="nav-link {{ request()->routeIs('dashboard') ? 'active' : '' }}"><i class="bi bi-grid-1x2-fill"></i> Dashboard</a>
            <a href="{{ route('events.index') }}" class="nav-link {{ request()->routeIs('events.*') ? 'active' : '' }}"><i class="bi bi-music-note-beamed"></i> Events</a>
            <a href="{{ route('tiket.index') }}" class="nav-link {{ request()->routeIs('tiket.*') ? 'active' : '' }}"><i class="bi bi-ticket-perforated-fill"></i> Tiket</a>
        </div>

        <div class="nav-section">
            <h6>Kelola</h6>
            <a href="{{ route('transaksi.index') }}" class="nav-link {{ request()->routeIs('transaksi.*') ? 'active' : '' }}"><i class="bi bi-receipt-cutoff"></i> Transaksi</a>
            <a href="{{ route('kategori.index') }}" class="nav-link {{ request()->routeIs('kategori.*') ? 'active' : '' }}"><i class="bi bi-tag-fill"></i> Kategori</a>
            <a href="{{ route('lokasi.index') }}" class="nav-link {{ request()->routeIs('lokasi.*') ? 'active' : '' }}"><i class="bi bi-geo-alt-fill"></i> Lokasi</a>
            <a href="{{ route('users.index') }}" class="nav-link {{ request()->routeIs('users.*') ? 'active' : '' }}"><i class="bi bi-people-fill"></i> Pengguna</a>
            <a href="{{ route('laporan.index') }}" class="nav-link {{ request()->routeIs('laporan.*') ? 'active' : '' }}"><i class="bi bi-bar-chart-line-fill"></i> Laporan</a>
        </div>
    @else
        <div class="nav-section">
            <h6>Portal Pengguna</h6>
            <a href="{{ route('user.home') }}" class="nav-link {{ request()->routeIs('user.home') ? 'active' : '' }}"><i class="bi bi-house-fill"></i> Beranda</a>
            <a href="{{ route('user.events') }}" class="nav-link {{ request()->routeIs('user.events') ? 'active' : '' }}"><i class="bi bi-music-note-beamed"></i> Lihat Event</a>
            <a href="{{ route('user.riwayat') }}" class="nav-link {{ request()->routeIs('user.riwayat') ? 'active' : '' }}"><i class="bi bi-clock-history"></i> Riwayat Pembelian</a>
        </div>
    @endif

    <div style="position:absolute;bottom:20px;left:20px;right:20px">
        <div style="display:flex;gap:10px;align-items:center">
            <img src="https://ui-avatars.com/api/?name={{ urlencode($user->name ?? 'User') }}&background=2563EB&color=fff&size=40" style="width:40px;height:40px;border-radius:8px;object-fit:cover">
            <div>
                <div style="font-weight:700">{{ $user->name }}</div>
                <div style="font-size:12px;color:var(--muted)">{{ ucfirst($user->role ?? '') }}</div>
            </div>
        </div>
    </div>
</aside>
@endauth
