/* assets/styles/css/sidebar-accordion.css */
/* Animations fluides pour les accordéons */
.sidebar-menu .collapse {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}

.sidebar-menu .collapse.show {
    max-height: 1000px;
    opacity: 1;
}

/* Animation d'apparition des éléments */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sidebar-menu .nav-item {
    animation: slideIn 0.4s ease forwards;
    opacity: 0;
}

.sidebar-menu .nav-item:nth-child(1) { animation-delay: 0.05s; }
.sidebar-menu .nav-item:nth-child(2) { animation-delay: 0.1s; }
.sidebar-menu .nav-item:nth-child(3) { animation-delay: 0.15s; }
.sidebar-menu .nav-item:nth-child(4) { animation-delay: 0.2s; }
.sidebar-menu .nav-item:nth-child(5) { animation-delay: 0.25s; }
.sidebar-menu .nav-item:nth-child(6) { animation-delay: 0.3s; }
.sidebar-menu .nav-item:nth-child(7) { animation-delay: 0.35s; }
.sidebar-menu .nav-item:nth-child(8) { animation-delay: 0.4s; }

/* Animation de pulsation pour l'avatar */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.user-avatar:hover {
    animation: pulse 2s infinite;
}

/* Animation des icônes au survol */
.nav-link:hover .menu-icon {
    transform: rotate(10deg) scale(1.1);
}

/* Animation de fond pour les éléments actifs */
@keyframes activePulse {
    0% {
        background-color: rgba(255, 255, 255, 0.2);
    }
    50% {
        background-color: rgba(255, 255, 255, 0.3);
    }
    100% {
        background-color: rgba(255, 255, 255, 0.2);
    }
}

.nav-link.active {
    animation: activePulse 2s infinite;
}

/* Animation du toggle button */
#sidebarToggleBtn, #sidebarPositionBtn {
    transition: all 0.2s ease;
}

#sidebarToggleBtn:hover, #sidebarPositionBtn:hover {
    transform: scale(1.1) rotate(5deg);
}

/* Smooth transitions for sidebar states */
.sidebar {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content {
    transition: margin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animation d'ouverture des sous-menus */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sidebar-menu .collapse.show .nav-item {
    animation: slideDown 0.3s ease forwards;
    opacity: 0;
}

.sidebar-menu .collapse.show .nav-item:nth-child(1) { animation-delay: 0.05s; }
.sidebar-menu .collapse.show .nav-item:nth-child(2) { animation-delay: 0.1s; }
.sidebar-menu .collapse.show .nav-item:nth-child(3) { animation-delay: 0.15s; }
.sidebar-menu .collapse.show .nav-item:nth-child(4) { animation-delay: 0.2s; }

/* Styles pour les conteneurs Turbo Frame */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar-container {
    position: relative;
    z-index: 100;
}

.main-content-container {
    flex: 1;
    overflow: hidden;
}

/* Permutation droite/gauche via flex order */
body.sidebar-right .sidebar-container {
    order: 2;
}

body.sidebar-right .main-content-container {
    order: 1;
}