{{-- Menu Condomini con route reali e contatori --}}
@php
    $stats = App\Helpers\SidebarStatsHelper::getStats();
    $condominiStats = $stats['condomini'] ?? ['totale' => 0, 'proprietari' => 0, 'inquilini' => 0];
@endphp

<li class="nav-item mb-1">
    <a class="nav-link d-flex align-items-center justify-content-between text-dark {{ request()->routeIs('admin.soggetti.*') ? 'active bg-warning text-dark fw-bold' : '' }}" 
       data-bs-toggle="collapse" href="#condominiMenu" role="button"
       aria-expanded="{{ request()->routeIs('admin.soggetti.*') ? 'true' : 'false' }}"
       aria-controls="condominiMenu">
        <div class="d-flex align-items-center">
            <i class="fas fa-users me-2"></i>
            <span>Condomini</span>
            {!! App\Helpers\SidebarStatsHelper::getBadge($condominiStats['totale'], 'info') !!}
        </div>
        <i class="fas fa-chevron-down"></i>
    </a>
    <div class="collapse {{ request()->routeIs('admin.soggetti.*') ? 'show' : '' }}" id="condominiMenu">
        <ul class="nav nav-pills flex-column ms-3">
            <li class="nav-item">
                <a class="nav-link text-dark {{ request()->routeIs('admin.soggetti.index') ? 'active bg-light' : '' }}" 
                   href="{{ route('admin.soggetti.index') }}">
                    <i class="fas fa-list me-2"></i>Elenco Condomini
                    {!! App\Helpers\SidebarStatsHelper::getBadge($condominiStats['totale'], 'primary') !!}
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link text-dark {{ request()->routeIs('admin.soggetti.create') ? 'active bg-light' : '' }}" 
                   href="{{ route('admin.soggetti.create') }}">
                    <i class="fas fa-user-plus me-2"></i>Nuovo Condomino
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link text-dark {{ request()->routeIs('admin.rubrica.*') ? 'active bg-light' : '' }}" 
                   href="{{ route('admin.rubrica.index') }}">
                    <i class="fas fa-address-book me-2"></i>Rubrica Completa
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link text-dark" href="{{ route('admin.soggetti.index') }}?tipo=proprietario">
                    <i class="fas fa-home me-2"></i>Proprietari
                    {!! App\Helpers\SidebarStatsHelper::getBadge($condominiStats['proprietari'], 'success') !!}
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link text-dark" href="{{ route('admin.soggetti.index') }}?tipo=inquilino">
                    <i class="fas fa-users-cog me-2"></i>Inquilini
                    {!! App\Helpers\SidebarStatsHelper::getBadge($condominiStats['inquilini'], 'warning') !!}
                </a>
            </li>
        </ul>
    </div>
</li>
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link text-dark" href="#" onclick="loadCondominiSection('millesimi')">
                    <i class="fas fa-percentage me-2"></i>Tabelle Millesimi
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link text-dark" href="#" onclick="loadCondominiSection('rubrica')">
                    <i class="fas fa-address-book me-2"></i>Rubrica Completa
                </a>
            </li>
        </ul>
    </div>
</li>

<script>
function loadCondominiSection(section) {
    alert(`Caricamento sezione Condomini: ${section}\n\nQui verrà mostrata la dashboard specifica per: ${section}`);
}
</script>
