/* Sortiment als Mega-Menue (template/cb.categories.php, js/megamenu.js) */

#megamenu {
    display: none;
    left: 0;
    padding-top: 6px;
    position: absolute;
    top: 100%;
    width: 1180px;
    max-width: calc(100vw - 32px);
    z-index: 20000;
    font-family: Roboto, Arial, sans-serif;
    text-align: left;
}

@media (hover: hover) {
    .navigation-main .navigation--entry:hover > #megamenu,
    .navigation-main .navigation--entry:focus-within > #megamenu {
        display: block;
    }
}

#megamenu.open {
    display: block;
}

#megamenu [hidden] {
    display: none !important;
}

#megamenu .mm-panel {
    background: #ffffff;
    border: 1px solid #cfd9ec;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 18px 40px rgba(31, 41, 55, .18);
    color: #1f2937;
    display: grid;
    grid-template-columns: 280px 1fr;
    max-height: calc(100vh - 200px);
    min-height: 420px;
    overflow: hidden;
}

#megamenu .mm-top {
    align-items: center;
    border-bottom: 1px solid #e5e9f0;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    grid-column: 1 / -1;
    padding: 14px 18px;
}

#megamenu .mm-find {
    flex: 1;
    min-width: 240px;
}

#megamenu .mm-find input {
    border: 1px solid #cfd9ec;
    border-radius: 20px;
    box-sizing: border-box;
    font: inherit;
    font-size: 15px;
    height: 40px;
    padding: 0 16px;
    width: 100%;
}

#megamenu .mm-az {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

#megamenu .mm-az button {
    background: none;
    border: 0;
    border-radius: 4px;
    color: #4267b2;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    height: 26px;
    padding: 0;
    width: 24px;
}

#megamenu .mm-az button:hover {
    background: #eef3fc;
}

#megamenu .mm-az button:disabled {
    background: none;
    color: #c3cbd8;
    cursor: default;
}

#megamenu .mm-close {
    align-items: center;
    background: #eef1f6;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    font-size: 24px;
    height: 40px;
    justify-content: center;
    line-height: 1;
    width: 40px;
}

#megamenu .mm-rail {
    background: #fbfcfe;
    border-right: 1px solid #e5e9f0;
    overflow: auto;
    padding: 10px 0;
}

#megamenu .mm-feat {
    background: linear-gradient(135deg, #4267b2, #5b82cf);
    border-radius: 8px;
    color: #ffffff !important;
    display: block;
    margin: 0 12px 10px;
    padding: 12px 14px;
}

#megamenu .mm-feat b {
    display: block;
    font-size: 15px;
}

#megamenu .mm-feat small {
    font-size: 12px;
    opacity: .9;
}

#megamenu .mm-feat.mm-shop {
    background: linear-gradient(135deg, #e3202f, #f0505b);
    margin-top: 10px;
}

#megamenu .mm-theme {
    align-items: center;
    background: none;
    border: 0;
    border-left: 3px solid transparent;
    color: #1f2937;
    cursor: pointer;
    display: flex;
    font: inherit;
    font-size: 15px;
    gap: 12px;
    padding: 10px 20px;
    text-align: left;
    width: 100%;
}

#megamenu .mm-theme:hover,
#megamenu .mm-theme[aria-selected="true"] {
    background: #eef3fc;
}

#megamenu .mm-theme[aria-selected="true"] {
    border-left-color: #4267b2;
    font-weight: 500;
}

#megamenu .mm-n {
    background: #eef1f6;
    border-radius: 10px;
    color: #6b7280;
    font-size: 12px;
    margin-left: auto;
    padding: 1px 8px;
}

#megamenu .mm-body {
    overflow: auto;
    padding: 18px 24px 24px;
}

#megamenu h3 {
    font-size: 20px;
    font-weight: 500;
    margin: 0 0 4px;
}

#megamenu .mm-sub {
    color: #6b7280;
    font-size: 13px;
    margin: 0 0 16px;
}

#megamenu .mm-cols {
    column-gap: 28px;
    columns: 3 200px;
}

#megamenu .mm-cols a {
    border-radius: 5px;
    break-inside: avoid;
    color: #1f2937;
    display: block;
    font-size: 15px;
    margin: 0 -8px;
    padding: 6px 8px;
}

#megamenu .mm-cols a:hover {
    background: #eef3fc;
    color: #4267b2;
}

#megamenu .mm-letter {
    break-after: avoid;
    color: #4267b2;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 10px 0 2px;
}

#megamenu .mm-results .mm-cols {
    columns: 2 300px;
}

#megamenu .mm-results .mm-cols a {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

#megamenu .mm-results small {
    color: #6b7280;
    font-size: 12px;
    white-space: nowrap;
}

#megamenu mark {
    background: #ffe89a;
    border-radius: 2px;
    color: inherit;
}

#megamenu .mm-empty {
    color: #6b7280;
    padding: 20px 0;
}

#megamenu a:focus-visible,
#megamenu button:focus-visible,
#megamenu input:focus-visible {
    outline: 3px solid #9bb5e6;
    outline-offset: 1px;
}

/* Handy und schmale Fenster: Vollbild mit aufklappenden Themen */
@media (max-width: 950px) {
    #megamenu.open {
        inset: 0;
        max-width: none;
        padding: 0;
        position: fixed;
        width: auto;
        z-index: 30000;
    }

    #megamenu .mm-panel {
        border-radius: 0;
        display: block;
        height: 100%;
        max-height: none;
        overflow: auto;
    }

    #megamenu .mm-top {
        background: #ffffff;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    #megamenu .mm-close {
        display: inline-flex;
    }

    #megamenu .mm-az,
    #megamenu .mm-body {
        display: none;
    }

    #megamenu .mm-body.mm-searching {
        display: block;
    }

    #megamenu .mm-rail {
        background: #ffffff;
        border: 0;
    }

    #megamenu .mm-theme {
        border-bottom: 1px solid #e5e9f0;
        border-left: 0;
        font-size: 16px;
        padding: 14px 18px;
    }

    #megamenu .mm-acc {
        border-bottom: 1px solid #e5e9f0;
        padding: 4px 18px 12px 30px;
    }

    #megamenu .mm-acc a {
        border-bottom: 1px dashed #eef1f6;
        color: #1f2937;
        display: block;
        font-size: 15px;
        padding: 9px 0;
    }
}

@media (prefers-reduced-motion: no-preference) {
    #megamenu .mm-panel {
        animation: mm-drop .16s ease-out;
    }

    @keyframes mm-drop {
        from {
            opacity: 0;
            transform: translateY(-6px);
        }
    }
}
