/* ==========================================================================
   SIDEBAR MODERNE - RESPONSIVE
   ========================================================================== */

/* Variables CSS pour la cohérence */

/* Désactiver les transitions lors du chargement initial */
.side-menu-navigation:not(.sidebar-ready) {
    transition: none !important;

    * {
        transition: none !important;
    }
}

.site-background{
    background-color: #000;
    padding:6px;
}
.site {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s;
    min-height: 100dvh;
    padding: 50px;
    background-color: #fff;
    border-radius: 10px;
}
.expertise-template-default .site{
    padding: 0;
}
.side-menu-toggle {
    background: var(--primary-black);
    border: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    position: fixed;
    left: calc(var(--sidebar-width) - 20px);
    bottom: 140px;
    z-index: 11;

    &:hover {
        background: var(--sidebar-hover);
        transform: scale(1.1);
    }


    i {
        transition: transform 0.3s;
    }
}
body:has(.side-menu-navigation.collapsed) .side-menu-toggle{
    left: calc(var(--sidebar-collapsed-width) - 20px);
    
    i {
        transform: rotate(180deg);
    }
}

    /* Sidebar Principal */
    .side-menu-navigation {
        position: fixed;
        top: 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        left: 0;
        height: 100dvh;
        width: var(--sidebar-width);
        background: var(--primary-black);
        color: var(--sidebar-text);
        transform: translateX(0);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 10;
        box-shadow: var(--sidebar-shadow);
        overflow-y: auto;
        overflow-x: hidden;

    /* Scrollbar personnalisée */
    &::-webkit-scrollbar {
        width: 6px;
    }

    &::-webkit-scrollbar-track {
        background: transparent;
    }

    &::-webkit-scrollbar-thumb {
        background: var(--sidebar-border);
        border-radius: 3px;
    }

            /* Sidebar Collapsed */
        &.collapsed {
            width: var(--sidebar-collapsed-width);

            .side-menu-logo {
                opacity: 1;
                pointer-events: auto;
                
                span {
                    display: none;
                }
                
                img {
                    width: 21px;
                    height: 21px;
                }
            }

            .side-menu-header {
                margin: 0;
                margin-top: 30px;
                padding: 0;
                padding-bottom: 18px;
                justify-content: center;
                img{
                    width: 30px!important;
                    height: 30px!important;
                }

            }

            .side-menu-list {
                a {
                    justify-content: center;
                    padding: 12px 12px;
                    margin-right: 0;
                    font-size: 1.125rem;

                    /* Cacher le texte h3 en mode collapsed */
                    h3 {
                        display: none;
                    }

                    /* Garder seulement les images des menus principaux */
                    img {
                        width: 21px;
                        height: 21px;
                        margin-right: 0;
                    }
                    &:hover , &.active{
                        background-color: #3D4055;
                    }
                    &:focus{
                        background-color: #3D4055;
                    }
                }

                .sub-menu {
                    display: none;
                }

                .menu-item-has-children > a::after {
                    display: none;
                }
            }

            .menu-item-text {
                opacity: 0;
                width: 0;
                overflow: hidden;
            }

            .side-menu-footer {
                text-align: center;
                padding: 20px 0;
            }

            .side-menu-user-info {
                justify-content: center;
                height: 40px;

                .side-menu-user-link {
                    justify-content: center;
                    
                    div {
                        display: none;
                    }
                    
                    .user-icon {
                        width: 30px;
                        padding: 5px;
                    }
                }
            }

            

            .side-menu-list a:hover .side-menu-tooltip {
                opacity: 1;
            }
        }

    /* Header de la sidebar */
    .side-menu-header {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        padding: 20px;
        border-bottom: 1px solid #fff;
        margin:50px 20px 0 20px;

        .side-menu-logo {
            display: flex;
            align-items: center;
            gap: 12px;
            font-size: 1.5rem;
            font-weight: 600;
            color: var(--sidebar-text);
            text-decoration: none;
            transition: opacity 0.3s;

            img {
                width: 21px;
                height: 21px;
                object-fit: contain;
            }

            span {
                font-size: 1.125rem;
                font-weight: 600;
            }
        }
    }

    /* Container du menu */
    .side-menu-container {
        padding: 20px 0;
        padding-bottom: 120px;
    }

    /* Liste du menu */
    .side-menu-list {
        list-style: none;
        margin: 0;
        padding: 5px;

        li {
            margin: 0;
            padding: 0;
            position: relative;
            margin-bottom: 5px;
        }

        a {
            display: flex;
            align-items: center;
            padding: 12px 20px;
            color: var(--sidebar-text);
            text-decoration: none;
            transition: all 0.3s;
            position: relative;
            border-radius: 10px;

            &:hover , &.active{
                background: #3D4055;
            }

            i {
                width: 20px;
                text-align: center;
                margin-right: 12px;
                flex-shrink: 0;
                opacity: 0.7;
                font-size: 0.875rem;
            }

            /* Icônes spécifiques pour les classes personnalisées */
            &[href*="wp-admin"]::before {
                content: '\f013';
                font-family: "Font Awesome 6 Free";
                font-weight: 900;
            }

            &[href*="mailto:"]::before {
                content: '\f0e0';
                font-family: "Font Awesome 6 Free";
                font-weight: 900;
            }

            &[href*="tel:"]::before {
                content: '\f095';
                font-family: "Font Awesome 6 Free";
                font-weight: 900;
            }

            /* Styles pour les icônes Font Awesome */
            .fa,
            .fas,
            .far {
                width: 20px;
                text-align: center;
                margin-right: 12px;
                flex-shrink: 0;
            }

            /* Styles pour le nouveau menu custom */
            img {
                width: 21px;
                height: 21px;
                margin-right: 12px;
                flex-shrink: 0;
                object-fit: contain;
            }

            h3 {
                color: var(--sidebar-text);
                margin: 0;
                font-size: 1rem;
                font-weight: 500;
            }
        }

        /* Styles pour les éléments actifs */
        .current-menu-item > a,
        .current-menu-parent > a {
            background: var(--sidebar-accent);
            border-left-color: var(--sidebar-accent);

            i {
                opacity: 1;
            }
        }

        /* Styles pour les éléments actifs des sous-menus */
        .sub-menu .current-menu-item > a,
        .sub-menu .current-menu-parent > a {
            background: #F5F6F999;
            border-left-color: transparent;
        }

        /* Styles pour les sous-menus */
        .sub-menu {
            list-style: none;
            margin: 0;
            padding: 0;
            margin-left: 6px;

            a {
                padding: 18px 36px;
                font-size: 0.9em;
                opacity: 0.9;
                color: var(--sidebar-text);

                i {
                    width: 16px;
                    text-align: center;
                    margin-right: 8px;
                    font-size: 0.8rem;
                    opacity: 0.6;
                }
            }
        }

        .menu-item-has-children {
            &.open .sub-menu {
                max-height: 500px;
            }

            > a::after {
                content: '';
                width: 0;
                height: 0;
                border-left: 6px solid currentColor;
                border-top: 4px solid transparent;
                border-bottom: 4px solid transparent;
                margin-left: auto;
                transition: transform 0.3s;
            }

            &.open > a::after {
                transform: rotate(90deg);
            }
        }





        /* Styles pour les éléments actifs avec icônes */
        .current-menu-item > a::before,
        .current-menu-parent > a::before {
            opacity: 1;
        }
    }

    /* Masquage du texte en mode collapsed */
    .menu-item-text {
        white-space: nowrap;
        overflow: hidden;
        transition: opacity 0.3s;
    }

    /* Tooltip pour sidebar collapsed */
    .side-menu-tooltip {
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        background: var(--primary-black);
        color: var(--sidebar-text);
        padding: 8px 12px;
        border-radius: 4px;
        font-size: 0.875rem;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
        z-index: 1001;
        margin-left: 12px;
        box-shadow: var(--sidebar-shadow);
        border: 1px solid var(--sidebar-border);

        &::before {
            content: '';
            position: absolute;
            right: 100%;
            top: 50%;
            transform: translateY(-50%);
            border: 6px solid transparent;
            border-right-color: var(--sidebar-border);
        }

        &::after {
            content: '';
            position: absolute;
            right: 100%;
            top: 50%;
            transform: translateY(-50%);
            border: 5px solid transparent;
            border-right-color: var(--primary-black);
            margin-right: 1px;
        }
    }

    /* Footer de la sidebar */
    .side-menu-footer {
        height: fit-content;
        padding: 20px;
        border-top: 1px solid #fff;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    /* Bouton Toggle - Position stable dans le footer */
    

    /* Info utilisateur dans le footer */
    .side-menu-user-info {
        display: flex;
        align-items: center;
        color: var(--sidebar-text);
        font-size: 0.875rem;
        height: 40px;
        flex-shrink: 0;

        i {
            margin-right: 8px;
            width: 20px;
            text-align: center;
            flex-shrink: 0;
        }
    }

    /* Styles pour les notifications/notices */
    .side-menu-notice {
        padding: 20px;
        color: var(--sidebar-text);
        opacity: 0.8;
        text-align: center;

        i {
            color: var(--primary-color);
            margin-right: 8px;
        }

        p {
            margin: 12px 0;
        }

        small {
            font-size: 0.8rem;
            opacity: 0.7;
        }
    }

    /* États de focus pour l'accessibilité */

    .side-menu-user-link {
        display: flex;
        gap: 10px;
        .user-icon{
            width: 40px;
            box-sizing: border-box;
            padding:10px;
            background-color: #F2F2F7;
            border-radius: 5px;
        }
        div{
            display: flex;
            flex-direction: column;
            .name{
                font-size: 16px;
                font-weight: 600;
                color:#fff;
            }
            .email{
                font-size: 12px;
                font-weight: 400;
                color:#FFFFFF96;
            }
        }

    } 
}

/* Overlay pour mobile */
.side-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 999;

    &.active {
        opacity: 1;
        pointer-events: auto;
    }
}

/* Contenu principal */


.side-menu-navigation.collapsed + .site,
.site.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width);
}
@media (max-width: 750px) {
    .single-expertise .sidebar-collapsed {
        margin-left: 0;
    }
}

/* Header Mobile */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--primary-black);
    color: var(--sidebar-text);
    z-index: 1000;
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--sidebar-shadow);
}

.mobile-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.125rem;
    font-weight: 600;

    img {
        width: 21px;
        height: 21px;
        object-fit: contain;
    }

    span {
        font-size: 1.125rem;
        font-weight: 600;
    }
}

.mobile-menu-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;

    &:hover {
        background: var(--sidebar-hover);
    }
}



/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
.mobile-close-btn{
    display: none;
}

/* Responsive */
@media (max-width: 750px) {
    .mobile-header {
        display: flex;
    }

    .side-menu-toggle {
        display: none;
    }

    .side-menu-header {
        display: none;
    }

    .side-menu-navigation {
        transform: translateX(-100%);
        z-index: 9999999;

        &.mobile-open {
            transform: translateX(0);
        }

        .mobile-close-btn {
            position: absolute;
            top: 20px;
            left: 20px;
            color: var(--sidebar-text);
            font-size: 24px;
            cursor: pointer;
            z-index: 10000000;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0, 0, 0, 0.5);
            border-radius: 50%;
            transition: all 0.3s;
            border: none;
        }

        .mobile-close-btn:hover {
            background: rgba(0, 0, 0, 0.7);
        }
    }
    
    .site {
        margin-left: 0;
        margin-top: 60px;
        padding: 0px;
    }
    
    .side-menu-navigation.collapsed + .site {
        margin-left: 0;
    }
} 