#{$wrap} #{$menu} > li.mega-menu-tabbed > ul.mega-sub-menu {
    padding: 0;
    flex-direction: column;
}

@include desktop {
    #{$wrap} #{$menu}[data-effect="fade"] li.mega-menu-item.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item:not(.mega-disable-transition) {
        > ul.mega-sub-menu {
            opacity: 1;
            transition: none;
        }

        > ul.mega-sub-menu > li {
            opacity: 0;
            transition: opacity $effect_speed ease-in;
        }

        &.mega-toggle-on > ul.mega-sub-menu > li {
            opacity: 1;
        }
    }

    #{$wrap} #{$menu}[data-effect="fade_up"] li.mega-menu-item.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item:not(.mega-disable-transition) {
        > ul.mega-sub-menu {
            opacity: 1;
            transform: translate(0, 0);
            transition: none;
        }

        > ul.mega-sub-menu > li {
            opacity: 0;
            transform: translate(0, 10px);
            transition: opacity $effect_speed ease-in, transform $effect_speed ease-in;
        }

        &.mega-toggle-on > ul.mega-sub-menu > li {
            opacity: 1;
            transform: translate(0, 0);
        }
    }

    #{$wrap} #{$menu}[data-effect="slide_up"] li.mega-menu-item.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item:not(.mega-disable-transition) {
        > ul.mega-sub-menu {
            transform: translate(0, 0);
            transition: none;
        }

        > ul.mega-sub-menu > li {
            transform: translate(0, 10px);
            transition: transform $effect_speed ease-in;
        }

        &.mega-toggle-on > ul.mega-sub-menu > li {
            transform: translate(0, 0);
        }
    }
}

#{$wrap} #{$menu} > li.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item {
    width: 100%;
    padding: 0;
    position: static;

    > a.mega-menu-link {
        display: flex;
        width: $tabbed_link_width;
        @include background($tabbed_link_background_from, $tabbed_link_background_to);
        color: $tabbed_link_color;
        font-family: unquote($tabbed_link_family);
        font-size: $tabbed_link_size;
        font-weight: $tabbed_link_weight;
        padding: $tabbed_link_padding_top $tabbed_link_padding_right $tabbed_link_padding_bottom $tabbed_link_padding_left;
        min-height: $tabbed_link_height;
        height: fit-content;
        align-items: center;
        text-decoration: $tabbed_link_text_decoration;
        text-transform: $tabbed_link_text_transform;
        margin: 0;
        border: 0;
        cursor: pointer;

        @if $tabbed_link_item_divider == 'on' {
            border-bottom-width: 1px;
            border-style: solid;
            border-color: $tabbed_link_item_divider_color;
        }
    }

    &.mega-toggle-on > a.mega-menu-link,
    > a.mega-menu-link:hover,
    > a.mega-menu-link:focus {
        @include background($tabbed_link_background_hover_from, $tabbed_link_background_hover_to);
        font-weight: $tabbed_link_weight_hover;
        text-decoration: $tabbed_link_text_decoration_hover;
        color: $tabbed_link_color_hover;

        @if $tabbed_link_item_divider == 'on' {
            border-color: $tabbed_link_item_divider_color;
        }
    }

    &.mega-menu-item-has-children > a.mega-menu-link > .mega-indicator {
        margin-left: auto;
    }

    @include desktop {
        &.mega-menu-item-has-children > a.mega-menu-link > .mega-indicator:after {
            content: $arrow_right;
        }
    }

    /* Tab Content */
    > ul.mega-sub-menu {
        @if unit($tabbed_link_width) == '%' {
            width: 100% - $tabbed_link_width;
        }
        @if unit($tabbed_link_width) == 'px' {
            width: calc(100% - #{$tabbed_link_width});
        }
        float: left;
        clear: none;
        position: absolute;
        top: 0;
        left: $tabbed_link_width;
        visibility: hidden;
        border-left: 1px solid $tabbed_link_vertical_divider;
        padding: $panel_padding_top $panel_padding_right $panel_padding_bottom $panel_padding_left;
        flex-direction: row;

        @include desktop {
            min-height: 100%;
        }
    }

    &.mega-toggle-on > ul.mega-sub-menu {
        visibility: visible;
    }

    /* Tab Content Widget */
    > ul.mega-sub-menu > li.mega-menu-item {
        float: left;
        padding: $panel_widget_padding_top $panel_widget_padding_right $panel_widget_padding_bottom $panel_widget_padding_left;

        &.mega-menu-clear {
            clear: left;
        }
    }

    ul.mega-sub-menu li.mega-menu-item ul.mega-sub-menu {
        margin-left: 0;
    }

    ul.mega-sub-menu li.mega-menu-item ul.mega-sub-menu li.mega-menu-item ul.mega-sub-menu {
        margin-left: 10px;
    }
}

@include mobile {
    #{$wrap} #{$menu} {

        li.mega-menu-item.mega-menu-megamenu.mega-menu-tabbed ul.mega-sub-menu ul.mega-sub-menu,
        li.mega-menu-item.mega-menu-megamenu.mega-menu-tabbed ul.mega-sub-menu ul.mega-sub-menu li.mega-collapse-children > ul.mega-sub-menu {
            display: none;
        }

        li.mega-menu-item.mega-menu-megamenu.mega-menu-tabbed ul.mega-sub-menu ul.mega-sub-menu ul.mega-sub-menu,
        li.mega-menu-item.mega-menu-megamenu.mega-menu-tabbed.mega-toggle-on > ul.mega-sub-menu,
        li.mega-menu-item.mega-menu-megamenu.mega-menu-tabbed li.mega-menu-item.mega-toggle-on > ul.mega-sub-menu,
        li.mega-menu-item.mega-menu-megamenu.mega-menu-tabbed li.mega-menu-item.mega-toggle-on > ul.mega-sub-menu ul.mega-sub-menu,
        li.mega-menu-item.mega-menu-megamenu.mega-menu-tabbed ul.mega-sub-menu ul.mega-sub-menu li.mega-collapse-children.mega-toggle-on > ul.mega-sub-menu {
            display: block;
        }

        > li.mega-menu-tabbed > ul.mega-sub-menu {
            padding: 0;
        }

        > li.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu {
            @if $mobile_columns == 2 {
                > li.mega-menu-item {
                    width: 50%;
                }

                > li:nth-child(odd) {
                    clear: left;
                }
            } @else {
                > li.mega-menu-item {
                    width: 100%;
                    clear: both;
                }
            }
        }
    
        > li.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item {
            width: 100%;
            padding: 0;
            position: static;

            > a.mega-menu-link {
                width: 100%;
                float: left;
                @include background($flyout_background_from, $flyout_background_to);
                color: $flyout_link_color;
                font-family: unquote($flyout_link_family);
                font-size: $flyout_link_size;
                font-weight: $flyout_link_weight;
                padding: $flyout_link_padding_top $flyout_link_padding_right $flyout_link_padding_bottom $flyout_link_padding_left;
                line-height: $flyout_link_height;
                text-decoration: $flyout_link_text_decoration;
                text-transform: $flyout_link_text_transform;
            }

            &.mega-menu-item-has-children > a.mega-menu-link > span.mega-indicator:after {
                content: $arrow_down;
            }

            &.mega-menu-item-has-children.mega-toggle-on > a.mega-menu-link > span.mega-indicator:after {
                content: $arrow_up;
            }

            /* Tab Content */
            > ul.mega-sub-menu {
                width: 100%;
                position: relative;
                top: 0;
                left: auto;
                border-left: 0;
                padding: 10px;
            }

            ul.mega-sub-menu li.mega-menu-item ul.mega-sub-menu li.mega-menu-item ul.mega-sub-menu {
                margin-left: 0;
            }
        }
    }
}