function calc_box_shadow( h, v, b, s, color, inset, type ) { // TYPE: ltr / rtl
    if( h == '0' && v == '0' && b == '0' && s == '0' ) {
        return '';
    }
    if(type === 'rtl') {
        h = convertNumber(h);
        //v = convertNumber(v);
    }
    var shadow = h+'px '+v+'px '+b+'px '+s+'px '+color+''+(inset ? ' inset' : '') ;

    return 'box-shadow: '+shadow+';\
	-webkit-box-shadow: '+shadow+';\
	-moz-box-shadow: '+shadow+';';
}

function convertNumber(v) {
    if(v < 0) {
        v = Math.abs(v);
    } else {
        v *= -1;
    }

    return v;
}

function updatemenu(isLive){
    isLive = ( typeof isLive === 'undefined' ) ? true : isLive;
    var _ = jQuery,css='',
        prefix= !isLive ? _('input#jux_mm_adv_css_prefix').val() : '',
        breakpoint = _('input#jux_mm_mobile_menu_breakpoint').val();
    prefix = (prefix!=='') ? prefix + ' ':'';
    if(isLive) {
        var container_id = prefix + '.juxnav.' + _('.juxnav').attr('id') + ' ',
            container = prefix + '.juxnav.' + _('.juxnav').attr('id');
        var button_toggle_id = '#jux-collapse-bar-' + _('.juxnav').attr('id').split('-')[2];
    } else {
        var container_id = prefix + '.juxnav.' + 'jux-easy-megamenu-MOD_ID' + ' ',
            container = prefix + '.juxnav.' + 'jux-easy-megamenu-MOD_ID';
        var button_toggle_id = '#jux-collapse-bar-MOD_ID';
    }
    var breakpoint = (breakpoint==='') ? 768 : parseInt(breakpoint);
    
    var breakpoint_max = breakpoint - 1;

	css += '.navbar { display: block;}';
    css += '@media (min-width: ' + breakpoint + 'px) {' +
            container_id + '.jux-easy-megamenu.animate .jux-mega > .jux-dropdown-menu{' +
                'transition-duration:'+_('input[name="jux_ez_mm_animation_duration"]').val()+'ms;' +
                '-moz-transition-duration:'+_('input[name="jux_ez_mm_animation_duration"]').val()+'ms;' +
                '-webkit-transition-duration:'+_('input[name="jux_ez_mm_animation_duration"]').val()+'ms;' +
                'transition-delay:'+_('input[name="jux_ez_mm_animation_delay"]').val()+'ms;' +
                '-moz-transition-delay:'+_('input[name="jux_ez_mm_animation_delay"]').val()+'ms;' +
                '-webkit-transition-delay:'+_('input[name="jux_ez_mm_animation_delay"]').val()+'ms;' +
            '}' +
        container_id + ' .meganav.jux-nav-mobile {display: none;}' +
        container_id + ' .meganav.jux-nav {';
    css += 'display: flex; flex-wrap: wrap;';
        if(_('select#jux_ez_mm_orientation').val() === 'vertical') {
            css += 'flex-direction: column;';
        } else {
            css += 'flex-direction: row;';
        }
        css += '}' +
        '}';

    css += container_id + ' .meganav.jux-nav > li, ' +
        container_id + ' .meganav > li{ display: flex; flex-wrap: wrap}';

    if(_('#jux_ez_mm_disable_caret').is(":checked"))
    {
        css += container_id + ' .jux-easy-megamenu .jux-nav .jux-caret,';
        css += container_id + ' .jux-easy-megamenu .meganav .jux-caret {';
        css += 'display: none;';
        css += '}';
    }
    //menu bar
    css += container_id + '.jux-easy-megamenu {';
    css += 'border-top-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_left"]').val() +'px;';
    css += '-moz-border-top-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_left"]').val() +'px;';
    css += '-o-border-top-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_left"]').val() + 'px;';
    css += 'border-top-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_right"]').val() +'px;';
    css += '-moz-border-top-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_right"]').val() +'px;';
    css += '-o-border-top-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_right"]').val() + 'px;';
    css += 'border-bottom-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_right"]').val() +'px;';
    css += '-moz-border-bottom-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_right"]').val() +'px;';
    css += '-o-border-bottom-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_right"]').val() + 'px;';
    css += 'border-bottom-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_left"]').val() +'px;';
    css += '-moz-border-bottom-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_left"]').val() +'px;';
    css += '-o-border-bottom-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_left"]').val() + 'px;';

    _('#jux-menu-bar-border-position').find('input').each(function(){
        var _this = _(this);
        if(_this.is(':checked')){
            css +='border-'+_this.val() +':'+_('input[name="jux_mm_menu_bar_border_width"]').val()+'px '+_('select#jux_mm_menu_bar_border_style').val()+' '+_('input#jux_mm_menu_bar_border_color').val() +';';
        }
    });


    css +='padding-right:'+_('input[name="jux_mm_menu_bar_padding_right"]').val()+'px;';
    css +='padding-left:'+_('input[name="jux_mm_menu_bar_padding_left"]').val()+'px;';
    css +='padding-top:'+_('input[name="jux_mm_menu_bar_padding_top"]').val()+'px;';
    css +='padding-bottom:'+_('input[name="jux_mm_menu_bar_padding_bottom"]').val()+'px;';
    css +='margin-right:'+_('input[name="jux_mm_menu_bar_margin_right"]').val()+'px;';
    css +='margin-left:'+_('input[name="jux_mm_menu_bar_margin_left"]').val()+'px;';

    css +='}';

    css += container + '.jux-mm-sticky > div{';
    css +='width:'+_('input#jux_ez_mm_sticky_wrap').val()+';';
    css += 'margin: 0 auto;';
    css +='}';

    css += container + '.jux-mm-sticky.jux-slideDown {';
    css += 'top: '+ _('#jux_ez_mm_sticky_margin_top').val() + ';';
    css += '}';

    var menubarHorizontalShadow = _('input[name="jux_mm_menu_bar_h_shadow"]').val(),
    menubarVerticalShadow = _('input[name="jux_mm_menu_bar_v_shadow"]').val(),
    menubarShadowBlur = _('input[name="jux_mm_menu_bar_shadow_blur"]').val(),
    menubarShadowSize = _('input[name="jux_mm_menu_bar_shadow_size"]').val(),
    menubarShadowColor = _('input#jux_mm_menu_bar_shadow_color').val(),
    menubarShadowInset = _('input#jux_mm_menu_bar_shadow_inset').is(':checked'),
    menubarShadowType = 'ltr';
    css += container+'{';
    css += calc_box_shadow(menubarHorizontalShadow, menubarVerticalShadow, menubarShadowBlur, menubarShadowSize, menubarShadowColor, menubarShadowInset, menubarShadowType);

    if(_('select#jux_mm_menu_bar_bg_type').val() == 'solid') {
        css += 'background:'+ _('input#jux_mm_menu_bar_solid_bg_color').val()+';'
    } else {
        css += 'background: linear-gradient('+_('input#jux_mm_menu_bar_bg_start_color').val()+', '+_('input#jux_mm_menu_bar_bg_end_color').val()+');'
    }


    css += 'border-top-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_left"]').val() +'px;';
    css += '-moz-border-top-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_left"]').val() +'px;';
    css += '-o-border-top-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_left"]').val() + 'px;';
    css += 'border-top-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_right"]').val() +'px;';
    css += '-moz-border-top-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_right"]').val() +'px;';
    css += '-o-border-top-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_right"]').val() + 'px;';
    css += 'border-bottom-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_right"]').val() +'px;';
    css += '-moz-border-bottom-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_right"]').val() +'px;';
    css += '-o-border-bottom-right-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_right"]').val() + 'px;';
    css += 'border-bottom-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_left"]').val() +'px;';
    css += '-moz-border-bottom-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_left"]').val() +'px;';
    css += '-o-border-bottom-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_left"]').val() + 'px;';
    css +='}';

    var menubarShadowType = 'rtl';
    css += '.rtl ' + container+'{';
    css += calc_box_shadow(menubarHorizontalShadow, menubarVerticalShadow, menubarShadowBlur, menubarShadowSize, menubarShadowColor, menubarShadowInset, menubarShadowType);
    css +='}';

    //item flex-wrap: wrap/nowrap
    css += container_id + '.meganav > li > a > .jux-menu-item-wrapper, ' + container_id + '.meganav > li > .separator > .jux-menu-item-wrapper {';
    if(_('select#jux_mm_top_menu_icon_position').val() == 'above') {
      css += 'flex-wrap: wrap;';
    } else {
      css += 'flex-wrap: nowrap;';
    }
    css += '}';
    css += container_id + '.meganav > li li > a > .jux-menu-item-wrapper, ' + container_id + '.meganav > li li > .separator > .jux-menu-item-wrapper {';
    if(_('select#jux_mm_sm_icon_position').val() == 'above') {
      css += 'flex-wrap: wrap;';
    } else {
      css += 'flex-wrap: nowrap;';
    }
    css += '}';

    //Top menu
    css +=container_id + '.meganav > li > a,' +
        container_id + '.meganav > li > .separator {';

    css +='font-weight: '+_('select#jux_mm_top_menu_font_weight').val()+';';
    css +='font-family: '+_('select#jux_mm_top_menu_font_family').val()+';';
    css +='font-style: '+_('select#jux_mm_top_menu_font_style').val()+';';
    css +='font-size: '+_('input[name="jux_mm_top_menu_font_size"]').val()+'px;';
    css +='color: '+_('input#jux_mm_top_menu_font_color').val()+';';

    var topmenuHorizontalShadow = _('input[name="jux_mm_top_menu_h_shadow"]').val(),
    topmenuVerticalShadow = _('input[name="jux_mm_top_menu_v_shadow"]').val(),
    topmenuShadowBlur = _('input[name="jux_mm_top_menu_shadow_blur"]').val(),
    topmenuShadowSize = _('input[name="jux_mm_top_menu_shadow_size"]').val(),
    topmenuShadowColor = _('input#jux_mm_top_menu_shadow_color').val(),
    topmenuShadowInset = _('input#jux_mm_top_menu_shadow_inset').is(':checked'),
    topmenuShadowType = 'ltr';
    css += calc_box_shadow(topmenuHorizontalShadow, topmenuVerticalShadow, topmenuShadowBlur, topmenuShadowSize, topmenuShadowColor, topmenuShadowInset, topmenuShadowType);

    if(_('select#jux_mm_top_menu_bg_type').val() == 'solid') {
        css += 'background:' + _('input#jux_mm_top_menu_solid_bg_color').val() + ';'
    } else {
        css += 'background: linear-gradient('+_('input#jux_mm_top_menu_bg_start_color').val()+', '+_('input#jux_mm_top_menu_bg_end_color').val()+');'
    }

    if(_('input#jux_mm_top_menu_uppercase').is(':checked')){
        css +='text-transform: uppercase;';
    }
    _('#jux-top-menu-border-position').find('input').each(function(){
        var _this = _(this);
        if(_this.is(':checked')){
            css +='border-'+ _this.val() +':'+_('input[name="jux_mm_top_menu_border_width"]').val()+'px '+_('select#jux_mm_top_menu_border_style').val()+' '+_('input#jux_mm_top_menu_border_color').val() +';';
        }
    });
    if(_('input#jux_mm_top_menu_border_position_top').is(':checked')){
        css +='padding-top: calc('+_('input[name="jux_mm_top_menu_padding_top"]').val()+'px - '+_('input[name="jux_mm_top_menu_border_width"]').val()+'px);';
    } else {
        css +='padding-top:'+_('input[name="jux_mm_top_menu_padding_top"]').val()+'px;';
    }
    if(_('input#jux_mm_top_menu_border_position_right').is(':checked')){
        css +='padding-right: calc('+_('input[name="jux_mm_top_menu_padding_right"]').val()+'px - '+_('input[name="jux_mm_top_menu_border_width"]').val()+'px);';
    } else {
        css +='padding-right:'+_('input[name="jux_mm_top_menu_padding_right"]').val()+'px;';
    }
    if(_('input#jux_mm_top_menu_border_position_bottom').is(':checked')){
        css +='padding-bottom: calc('+_('input[name="jux_mm_top_menu_padding_bottom"]').val()+'px - '+_('input[name="jux_mm_top_menu_border_width"]').val()+'px);';
    } else {
        css +='padding-bottom:'+_('input[name="jux_mm_top_menu_padding_bottom"]').val()+'px;';
    }
    if(_('input#jux_mm_top_menu_border_position_left').is(':checked')){
        css +='padding-left: calc('+_('input[name="jux_mm_top_menu_padding_left"]').val()+'px - '+_('input[name="jux_mm_top_menu_border_width"]').val()+'px);';
    } else {
        css +='padding-left:'+_('input[name="jux_mm_top_menu_padding_left"]').val()+'px;';
    }

    css += 'border-top-left-radius:'+ _('input[name="jux_mm_top_menu_radius_top_left"]').val() +'px;';
    css += '-moz-border-top-left-radius:'+ _('input[name="jux_mm_top_menu_radius_top_left"]').val() +'px;';
    css += '-o-border-top-left-radius:'+ _('input[name="jux_mm_top_menu_radius_top_left"]').val() + 'px;';
    css += 'border-top-right-radius:'+ _('input[name="jux_mm_top_menu_radius_top_right"]').val() +'px;';
    css += '-moz-border-top-right-radius:'+ _('input[name="jux_mm_top_menu_radius_top_right"]').val() +'px;';
    css += '-o-border-top-right-radius:'+ _('input[name="jux_mm_top_menu_radius_top_right"]').val() + 'px;';
    css += 'border-bottom-right-radius:'+ _('input[name="jux_mm_top_menu_radius_bottom_right"]').val() +'px;';
    css += '-moz-border-bottom-right-radius:'+ _('input[name="jux_mm_top_menu_radius_bottom_right"]').val() +'px;';
    css += '-o-border-bottom-right-radius:'+ _('input[name="jux_mm_top_menu_radius_bottom_right"]').val() + 'px;';
    css += 'border-bottom-left-radius:'+ _('input[name="jux_mm_top_menu_radius_bottom_left"]').val() +'px;';
    css += '-moz-border-bottom-left-radius:'+ _('input[name="jux_mm_top_menu_radius_bottom_left"]').val() +'px;';
    css += '-o-border-bottom-left-radius:'+ _('input[name="jux_mm_top_menu_radius_bottom_left"]').val() + 'px;';
    css += 'display: flex; flex-wrap: wrap; flex-direction: row';
    css +='}';

    css += '.rtl '+container_id + '.meganav > li > a,' +
    '.rtl '+container_id + '.meganav > li > .separator {';
    _('#jux-top-menu-border-position').find('input').each(function(){
        var _this = _(this);
        if(_this.is(':checked')){
            if(_this.val() === 'left') {
                css +='border-right:'+_('input[name="jux_mm_top_menu_border_width"]').val()+'px '+_('select#jux_mm_top_menu_border_style').val()+' '+_('input#jux_mm_top_menu_border_color').val() +';';
            } else if(_this.val() === 'right') {
                css +='border-left:'+_('input[name="jux_mm_top_menu_border_width"]').val()+'px '+_('select#jux_mm_top_menu_border_style').val()+' '+_('input#jux_mm_top_menu_border_color').val() +';';
            } else {
                css +='border-'+ _this.val() +':'+_('input[name="jux_mm_top_menu_border_width"]').val()+'px '+_('select#jux_mm_top_menu_border_style').val()+' '+_('input#jux_mm_top_menu_border_color').val() +';';
            }
        } else {
            if(_this.val() !== 'left' && _this.val() !== 'right') {
                css +='border-'+ _this.val() +':none;';
            } else {
                if(_this.val() == 'left') {
                    css +='border-right:none;';
                }

                if(_this.val() == 'right') {
                    css +='border-left:none;';
                }
            }

        }
    });
    var topmenuShadowType = 'rtl';
    css += calc_box_shadow(topmenuHorizontalShadow, topmenuVerticalShadow, topmenuShadowBlur, topmenuShadowSize, topmenuShadowColor, topmenuShadowInset, topmenuShadowType);
    css += '}';

    css +=container_id + ' .vertical .meganav > li > a,' +
        container_id + ' .vertical .meganav > li > .separator {';
    css += 'display: block;';
    css += '}';
    css +=container_id + '.meganav > li:first-child > a,' +
        container_id + '.meganav > li:first-child > .separator {';
    if(_('input[name="jux_mm_menu_bar_radius_top_left"]').val() !== '0' && _('input[name="jux_mm_top_menu_radius_top_left"]').val() === '0') {
        css += 'border-top-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_left"]').val() +'px;';
        css += '-webkit-border-top-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_left"]').val() +'px;';
        css += '-moz-border-top-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_left"]').val() +'px;';
        css += '-o-border-top-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_top_left"]').val() + 'px;';
    }
    if(_('input[name="jux_mm_menu_bar_radius_bottom_left"]').val() !== '0' && _('input[name="jux_mm_top_menu_radius_bottom_left"]').val() === '0') {
        css += 'border-bottom-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_left"]').val() +'px;';
        css += '-webkit-border-bottom-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_left"]').val() +'px;';
        css += '-moz-border-bottom-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_left"]').val() +'px;';
        css += '-o-border-bottom-left-radius:'+ _('input[name="jux_mm_menu_bar_radius_bottom_left"]').val() + 'px;';
    }
    css += '}';

    css +=container_id + '.meganav > li {';
    css +='margin:'+_('input[name="jux_mm_top_menu_margin_top"]').val()+'px '+_('input[name="jux_mm_top_menu_margin_right"]').val()+'px '+_('input[name="jux_mm_top_menu_margin_bottom"]').val()+'px '+_('input[name="jux_mm_top_menu_margin_left"]').val()+'px;';
    css += '}';

    css +=container_id + '.meganav > li > a .jux-icon{';
    css +='color: '+_('input#jux_mm_top_menu_icon_color').val()+';';
    css +='font-size: '+_('input[name="jux_mm_top_menu_icon_size"]').val()+'px;';
    css +='}';

    css +=container_id + '.meganav > li > a .mega-caption, '+ container_id + '.meganav > li > .separator .mega-caption{';
    css +='color: '+_('input#jux_mm_top_menu_caption_color').val()+';';
    css +='font-size: '+_('input[name="jux_mm_top_menu_caption_size"]').val()+'px;';
    css +='}';

    css += container_id +' .jux-toggle-icon,';
    css += container_id +' .navbar-brand{';
    css +='color: '+_('input#jux_mm_top_menu_font_color').val()+';';
    css +='}';

    //top menu hover
    css +=container_id + '.meganav > li:hover > a,'+
        container_id  + '.meganav > li.open > a,'+
        container_id  + '.meganav > li:hover > .separator,'+
        container_id  + '.meganav > li.open > .separator {';

    _('#jux-top-menu-border-position').find('input').each(function(){
        var _this = _(this);
        if(_this.is(':checked')){
            css +='border-'+ _this.val() +'-color:' +_('input#jux_mm_tm_hvr_border_color').val() +';';
        }
    });

    css +='color: '+_('input#jux_mm_tm_hvr_txt_color').val()+';';
    if(_('select#jux_mm_top_menu_bg_type').val() == 'solid') {
        css += 'background:'+ _('input#jux_mm_tm_hvr_solid_bg_color').val()+';'
    } else {
        css += 'background-color: '+ _('input#jux_mm_tm_hvr_bg_start_color').val() + ';';
        var linearDirection = 'to bottom';
        if(_('select#jux_ez_mm_orientation').val() == 'vertical') {
          linearDirection = 'to right';
          if(_('input#jux_easy_mm_rtl').is(':checked')) {
            linearDirection = 'to left';
          }
        }
        css += 'background: linear-gradient('+ linearDirection + ', '+_('input#jux_mm_tm_hvr_bg_start_color').val()+', '+_('input#jux_mm_tm_hvr_bg_end_color').val()+');'
    }
    css +='}';

    css +=container_id + '.meganav > li:hover > a .mega-caption,'+
        container_id  + '.meganav > li.open > a .mega-caption,'+
        container_id  + '.meganav > li:hover > .separator .mega-caption,'+
        container_id  + '.meganav > li.open > .separator .mega-caption {';
    css += 'color: '+_('#jux_mm_tm_hvr_caption_color').val()+ ';';
    css +='}';

    css +=container_id + '.meganav > li:hover > a .jux-icon,'+container_id  + '.meganav > li.open > a .jux-icon,'+container_id + '.meganav > .current-menu-item > a .jux-icon,'+container_id + ' .meganav > .current-menu-ancestor > a .jux-icon,'+container_id + ' .meganav > .current_page_item > a .jux-icon,'+container_id + ' .meganav > .current_page_ancestor > a .jux-icon{';
    css +='color: '+_('input#jux_mm_tm_hvr_icon_color').val()+';';
    css +='}';
    //sub menu
    css +=container_id +'.jux-easy-megamenu .jux-dropdown-menu,'+container_id +'.jux-easy-megamenu .dropdown-submenu > .jux-dropdown-menu{';

    css += 'border-top-left-radius:'+ _('input[name="jux_mm_sm_radius_top_left"]').val() +'px;';
    css += '-moz-border-top-left-radius:'+ _('input[name="jux_mm_sm_radius_top_left"]').val() +'px;';
    css += '-o-border-top-left-radius:'+ _('input[name="jux_mm_sm_radius_top_left"]').val() + 'px;';
    css += 'border-top-right-radius:'+ _('input[name="jux_mm_sm_radius_top_right"]').val() +'px;';
    css += '-moz-border-top-right-radius:'+ _('input[name="jux_mm_sm_radius_top_right"]').val() +'px;';
    css += '-o-border-top-right-radius:'+ _('input[name="jux_mm_sm_radius_top_right"]').val() + 'px;';
    css += 'border-bottom-right-radius:'+ _('input[name="jux_mm_sm_radius_bottom_right"]').val() +'px;';
    css += '-moz-border-bottom-right-radius:'+ _('input[name="jux_mm_sm_radius_bottom_right"]').val() +'px;';
    css += '-o-border-bottom-right-radius:'+ _('input[name="jux_mm_sm_radius_bottom_right"]').val() + 'px;';
    css += 'border-bottom-left-radius:'+ _('input[name="jux_mm_sm_radius_bottom_left"]').val() +'px;';
    css += '-moz-border-bottom-left-radius:'+ _('input[name="jux_mm_sm_radius_bottom_left"]').val() +'px;';
    css += '-o-border-bottom-left-radius:'+ _('input[name="jux_mm_sm_radius_bottom_left"]').val() + 'px;';

    css += 'background:'+ _('input#jux_mm_sm_solid_bg_color').val()+';'

    _('#jux-sm-border-position').find('input').each(function(){
        var _this = _(this);
        if(_this.is(':checked')){
            css +='border-'+ _this.val() +':'+_('input[name="jux_mm_sm_border_width"]').val()+'px '+_('select#jux_mm_sm_border_style').val()+' '+_('input#jux_mm_sm_border_color').val() +';';
        }
    });

    var submenuHorizontalShadow = _('input[name="jux_mm_sm_h_shadow"]').val(),
    submenuVerticalShadow = _('input[name="jux_mm_sm_v_shadow"]').val(),
    submenuShadowBlur = _('input[name="jux_mm_sm_shadow_blur"]').val(),
    submenuShadowSize = _('input[name="jux_mm_sm_shadow_size"]').val(),
    submenuShadowColor = _('input#jux_mm_sm_shadow_color').val(),
    submenuShadowInset = _('input#jux_mm_sm_shadow_inset').is(':checked'),
    submenuShadowType = 'ltr';
    css += calc_box_shadow(submenuHorizontalShadow, submenuVerticalShadow, submenuShadowBlur, submenuShadowSize, submenuShadowColor, submenuShadowInset, submenuShadowType);

    //css += calc_box_shadow(_('input[name="jux_mm_sm_h_shadow"]').val(), _('input[name="jux_mm_sm_v_shadow"]').val(), _('input[name="jux_mm_sm_shadow_blur"]').val(), _('input[name="jux_mm_sm_shadow_size"]').val(), _('input#jux_mm_sm_shadow_color').val(), _('input#jux_mm_sm_shadow_inset').is(':checked') );
    css +='padding: '+_('input[name="jux_mm_sm_padding_top"]').val()+'px '+_('input[name="jux_mm_sm_padding_right"]').val()+'px '+_('input[name="jux_mm_sm_padding_bottom"]').val()+'px '+_('input[name="jux_mm_sm_padding_left"]').val()+'px;';

    css +='}';

    css += container_id + '.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li > a,';
    css += container_id + '.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li > .separator{';    
    css +='font-weight: '+_('select#jux_mm_sm_font_weight').val()+';';
    css +='font-family: '+_('select#jux_mm_sm_font_family').val()+';';
    css +='font-style: '+_('select#jux_mm_sm_font_style').val()+';';
    css +='font-size: '+_('input[name="jux_mm_sm_font_size"]').val()+'px;';
    css +='color: '+_('input#jux_mm_sm_font_color').val()+';';
    if(_('input#jux_mm_sm_uppercase').is(':checked')){
        css +='text-transform: uppercase;';
    }
    css +='padding: '+_('input[name="jux_mm_sm_item_padding_top"]').val()+'px '+_('input[name="jux_mm_sm_item_padding_right"]').val()+'px '+_('input[name="jux_mm_sm_item_padding_bottom"]').val()+'px '+_('input[name="jux_mm_sm_item_padding_left"]').val()+'px;';
    _('#jux-sm-item-border-position').find('input').each(function(){
        var _this = _(this);
        if(_this.is(':checked')){
            css +='border-'+ _this.val() +':'+_('input[name="jux_mm_sm_item_border_width"]').val()+'px '+_('select#jux_mm_sm_item_border_style').val()+' '+_('input#jux_mm_sm_item_border_color').val() +';';
        }
    });
    css += '}';

    css += '#jux-ez-menu-item-options ' +container_id + '.jux-easy-megamenu .module-block {';
    css +='color: '+_('input#jux_mm_sm_font_color').val()+';';
    css +='border-color: '+_('input#jux_mm_sm_font_color').val()+';';
    css += '}';

    css += container_id + '.jux-easy-megamenu .jux-nav-child .moduletable, ';
    css += container_id + '.jux-easy-megamenu .jux-nav-child .moduletable a {';
    css +='font-family: '+_('select#jux_mm_sm_font_family').val()+';';
    css +='font-style: '+_('select#jux_mm_sm_font_style').val()+';';
    css +='font-size: '+_('input[name="jux_mm_sm_font_size"]').val()+'px;';
    css +='color: '+_('input#jux_mm_sm_font_color').val()+';';
    if(_('input#jux_mm_sm_uppercase').is(':checked')){
        css +='text-transform: uppercase;';
    }
    css += '}';
    css += container_id + '.jux-easy-megamenu .jux-nav-child .moduletable a:hover {';
    css +='font-size: '+_('input[name="jux_mm_sm_font_size"]').val()+'px;';
    css +='color: '+_('input#jux_mm_sm_hvr_txt_color').val()+';';
    css += '}';
    css +=container_id + '.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li > a .jux-icon, ' + container_id + '.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li > .separator .jux-icon{';
    css +='color: '+_('input#jux_mm_sm_icon_color').val()+';';
    css +='font-size: '+_('input[name="jux_mm_sm_icon_size"]').val()+'px;';
    css +='}';

    css +=container_id + '.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li > a .mega-caption, ' + container_id + '.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li > .separator .mega-caption{';
    css +='color: '+_('input#jux_mm_sm_caption_color').val()+';';
    css +='font-size: '+_('input[name="jux_mm_sm_caption_size"]').val()+'px;';
    css +='}';

    //sub menu hover
    css += container_id +'.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li:hover > a:not(.mega-group-title),' +
    container_id +'.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li:hover > .separator:not(.mega-group-title),';
    css += container_id +'.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li > a:not(.mega-group-title):focus,' +
    container_id +'.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li > .separator:not(.mega-group-title):focus {';

    _('#jux-sm-item-border-position').find('input').each(function(){
        var _this = _(this);
        if(_this.is(':checked')){
            css +='border-'+ _this.val() +'-color:' +_('input#jux_mm_sm_hvr_border_color').val() +';';
        }
    });

    css +='color: '+_('input#jux_mm_sm_hvr_txt_color').val()+';';
    css += 'background:'+ _('input#jux_mm_sm_hvr_solid_bg_color').val()+';';
    css += 'background-image: none';
    css += '}';

    css += container_id +'.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li:hover > a .jux-icon, ' + container_id +'.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li:hover > .separator .jux-icon{';
    css +='color: '+_('input#jux_mm_sm_hvr_icon_color').val()+';';
    css +='}';

    css += container_id +'.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li:hover > a .mega-caption, ' + container_id +'.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li:hover > .separator .mega-caption{';
    css +='color: '+_('input#jux_mm_sm_hvr_caption_color').val()+';';
    css +='}';

    css += container_id +'.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li:hover > a .mega-cation, ' + container_id +'.jux-easy-megamenu .jux-dropdown-menu .mega-nav > li:hover > .separator .mega-cation{';
    css +='color: '+_('input#jux_mm_sm_hvr_caption_color').val()+';';
    css +='}';


    css += '@media (max-width: ' + breakpoint_max + 'px) {'+
            container_id +' .meganav > li.jux-mega > a:after{' +
            'border-color:'+_('input#jux_mm_top_menu_font_color').val()+ ';' +
            '}'+
            container_id + ' .meganav li {float: none;}' +
            container_id + ' {/*overflow: hidden;max-height: 0;*/display: none;width: 100% !important;transition: max-height 0.2s ease-out;-moz-transition: max-height 0.2s ease-out; -webkit-transition:  max-height 0.2s ease-out; -o-transition:  max-height 0.2s ease-out}' +
            container_id + ' .meganav .jux-dropdown-menu {' +
                'position: static;' +
                'display: none;' +
                'float: none;' +
                'box-shadow: none;' +
            '}' +
            container_id + ' .meganav .mega-col-nav {width: 100%;}' +
            container_id + ' .meganav .mega-col-nav.hidden-collapse {display: none;}' +
        container_id + ' .meganav.jux-nav {display: none;}' +
        container_id + ' .meganav.jux-nav-mobile {display: block;}' +
        container_id + ' .meganav.jux-nav-mobile li.dropdown.active > a {';
    if(_('select#jux_mm_top_menu_bg_type').val() == 'solid') {
        css += 'background:' + _('input#jux_mm_tm_hvr_solid_bg_color').val() + ';'
    } else {
        css += 'background: linear-gradient('+_('input#jux_mm_tm_hvr_bg_start_color').val()+', '+_('input#jux_mm_tm_hvr_bg_end_color').val()+');'
    }
    css += 'color: '+_('input#jux_mm_tm_hvr_txt_color').val()+'; background-color: '+_('input#jux_mm_tm_hvr_solid_bg_color').val();
    css += ';'
    css += '}' +
        container_id + ' .meganav.jux-nav-mobile li.dropdown.active > a > .jux-icon {color: '+_('#jux_mm_tm_hvr_icon_color').val()+' }' +

        button_toggle_id + ' {display: block;}' +
       /*  container_id + ' .mobile-caret {width: 20px;height: 20px;border-radius: 3px;background: '+_('#jux_mm_top_menu_font_color').val()+';justify-content: center;display: flex;align-items: center;font-size: 14px;position: absolute;top: 50%;transform: translateY(-50%);z-index: 20;font-style: normal}' +
        container_id + ' .mobile-caret::before {content: "+";color: '+_('#jux_mm_top_menu_solid_bg_color').val()+';font-weight: bold;float: right;position: absolute;z-index: 1999;display: block;font-size: 14px;}' +
        container_id + ' .meganav > li.dropdown:hover > a > .mobile-caret, '+container_id + ' .meganav > li.dropdown.active > a > .mobile-caret {background-color: '+ _('#jux_mm_tm_hvr_txt_color').val() +';}' +
        container_id + ' .meganav > li.dropdown:hover > a > .mobile-caret::before, '+ container_id + ' .meganav > li.dropdown.active > a > .mobile-caret::before {color: '+_('#jux_mm_tm_hvr_solid_bg_color').val()+'}' +
        container + '.jux-align-left .mobile-caret {right: '+_('input[name="jux_mm_top_menu_padding_right"]').val()+'px; left: auto;}' +
        container + '.jux-align-right .mobile-caret {left: '+_('input[name="jux_mm_top_menu_padding_left"]').val()+'px; right: auto}' +
        container + '.jux-align-center .mobile-caret {right: '+_('input[name="jux_mm_top_menu_padding_right"]').val()+'px; left: auto}' +
        container_id + ' li.dropdown-submenu:hover > a > .mobile-caret, '+
        container_id + ' li.dropdown-submenu.active > a > .mobile-caret {background-color: '+ _('#jux_mm_sm_hvr_txt_color').val() +';}' + */
        container_id + ' .jux-easy-megamenu .meganav .jux-dropdown-menu li.active > a {background: '+ _('#jux_mm_sm_hvr_solid_bg_color').val() +'; color:'+_('#jux_mm_sm_hvr_txt_color').val()+'}' +
        container_id + ' .jux-easy-megamenu .meganav .jux-dropdown-menu li.active > a > .jux-icon {color:'+_('#jux_mm_sm_hvr_icon_color').val()+'}';
        /* container_id + ' li.dropdown-submenu:hover > a > .mobile-caret::before, '+container_id + ' li.dropdown-submenu.active > a > .mobile-caret::before {color: '+_('#jux_mm_sm_hvr_solid_bg_color').val()+'}' +
        container + ' .mega-nav li.dropdown-submenu .mobile-caret {right: '+_('input[name="jux_mm_sm_item_padding_right"]').val()+'px; left: auto;}' +
        container_id + ' .jux-nav-child .mobile-caret {background-color: '+_('input#jux_mm_sm_font_color').val()+'}' +
        container_id + ' .jux-nav-child .mobile-caret::before {color: '+_('input#jux_mm_sm_solid_bg_color').val()+'}';

        container_id + ' .jux-dropdown-menu li:hover > a >.mobile-caret,' +
        container_id + ' .jux-dropdown-menu li.active > a >.mobile-caret,' +
        container_id + ' .jux-dropdown-menu li > a:hover > .mobile-caret,' +
        container_id + ' .jux-dropdown-menu li:hover > .separator >.mobile-caret,' +
        container_id + ' .jux-dropdown-menu li.active > .separator >.mobile-caret,' +
        container_id + ' .jux-dropdown-menu li > .separator:hover > .mobile-caret {background-color: '+_('input#jux_mm_sm_hvr_txt_color').val()+'}'; */
    css +=container_id + '.meganav > li:first-child > a,' +
        container_id + '.meganav > li:first-child > .separator { border-radius: 0;}';
    css +=container_id +'.jux-easy-megamenu .jux-dropdown-menu,'+
        container_id +'.jux-easy-megamenu .dropdown-submenu > .jux-dropdown-menu{ border-radius: 0;}';
    css +=container_id + '.meganav > li > a,' +
        container_id + '.meganav > li > .separator {display: block}';
    css += container_id + ' .meganav.jux-nav-mobile li.dropdown.active > a .jux-icon{';
    css += 'color: '+_('input#jux_mm_tm_hvr_icon_color').val()+';';
    css += '}';
    css += container + '.jux-toggle-without-btn { display: block }';
    css += '}';

    css += '/*=================== CUSTOM CSS ==================*/';
    css += _('textarea#jux_mm_adv_custom_css').val();

    if( isLive ) {
        _("#jux-ez-menu-custom-css").remove();
        _('<style id="jux-ez-menu-custom-css" type="text/css">'+css+'</style>').appendTo('head');
    }


    return css;
}
