﻿/* =============================
   OVERLAY
============================= */
#megaMenuOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .20s ease;
    z-index: 900;
}

    #megaMenuOverlay.visible {
        opacity: 1;
        pointer-events: auto;
    }

/* =============================
   MENU PRINCIPALE (NASCOSTO ALL’AVVIO)
============================= */
#megaMenu {
    position: fixed;
    left: 0;
    right: 0;
    /* aggiornato via JS in base alla navbar */
    top: var(--header-height, 80px);
    background: #fff;
    z-index: 901;
    /* nascosto all’inizio */
    opacity: 0;
    pointer-events: none;
    display: block; /* IMPORTANTE: gestiamo la visibilità con opacity */
    transition: opacity .20s ease;
    /* il menu non scrolla, scrollano SOLO le colonne */
    max-height: calc(100vh - var(--header-height, 80px));
    overflow: hidden;
}

    #megaMenu.open {
        opacity: 1;
        pointer-events: auto;
    }

/* =============================
   COLONNE
============================= */
.mega-col {
    min-height: 350px;
    /*border-right: 1px solid #ccc;*/
    overflow-y: auto;
    padding: 20px;
}

    .mega-col:last-child {
        border-right: none;
    }

.mega-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* =============================
   LISTE LINEE / GRUPPI
============================= */
.mega-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-item {
    position: relative;
    padding: 6px 22px 6px 4px;
    cursor: pointer;
}

    .mega-item:hover {
        background: #eee;
    }

    .mega-item.active {
        background: #eee !important;
        font-weight: bold;
    }

    /* freccia destra */
    .mega-item::after {
        content: "";
        position: absolute;
        right: 6px;
        top: 50%;
        width: 12px;
        height: 12px;
        transform: translateY(-50%);
        background-size: 12px;
        background-repeat: no-repeat;
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 6 15 12 9 18'></polyline></svg>");
    }

/* =============================
   CLASSI / FAMIGLIE (COLLAPSE)
============================= */
.classe-item {
    border-bottom: 1px solid #ddd;
    padding: 4px 0;
}

.classe-header {
    cursor: pointer;
    position: relative;
    padding: 6px 22px 6px 4px;
}

    /* freccia classe (chiusa → destra) */
    .classe-header::after {
        content: "";
        position: absolute;
        right: 6px;
        top: 50%;
        width: 12px;
        height: 12px;
        transform: translateY(-50%);
        background-size: 12px;
        background-repeat: no-repeat;
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 6 15 12 9 18'></polyline></svg>");
    }

/* collapse aperto → freccia giù */
.classe-item.open .classe-header::after {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
}

.fam-collapse {
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
    padding-left: 10px;
}

.classe-item.open .fam-collapse {
    max-height: 500px;
}

/* famiglie */
.fam-collapse li {
    padding: 4px 0;
}
