/* ============================================================
   NEXUS - SIDEBAR & NAVIGAZIONE
   Superficie in vetro (blur), coerente con nexus-ui.css
   ============================================================ */

.nexus-sidebar {
    background-color: var(--nexus-surface);
    min-width: 260px;
    height: 100vh;
    border-right: 1px solid var(--nexus-border);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s var(--nexus-ease);
}

/* Colonna: brand fisso in alto, nav scrollabile, footer fisso in basso */
.brand-section { flex-shrink: 0; }
.nexus-nav { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.nexus-sidebar-footer {
    flex-shrink: 0;
    padding: 14px 20px;
    border-top: 1px solid var(--nexus-border);
    background: var(--nexus-surface);
}

/* ===== Riduzione (collapse) della sidebar ===== */
body.sidebar-collapsed .nexus-sidebar { margin-left: -320px; }

.sidebar-collapse-btn {
    background: none; border: none; cursor: pointer; line-height: 1;
    color: var(--nexus-text-muted); padding: 5px 7px; border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.sidebar-collapse-btn:hover { background: var(--nexus-surface-2); color: var(--nexus-text); }

.sidebar-open-btn {
    display: none;
    position: fixed; top: 14px; left: 14px; z-index: 60;
    width: 38px; height: 38px; align-items: center; justify-content: center;
    background: var(--nexus-surface); border: 1px solid var(--nexus-border);
    border-radius: 8px; color: var(--nexus-text); cursor: pointer;
}
.sidebar-open-btn:hover { background: var(--nexus-surface-2); }
body.sidebar-collapsed .sidebar-open-btn { display: flex; }

/* ===== Voce "in arrivo" (rotta roadmap non ancora implementata) ===== */
.menu-content a.soon { opacity: 0.5; }
.menu-content a.soon .soon-tag {
    margin-left: auto; font-size: 8px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--nexus-text-muted);
    border: 1px solid var(--nexus-border); border-radius: 4px; padding: 1px 4px;
}

/* Etichette e trigger */
.menu-label {
    color: var(--nexus-text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 600;
    margin: 0; /* Reset per allineamento nel trigger */
}

.menu-trigger {
    background: none;
    border: none;
    cursor: pointer;
    outline: none;
    padding: 10px 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Fisarmonica */
.menu-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--nexus-ease);
    display: flex;
    flex-direction: column;
}

.menu-category.active .menu-content {
    max-height: 1200px;   /* generoso: il gruppo Governance ha molte voci — evita il clipping (era 500px, tagliava le ultime) */
    margin-bottom: 8px;
}

.menu-category.active .fa-chevron-down {
    transform: rotate(180deg);
    color: var(--nexus-blue);
}

/* Link (voci normali e dentro sottomenu) */
.menu-group a, .menu-content a {
    display: flex;
    align-items: center;
    color: var(--nexus-text-secondary);
    text-decoration: none;
    padding: 9px 12px;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: var(--nexus-radius-sm);
    transition: background-color 0.15s var(--nexus-ease), color 0.15s var(--nexus-ease);
}

.menu-content a {
    margin-left: 10px;
    border-left: 1px solid var(--nexus-border);
    border-radius: 0 var(--nexus-radius-sm) var(--nexus-radius-sm) 0;
}

.menu-group a i, .menu-content a i {
    width: 20px;
    margin-right: 12px;
    text-align: center;
}

.menu-group a:hover, .menu-content a:hover {
    background: var(--nexus-surface-2);
    color: var(--nexus-text);
}

/* Badge Ruoli */
.badge-root, .badge-msp, .badge-pa {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 99px;
    display: inline-block;
    margin-top: 6px;
    border: none !important;
}

.badge-root { background: var(--nexus-blue-tint) !important; color: var(--nexus-blue-strong) !important; }
.badge-msp  { background: var(--nexus-surface-3) !important; color: var(--nexus-text-secondary) !important; }
.badge-pa   { background: var(--nexus-green-tint) !important; color: var(--nexus-green) !important; }

.nexus-logout-link:hover {
    color: var(--nexus-red) !important;
}

/* Kill-Switch: resta un'azione critica, ma senza il bordo tratteggiato urlato */
.btn-emergency {
    color: var(--nexus-red) !important;
    font-weight: 600 !important;
    background: var(--nexus-red-tint) !important;
    border: 1px solid transparent !important;
    border-radius: var(--nexus-radius-sm) !important;
    margin-top: 10px;
    transition: background-color 0.2s var(--nexus-ease), color 0.2s var(--nexus-ease) !important;
}

.btn-emergency:hover {
    background: var(--nexus-red) !important;
    color: #ffffff !important;
}
