<!-- resources/views/components/navigation.blade.php -->

<!-- Main Section - Always visible -->
<div class="nav-section">
    <div class="nav-section-title">Main</div>
    <div class="nav-item">
        <a href="{{ route('dashboard') }}" class="nav-link {{ $isActive('dashboard') }}">
            <div class="nav-icon">
                <i class="bi bi-speedometer2"></i>
            </div>
            <div class="nav-text">Dashboard</div>
            <span class="nav-badge">3</span>
        </a>
    </div>
</div>

<!-- File Management Section -->
@can('view_files')
<div class="nav-section">
    <div class="nav-section-title">File Management</div>
    
    <div class="nav-item">
        <a href="{{ route('files') }}" class="nav-link {{ $isActive('files') }}">
            <div class="nav-icon">
                <i class="bi bi-files"></i>
            </div>
            <div class="nav-text">Files</div>
            <span class="nav-badge">{{ $counts['files'] }}</span>
        </a>
    </div>
    
    @can('view_categories')
    <div class="nav-item">
        <a href="{{ route('categories') }}" class="nav-link {{ $isActive('categories') }}">
            <div class="nav-icon">
                <i class="bi bi-tags"></i>
            </div>
            <div class="nav-text">Categories</div>
            <span class="nav-badge">{{ $counts['categories'] }}</span>
        </a>
    </div>
    @endcan
    
    @can('view_stages')
    <div class="nav-item">
        <a href="{{ route('stages') }}" class="nav-link {{ $isActive('stages') }}">
            <div class="nav-icon">
                <i class="bi bi-diagram-3"></i>
            </div>
            <div class="nav-text">Stages</div>
            <span class="nav-badge">{{ $counts['stages'] }}</span>
        </a>
    </div>
    @endcan
</div>
@endcan

<!-- Notices & Attachments Section -->
@can('view_notices')
<div class="nav-section">
    <div class="nav-section-title">Notices & Attachments</div>
    
    <div class="nav-item">
        <a href="{{ route('notices') }}" class="nav-link {{ $isActive('notices') }}">
            <div class="nav-icon">
                <i class="bi bi-megaphone"></i>
            </div>
            <div class="nav-text">Notice Updates</div>
            <span class="nav-badge">{{ $counts['notices'] }}</span>
        </a>
    </div>
    
    @can('view_attachment_types')
    <div class="nav-item">
        <a href="{{ route('attachment-types') }}" class="nav-link {{ $isActive('attachment-types') }}">
            <div class="nav-icon">
                <i class="bi bi-tag"></i>
            </div>
            <div class="nav-text">Attachment Types</div>
        </a>
    </div>
    @endcan
</div>
@endcan

<!-- User Management Section -->
@role('admin')
<div class="nav-section">
    <div class="nav-section-title">User Management</div>
    
    <div class="nav-item">
        <a href="{{ route('users') }}" class="nav-link {{ $isActive('users') }}">
            <div class="nav-icon">
                <i class="bi bi-people"></i>
            </div>
            <div class="nav-text">Users</div>
            <span class="nav-badge">{{ $counts['users'] }}</span>
        </a>
    </div>
    
    @role('super-admin')
    <div class="nav-item">
        <a href="{{ route('roles') }}" class="nav-link {{ $isActive('roles') }}">
            <div class="nav-icon">
                <i class="bi bi-shield-lock"></i>
            </div>
            <div class="nav-text">Roles</div>
        </a>
    </div>
    <!-- Add to your navigation -->
    <div class="nav-item">
        <a href="{{ route('permissions') }}" class="nav-link {{ request()->routeIs('permissions') ? 'active' : '' }}">
            <div class="nav-icon">
                <i class="bi bi-lock"></i>
            </div>
            <div class="nav-text">Permissions</div>
            <span class="nav-badge">{{ \App\Models\Permission::count() }}</span>
        </a>
    </div>
    @endrole
    
    <div class="nav-item">
        <a href="{{ route('profile') }}" class="nav-link {{ $isActive('profile') }}">
            <div class="nav-icon">
                <i class="bi bi-person-circle"></i>
            </div>
            <div class="nav-text">My Profile</div>
        </a>
    </div>
</div>
@endrole

<!-- Reports & Analytics Section -->
@can('view_reports')
<div class="nav-section">
    <div class="nav-section-title">Reports</div>
    
    @can('view_analytics')
    <div class="nav-item">
        <a href="{{ route('analytics') }}" class="nav-link {{ $isActive('analytics') }}">
            <div class="nav-icon">
                <i class="bi bi-graph-up"></i>
            </div>
            <div class="nav-text">Analytics</div>
        </a>
    </div>
    @endcan
    
    <div class="nav-item">
        <a href="{{ route('reports') }}" class="nav-link {{ $isActive('reports') }}">
            <div class="nav-icon">
                <i class="bi bi-file-earmark-text"></i>
            </div>
            <div class="nav-text">Reports</div>
            <span class="nav-badge">3</span>
        </a>
    </div>
    
    @can('view_audit_logs')
    <div class="nav-item">
        <a href="{{ route('audit-logs') }}" class="nav-link {{ $isActive('audit-logs') }}">
            <div class="nav-icon">
                <i class="bi bi-clock-history"></i>
            </div>
            <div class="nav-text">Audit Logs</div>
        </a>
    </div>
    @endcan
</div>
@endcan