#{$wrap} {

    #{$menu} li.mega-bp-profile-nav img.avatar,
	#{$menu} img.mmm_gravatar {
		vertical-align: middle;
		position: relative;
		top: -1px;
		display: inline-block;
		max-height: 100%;

		@include mobile {
			max-height: 90%;
			width: auto;
		}
	}

	#{$menu} img.avatar {
		vertical-align: middle;
		position: relative;
		top: -1px;
	}

	#{$menu}.mega-menu-vertical,
	#{$menu}.mega-menu-accordion {

		@each $item in $replacements_search {

			$id: nth($item, 1);
			$search_height: nth($item, 2);
			$search_text_color: nth($item, 3);
			$search_icon_color_closed: nth($item, 4);
			$search_icon_color_open: nth($item, 5);
			$search_background_color_closed: nth($item, 6);
			$search_background_color_open: nth($item, 7);
			$search_border_radius: nth($item, 8);
			$search_vertical_offset: nth($item, 9);
			$search_width: nth($item, 10);

		  	@if type-of($id) == number {

			  	li#mega-menu-item-#{$id} {

			  		@include desktop {
				  		.mega-search-wrap.mega-static {
				  			padding: $menu_item_link_padding_top $menu_item_link_padding_right $menu_item_link_padding_bottom $menu_item_link_padding_left;
					  	}

				  		.mega-search-wrap .expand-to-right {
				  			padding: $menu_item_link_padding_top $menu_item_link_padding_right $menu_item_link_padding_bottom $menu_item_link_padding_left;
				  		}
			  		}
			  	}
			}
		}
	}


	// remove highlight/hover effect from logo
	> li.mega-menu-item.mega-current-menu-item > a.mega-menu-logo,
	> li.mega-menu-item.mega-current-menu-ancestor > a.mega-menu-logo {
		background: inherit;
	}

	li.mega-menu-item img.mega-menu-logo {
	    display: inline;
	    vertical-align: middle;
	    max-height: none;

	    @include mobile {
	    	max-height: 90%;
	    	width: auto;
	    }
	}

	@include mobile {
		#{$menu}[data-effect-mobile^="slide_"] li.mega-menu-item a.mega-menu-link.mega-menu-logo {
			padding-top: 10px;
			padding-bottom: 10px;
	        text-align: center;
	        justify-content: center;
	        height: auto;
	    }
	}

	@each $item in $replacements_search {
		$id: nth($item, 1);
		$search_height: nth($item, 2);
		$search_text_color: nth($item, 3);
		$search_icon_color_closed: nth($item, 4);
		$search_icon_color_open: nth($item, 5);
		$search_background_color_closed: nth($item, 6);
		$search_background_color_open: nth($item, 7);
		$search_border_radius: nth($item, 8);
		$search_vertical_offset: nth($item, 9);
		$search_width: nth($item, 10);
		$search_custom_icon_enabled: nth($item, 11);
		$search_custom_icon_url: nth($item, 12);
		$search_custom_icon_url_hover: nth($item, 13);
		$search_custom_icon_width: nth($item, 14);
		$search_custom_icon_height: nth($item, 15);
		$search_custom_icon_size: nth($item, 16);
		$search_custom_icon_is_fa5: nth($item, 17);
		$search_custom_icon_fa5_family: nth($item, 18);
		$search_custom_icon_is_fa6: nth($item, 19);

	  	@if type-of($id) == number {

	        @if $sticky_menu_height == on {
		        @include desktop {
		             &.mega-stuck #{$menu} > li#mega-menu-item-#{$id} {
		             	line-height: $sticky_menu_item_link_height;

		                @if $sticky_menu_transition == on {
		                    -webkit-transition: all .25s ease-in-out;
		                    -moz-transition: all .25s ease-in-out;
		                    -o-transition: all .25s ease-in-out;
		                    transition: all .25s ease-in-out;               
		                }
		             }
	            }
	        }

			#{$menu} {
			  	li#mega-menu-item-#{$id} {
                    border-left: 0;
                    box-shadow: none;
                    align-content: center;

			  		.mega-search-wrap {
			  			position: relative;
			  			width: $search_height; // square icon
			  			height: $search_height;
  						display: flex;
  						z-index: 99999;
  						margin-top: $search_vertical_offset;
  						align-items: center;

  						@include desktop {
					  		&.mega-static {
		                    	width: $search_width;
		                    }
	                    }

			  			@include mobile {
			  				width: 100%;
			  				margin: 5px 0;
			  			}

			  		}

					.mega-search {

						@include mobile {
							width: 100%;
							padding: 0 5px;
						}

						@include desktop {
							&.expand-to-left {
								position: absolute;
								right: 0;
							}

							&.expand-to-right {
								position: absolute;
								right: auto;
								left: 0;
							}
						}

						&.mega-search-open {
							input[type=text] {
								background-color: $search_background_color_open;
							}

							.search-icon:before {
								color: $search_icon_color_open;
							}

							@if $search_custom_icon_enabled == true {
								.search-icon {
	                            	background-image: url($search_custom_icon_url_hover);
								}
							}
						}

						&.mega-search-closed input[type=text] {
							width: $search_height;
							padding: 0;

							@include mobile {
								width: 100%;
								padding: 5px;
							}
						}

						input[type=text] {
							color: $search_text_color;
							background-color: $search_background_color_closed;
							width: $search_width;
							margin: 0;
							padding: 0 $search_height 0 5px;
							height: $search_height;
							border: 0;
							transition: width 0.6s, background-color 0.6s, color 1s;
							box-sizing: border-box;
							border-radius: $search_border_radius;

							@include mobile {
								width: 100%;
								background-color: $search_background_color_open;
							}
						}

						input:focus {
							outline: none;
						}

						input[type=submit] {
							display: none;
						}

						.search-icon {
							@include mobile {
								right: 5px;
							}

							right: 0;
							top: 0;
							position: absolute;
							cursor: pointer;
							height: 100%;
							width: $search_height;

							@if $search_custom_icon_enabled == true {
	                            background-image: url($search_custom_icon_url);
	                            background-size: $search_custom_icon_width $search_custom_icon_height;
                            	background-repeat: no-repeat;
                            	background-position: center center;
							}

							@if $search_custom_icon_is_fa5 == true {
								&.fab:before {
									font-family: 'Font Awesome 5 Brands';
									font-weight: 400;
								}

								&.far:before {
									font-family: $search_custom_icon_fa5_family;
									font-weight: 400;
								}
								&.fas:before {
									font-family: $search_custom_icon_fa5_family;
									font-weight: 900;
								}

								&.fal:before {
									font-family: $search_custom_icon_fa5_family;
									font-weight: 300;
								}
							}

							@if $search_custom_icon_is_fa6 == true {
								&.far:before,
								&.fa-regular:before {
								    font: var(--fa-font-regular);
								}
								&.fas:before,
								&.fa-solid:before {
								    font: var(--fa-font-solid);
								}
								&.fal:before,
								&.fa-light:before {
								    font: var(--fa-font-light);
								}
								&.fa-kit:before {
								    font-family: "Font Awesome Kit";
								}
								&.fab:before {
								    font: var(--fa-font-brands);
								}
								&.far:before,
								&.fa-regular:before,
								&.fas:before,
								&.fa-solid:before,
								&.fal:before,
								&.fa-light:before,
								&.fa-kit:before,
								&.fab:before {
								    line-height: $search_height;

									@if $search_custom_icon_size != inherit {
										font-size: $search_custom_icon_size;
									}
								}
							}

							&:before {
								display: flex;
								justify-content: center;
								align-items: center;
								color: $search_icon_color_closed;
								height: 100%;

								@if $search_custom_icon_size != inherit {
									font-size: $search_custom_icon_size;
								}

								@include mobile {
									color: $search_icon_color_open;
								}
							}
						}

						&.expand-to-right {
						    .search-icon {
							    right: auto;
							}
							input[type=text] {
								padding: 0 5px 0 $search_height;
							}
						}
					}
				}
			}
		}
	}
}