{{-- Sidebar menu modulare NetGesCon --}}
<div class="d-flex flex-column h-100">
    {{-- Header con Logo, Data e News --}}
    @include('components.menu.sections.header')

    {{-- Menu Navigation --}}
    <nav class="flex-fill overflow-auto">
        <ul class="nav nav-pills flex-column p-2">
            
            {{-- Dashboard --}}
            @include('components.menu.sections.dashboard')
            
            {{-- Stabili --}}
            @include('components.menu.sections.stabili')
            
            {{-- Condomini --}}
            @include('components.menu.sections.condomini')
            
            {{-- Contabilità --}}
            @include('components.menu.sections.contabilita')
            
            {{-- Fiscale --}}
            @include('components.menu.sections.fiscale')
            
            {{-- Menu Semplici --}}
            @include('components.menu.sections.menu-semplici')
            
        </ul>
    </nav>

    {{-- Footer --}}
    @include('components.menu.sections.footer')
</div>

{{-- Styles per la sidebar --}}
<style>
.sidebar {
    background-color: #fbbf24; /* Giallo principale NetGesCon */
    min-height: 100vh;
    border-right: 2px solid #f59e0b;
}

.sidebar .nav-link {
    color: #374151;
    font-weight: 500;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    background-color: rgba(251, 191, 36, 0.3);
    color: #1f2937;
}

.sidebar .nav-link.active {
    background-color: #f59e0b;
    color: #ffffff;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar .collapse .nav-link {
    color: #6b7280;
    font-size: 0.9rem;
    padding-left: 2.5rem;
}

.sidebar .collapse .nav-link:hover {
    background-color: rgba(251, 191, 36, 0.2);
    color: #374151;
}

/* Dark Mode Support */
.dark .sidebar {
    background-color: #1f2937;
    border-right-color: #374151;
}

.dark .sidebar .nav-link {
    color: #d1d5db;
}

.dark .sidebar .nav-link:hover {
    background-color: rgba(55, 65, 81, 0.5);
    color: #f9fafb;
}

.dark .sidebar .nav-link.active {
    background-color: #3b82f6;
    color: #ffffff;
}

.dark .sidebar .collapse .nav-link {
    color: #9ca3af;
}

.dark .sidebar .collapse .nav-link:hover {
    background-color: rgba(55, 65, 81, 0.3);
    color: #d1d5db;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        z-index: 1050;
        transition: left 0.3s ease;
    }
    
    .sidebar.show {
        left: 0;
    }
}
</style>

{{-- JavaScript per funzionalità sidebar --}}
<script>
document.addEventListener('DOMContentLoaded', function() {
    // Gestione toggle menu collassabili
    const collapseElements = document.querySelectorAll('[data-bs-toggle="collapse"]');
    collapseElements.forEach(element => {
        element.addEventListener('click', function() {
            const icon = this.querySelector('.fa-chevron-down, .fa-chevron-up');
            if (icon) {
                icon.classList.toggle('fa-chevron-down');
                icon.classList.toggle('fa-chevron-up');
            }
        });
    });

    // Gestione menu attivo
    const navLinks = document.querySelectorAll('.sidebar .nav-link[href]');
    const currentPath = window.location.pathname;
    
    navLinks.forEach(link => {
        if (link.getAttribute('href') === currentPath) {
            link.classList.add('active');
            // Espandi il menu parent se è collassato
            const parentCollapse = link.closest('.collapse');
            if (parentCollapse) {
                parentCollapse.classList.add('show');
                const toggleButton = document.querySelector(`[href="#${parentCollapse.id}"]`);
                if (toggleButton) {
                    toggleButton.setAttribute('aria-expanded', 'true');
                }
            }
        }
    });
});
</script>
