﻿:root {
    --mega-header-h: 95px;
}

/* FIX BOX MODEL */
#megaMenu, #megaMenu * {
    box-sizing: border-box;
}

/* OVERLAY */
#megaMenuOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 1100;
}

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

/* MEGA MENU */
#megaMenu {
    margin-top: 0;
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    overflow: hidden;
}

    #megaMenu.open {
        opacity: 1;
        pointer-events: auto;
        background-color: #000000ab;
    }

/* COLUMNS WRAPPER */
.mega-columns {
    flex: 1;
    display: flex;
    overflow: hidden; /* ok: tooltip sarà globale (fixed), quindi non si taglia */
}

/* COLUMN BASE */
.mega-col {
    width: 35%;
    min-width: 0;
    background: #fff;
    border-right: 1px solid #ddd;
    display: none; /* default hidden */
    flex-direction: column; /* layout colonna */
    opacity: 0;
    transform: translateX(24px);
    transition: width .25s ease, transform .25s ease, opacity .2s ease;
}

    .mega-col.active {
        display: flex; /* IMPORTANT: non block */
        opacity: 1;
        transform: translateX(0);
    }

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

    /* COMPACT */
    .mega-col.compact {
        flex: 0 0 80px;
        width: 80px;
    }

        .mega-col.compact .mega-list {
            padding-right: 0;
            padding-left: 15px;
        }

.mega-col.compact .mega-item span {
    display: none;
}

        .mega-col.compact .mega-item {
            justify-content: flex-start;
            border-bottom-right-radius: 0;
            border-top-right-radius: 0;
            padding: 10px;
        }

        .mega-col.compact .col-all-link {
            display: none !important;
        }
/* richiesto: nascondi "Tutti i prodotti" quando compact */

/* HEADER */
.col-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 20px;
    font-weight: 600;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 3;
    height: 80px;
}

.col-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

/* Se colonna non attiva, non mostrare titolo */
.mega-col:not(.active) .col-title {
    display: none;
}

.btn-back {
    background: none;
    border: none;
    font-size: 25px;
    cursor: pointer;
    line-height: 1;
}

/* ALL LINK in header */
.col-all-link {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

    .col-all-link[hidden] {
        display: none !important;
    }

/* LIST (area scrollabile) */
.mega-list {
    list-style: none;
    margin: 0;
    padding: 20px;
    overflow-x: hidden;
    flex: 1;
    overflow-y: hidden; /* default */
    scrollbar-width: thin;
}

/* Scroll SOLO colonna attiva NON compact */
.mega-col.active:not(.compact) .mega-list {
    overflow-y: auto;
}

/* FOOTER fisso in basso (sticky dentro colonna) */
/* ===== FOOTER ===== */
.col-footer {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* bottone pill */
.col-footer-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: #eef6fd;
    color: #0d6efd;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, transform .1s ease;
}

    /* hover */
    .col-footer-link:hover {
        background: #e0efff;
    }

    /* icona sinistra */
    .col-footer-link i {
        font-size: 16px;
        margin-right: 10px;
    }

    /* testo */
    .col-footer-link span {
        flex: 1;
    }

    /* icona destra (menu / elenco) */
    .col-footer-link::after {
        /*content: "\f479";*/ /* bootstrap icon: list */
        font-family: "bootstrap-icons";
        font-size: 16px;
        opacity: .8;
    }

    /* hidden resta hidden */
    .col-footer-link[hidden] {
        display: none !important;
    }

/* niente footer quando colonna compact */
.mega-col.compact .col-footer {
    display: none;

}

/* ITEMS */
.mega-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 30px 10px 10px;
    cursor: pointer;
    position: relative;
    min-width: 0;
    border-radius: 10px;
    transition: all .5s ease;
}

    .mega-item a {
        line-height: 1.3;
    }

    .mega-item span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mega-item:hover {
        background: #e2e2e2;
    }
    /* 

    /* richiesto: active con border-bottom */
    .mega-item.active {
        background: #f2f2f2;
        font-weight: 600;
        /*  border-bottom: 1px solid #f2f2f2;*/
    }

/* freccia */
    .mega-item::after {
        content: "›";
        position: absolute;
        right: 10px;
        color: #999;
        pointer-events: none;
        top: 50%;
        transform: translate(-50%, -50%);
        font-size: 22px !important;
        line-height: 1;
        margin-top: -3px !important;
    }

.mega-col.compact .mega-item::after {
    display: none !important;
}

/* ICON */
.mega-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
    mix-blend-mode: multiply;
}

/* ==== SKELETON ==== */
.skeleton {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.skeleton-icon {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    background: #e5e7eb;
    flex-shrink: 0;
}

.skeleton-text {
    height: 14px;
    width: 100%;
    border-radius: 4px;
    background: #e5e7eb;
}

.skeleton-line {
    width: 70%;
}

.skeleton-short {
    width: 40%;
}

.skeleton-icon, .skeleton-text {
    position: relative;
    overflow: hidden;
}

    .skeleton-icon::after, .skeleton-text::after {
        content: "";
        position: absolute;
        inset: 0;
        transform: translateX(-100%);
        background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
        animation: skeleton-loading 1.2s infinite;
    }

@keyframes skeleton-loading {
    100% {
        transform: translateX(100%);
    }
}

/* ==== TOOLTIP GLOBALE (non viene tagliato da overflow) ==== */
#megaTooltip {
    position: fixed;
    z-index: 2000; /* sopra overlay+menu */
    pointer-events: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .12s ease, transform .12s ease;
    background: #1f2937;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(0,0,0,.25);
}

    #megaTooltip.visible {
        opacity: 1;
        transform: translateY(0);
    }



/* ================= FAMIGLIE MULTI-COLUMN ================= */

.mega-col.col-famiglie.active {
    flex: 1 1 auto;
    width: auto;
}

.mega-col.col-famiglie .mega-item::after {
    display: none;
}

.mega-col.col-famiglie .col-footer a {
    width: calc(50% - 20px);
}

.mega-col.col-famiglie .mega-item {
    padding: 15px;
    min-height: 60px;
    margin-bottom: 0;
    align-items: flex-start;
    width: calc(50% - 20px);
}

/* Le altre colonne restano compatte */
.mega-col.compact {
    flex: 0 0 80px;
}

.col-famiglie .mega-list {
    all: unset;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    overflow: auto !important;
    padding: 20px;
    scrollbar-width: thin;
    align-items: flex-start;
}

.col-famiglie .col-footer {
    position: fixed;
    flex-wrap: wrap;
    flex-direction: unset;
    justify-content: space-between;
    width: 100%;
}

/* ogni item non deve spezzarsi tra colonne */
.col-famiglie .mega-item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin-bottom: 6px;
}

@media (min-width: 1400px) {
    .mega-col.col-famiglie .mega-item {
        padding: 15px;
        min-height: 72px;
        margin-bottom: 0;
        align-items: flex-start;
        width: calc(33.33% - 20px);
    }
    .mega-col.col-famiglie .col-footer a {
        width: calc(33.33% - 20px);
    }

}

@media (max-width: 992px) {

    .mega-col.col-famiglie .col-footer a {
        width: 100%;
    }

}
/* Quando compatta, nascondi titolo*/
.mega-col.compact .col-title {
    display: none !important;
}
