/* Menu 3 niveaux en cascade - CASA17 */

/* Menu drawer de base */
.drawer-menu {
    position: fixed;
    top: 0;
    left: -400px;
    width: 380px;
    height: 100vh;
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-right: 2px solid #444;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.7);
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    overflow-y: auto;
}

.drawer-menu.open {
    left: 0;
}

.drawer-header {
    background: linear-gradient(135deg, var(--casa17-vert-fonce) 0%, var(--casa17-vert-pastel) 100%);
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--casa17-vert-fonce);
}

.drawer-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: white;
}

.drawer-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    transition: background 0.3s ease;
}

.drawer-close:hover {
    background: rgba(255,255,255,0.2);
}

.drawer-content {
    padding: 20px;
}

/* Items Niveau 1 */
.menu-item-level1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 15px;
    border: 2px solid transparent;
}

.menu-item-level1:hover {
    background: linear-gradient(90deg, rgba(255, 132, 49, 0.2) 0%, rgba(255, 132, 49, 0.1) 100%);
    border-color: var(--casa17-orange-vif);
}

.menu-item-level1.active {
    background: linear-gradient(90deg, var(--casa17-orange-vif) 0%, rgba(255, 132, 49, 0.8) 100%);
    box-shadow: inset 3px 0 0 var(--casa17-vert-fonce);
}

/* Items Niveau 2 */
.menu-item-level2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: transparent;
    border-left: 3px solid transparent;
    margin: 2px 0;
}

.menu-item-level2:hover {
    background: linear-gradient(90deg, rgba(255, 132, 49, 0.2) 0%, rgba(255, 132, 49, 0.1) 100%);
    border-left-color: var(--casa17-orange-vif);
}

.menu-item-level2.active {
    background: linear-gradient(90deg, rgba(255, 132, 49, 0.3) 0%, rgba(255, 132, 49, 0.2) 100%);
    border-left-color: var(--casa17-orange-vif);
}

/* Liens directs dans les menus */
.menu-item-link {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    color: #F4F4F4;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    margin: 2px 0;
}

.menu-item-link:hover {
    background: linear-gradient(90deg, rgba(255, 132, 49, 0.2) 0%, rgba(255, 132, 49, 0.1) 100%);
    border-left-color: var(--casa17-orange-vif);
    color: var(--casa17-orange-vif);
}

.menu-label {
    font-size: 1rem;
    font-weight: 500;
    color: #F4F4F4;
}

.menu-arrow {
    font-size: 1.5rem;
    color: var(--casa17-orange-vif);
    transition: transform 0.2s ease;
}

.menu-item-level1.active .menu-arrow,
.menu-item-level2.active .menu-arrow {
    color: white;
    transform: rotate(90deg);
}

/* Submenu Flyout - Niveau 2 */
.submenu-flyout.level2 {
    position: fixed;
    left: 380px;
    top: 0;
    width: 300px;
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-right: 2px solid #444;
    box-shadow: 2px 0 20px rgba(0,0,0,0.5);
    max-height: 100vh;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10001;
    padding: 20px 0;
}

.submenu-flyout.level2.show {
    opacity: 1;
    pointer-events: all;
}

/* Submenu Flyout - Niveau 3 */
.submenu-flyout.level3 {
    position: fixed;
    left: 680px;
    top: 0;
    width: 280px;
    background: linear-gradient(135deg, #3d3d3d 0%, #2a2a2a 100%);
    border-right: 2px solid #555;
    box-shadow: 2px 0 20px rgba(0,0,0,0.5);
    max-height: 100vh;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10002;
    padding: 20px 0;
}

.submenu-flyout.level3.show {
    opacity: 1;
    pointer-events: all;
}

/* Liens niveau 3 */
.submenu-flyout.level3 a {
    display: block;
    padding: 12px 20px;
    color: #F4F4F4;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    margin: 2px 0;
}

.submenu-flyout.level3 a:hover {
    background: linear-gradient(90deg, rgba(255, 132, 49, 0.3) 0%, rgba(255, 132, 49, 0.2) 100%);
    border-left-color: var(--casa17-orange-vif);
    color: var(--casa17-orange-vif);
    padding-left: 25px;
}

/* Overlay */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 9999;
}

.drawer-overlay.show {
    opacity: 1;
    pointer-events: all;
}

/* Mobile: clic pour ouvrir submenu */
@media (max-width: 768px) {
    .drawer-menu {
        width: 90%;
        max-width: 380px;
    }

    .submenu-flyout {
        position: static;
        width: 100%;
        box-shadow: none;
        max-height: 0;
        overflow: hidden;
        background: rgba(0,0,0,0.3);
        padding: 0;
        opacity: 1;
        pointer-events: all;
        transition: max-height 0.3s ease, padding 0.3s ease;
        border-left: none;
    }

    .submenu-flyout.show {
        max-height: 500px;
        padding: 10px 0;
    }

    .submenu-flyout a {
        padding-left: 40px;
        font-size: 0.95rem;
    }

    .submenu-flyout a:hover {
        padding-left: 45px;
    }
}
