/* assets/menu.css - VERSIONE SINISTRA CORRETTA (Z-INDEX FIX) */

/* 1. BOTTONE HAMBURGER (Livello più basso tra gli elementi menu) */
.menu-toggle-btn {
    position: fixed;
    top: 15px;      /* Un po' più in alto */
    left: 15px;     /* A Sinistra */
    z-index: 1500;  /* LIVELLO BASSO: deve essere coperto dal menu */
    background: white;
    color: #2E5BBA;
    border: none;
    border-radius: 50%;
    width: 45px;    /* Leggermente più piccolo ed elegante */
    height: 45px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: all 0.3s ease;
}

.menu-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

/* 2. OVERLAY SFONDO SCURO (Livello intermedio) */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1900; /* LIVELLO MEDIO: Copre il bottone ma sta sotto il menu */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(3px); /* Effetto sfocato per risaltare il menu */
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 3. MENU LATERALE (Livello MASSIMO) */
.side-menu {
    position: fixed;
    top: 0;
    left: -320px; /* Nascosto a sinistra */
    width: 280px;
    height: 100vh;
    background: white;
    z-index: 2000; /* LIVELLO MASSIMO: Copre TUTTO, incluso il bottone */
    box-shadow: 5px 0 25px rgba(0,0,0,0.2); 
    transition: left 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.side-menu.active {
    left: 0; /* Esce fuori e copre il bottone che sta sotto */
}

/* --- HEADER DEL MENU --- */
.side-menu-header {
    padding: 20px;
    background: #2E5BBA;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Piccola ombra sotto la testata */
}

.side-menu-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.close-menu-btn {
    background: rgba(255,255,255,0.2); /* Sfondo semitrasparente */
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.close-menu-btn:hover {
    background: rgba(255,255,255,0.4);
}

/* --- CONTENUTO MENU --- */
.side-menu-content {
    padding: 10px 0;
    flex: 1;
}

/* Macroarea */
.macroarea {
    border-bottom: 1px solid #f0f0f0;
}

.macroarea-btn {
    width: 100%;
    background: white;
    color: #444;
    padding: 15px 20px;
    text-align: left;
    border: none;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.macroarea-btn:hover {
    background: #f8f9fa;
    color: #2E5BBA;
    padding-left: 25px; /* Effetto scivolamento */
}

.macroarea-btn .arrow {
    transition: transform 0.3s ease;
    font-size: 0.7em;
    color: #999;
}

.macroarea-btn.active .arrow {
    transform: rotate(180deg);
    color: #2E5BBA;
}

.macroarea-btn.active {
    background: #e3f2fd; /* Sfondo azzurrino quando attivo */
    color: #2E5BBA;
}

/* Sottomenu */
.submenu {
    display: none;
    background: #fafafa;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.03);
}

.submenu.open {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Voce Singola */
.side-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 20px 12px 40px; /* Indentato */
    text-align: left;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.side-menu-item:hover {
    color: #2E5BBA;
    background: white;
    border-left-color: #2E5BBA;
    transform: translateX(5px);
}

.side-menu-item.active {
    color: #2E5BBA;
    font-weight: bold;
    background: white;
    border-left-color: #2E5BBA;
}

/* Footer Menu */
.side-menu-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    text-align: center;
    background: #f8f9fa;
}

/* Nascondi tab vecchi */
.tabs, .navigation-buttons { display: none !important; }

/* MEDIA QUERY MOBILE: Prevenire sovrapposizione con Logo Sito */
@media (max-width: 768px) {
    /* Sposta leggermente il contenuto principale giù se necessario */
    body {
        /* Se il bottone copre il logo, puoi aggiungere padding qui */
        /* padding-top: 60px; */
    }
}
