/* -------------------------------------------
	Menu
		1. Default Menu Styles
		2. Horizontal Menu
		3. Underline Hover Style
		4. Mega Menu
		5. Tip
		6. Mobile Menu
		7. Menu LazyLoad
 ------------------------------------------- */

// 1. Default Menu Styles
:root {
	--alpha-menu-has-children-arrow: 2rem;
	--alpha-dropdown-triangle-pos: calc(100% - 22px);
}

.menu {
	--alpha-menu-prefix-icon-size: 17px;
	--alpha-menu-prefix-icon-spacing: 7px;

	.header & {
		display: flex;
		align-items: center;
	}

	ul {
		padding: 2.1rem 0;
		background: var(--alpha-change-color-light-1);
	}

	li {
		position: relative;

		>a {
			transition: color .3s, background .3s, border .3s;
		}

		a {
			display: inline-block;
			padding: .65rem 1rem;
			white-space: nowrap;
		}

		>ul {
			position: absolute;
			top: -9999px;
			#{$left}: 100%;
			min-width: 22rem;
			margin: 0;
			box-shadow: 0 0 32px rgb(0, 0, 0, .08);
			z-index: 1002;
			background-color: var(--alpha-change-color-light-1);
			visibility: hidden;
			opacity: 0;
			transition: transform .3s, opacity .3s;
			transform: translate3d(0, -10px, 0);

			li {
				padding: 0 2.5rem;
			}
		}
	}

	.menu-item>a i,
	.menu-item>a svg {
		display: inline-block;
		position: relative;
		top: -1px;
		margin-#{$right}: var(--alpha-menu-prefix-icon-spacing);
		line-height: 0;
		font-size: var(--alpha-menu-prefix-icon-size);
		vertical-align: middle;
	}

	.menu-item>a svg {
		width: var(--alpha-menu-prefix-icon-size);
		height: var(--alpha-menu-prefix-icon-size);
		transition: stroke .3s, fill .3s;
	}

	li:hover,
	.show {
		>ul {
			visibility: visible;
			opacity: 1;
			top: -2rem;
			transform: translate3d(0, 0, 0);
		}
	}

	>li {

		>a {
			display: flex;
			align-items: center;
			position: relative;

			&::after {
				margin-#{$left}: .7rem;
			}
		}

		>ul {
			#{$left}: -1rem;
		}

		&:hover,
		&.show {
			>ul {
				top: 100%;
			}

			&::after {
				visibility: visible;
				opacity: 1;
				top: calc(100% - 20px);
				transform: translate3d(-50%, 0, 0);
			}

			nav &>a {
				color: var(--alpha-primary-color);

				>svg {
					stroke: var(--alpha-primary-color);
					fill: var(--alpha-primary-color);
				}
			}
		}
	}

	.menu-item-has-children {
		>a {
			display: block;
			position: relative;
		}
	}

	>.menu-item-has-children {
		>a {
			&::after {
				content: '\f078';
				position: relative;
				#{$right}: auto;
				vertical-align: 1px;
			}
		}
	}

	ul .menu-item:hover>a:not(.nolink) {
		color: var(--alpha-primary-color);
	}
}

.menu-item-has-children {
	>a {
		&::after {
			display: inline-block;
			position: absolute;
			#{$right}: 1rem;
			top: 50%;
			line-height: 0;
			vertical-align: middle;
			font-family: 'Font Awesome 5 Free';
			font-weight: 700;
			font-size: .7em;
			color: inherit;
			transform: translateY(-50%);
			content: if-ltr('\f054', '\f053');
		}
	}
}

nav .menu,
.dropdown-menu,
.toggle-menu {
	display: inline-block;
}

// 2. Horizontal Menu
.horizontal-menu {
	&.menu {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
	}
}

// 3. Underline Hover Style
.menu-active-underline {
	>li {
		>a {
			&::before {
				content: '';
				display: block;
				position: absolute;
				bottom: 0;
				left: 0;
				width: 100%;
				border-bottom: 2px solid;
				transform-origin: right center;
				transform: scale(0, 1);
				transition: transform .3s;
			}
		}

		&.current-menu-ancestor>a,
		&.current-menu-item>a,
		>a:hover,
		&:hover>a {
			color: inherit;

			&::before {
				transform-origin: left center;
				transform: scale(1, 1);
			}
		}

		&.current-menu-item~.current-menu-item>a:before {
			transform-origin: right center;
			transform: scale(0, 1);
		}
	}
}

// 4. Mega Menu
.menu .megamenu {
	display: flex;
	padding: 1rem;
	background: var(--alpha-change-color-light-1);
	max-width: calc(100vw - 4 * var(--alpha-gap));

	a {
		white-space: normal;
	}

	li {
		background-size: cover;
		padding: 0;
	}

	>li {
		flex: 1;
		max-width: 100%;
		padding: 1rem 1.5rem;

		>a::after {
			content: none;
		}

		>ul+a {
			margin-top: 1rem;
		}
	}

	>li.menu-item>a.menu-item {
		position: relative;
		font-size: 1em;
		font-weight: 600;
		color: var(--alpha-change-color-dark-1);
	}

	ul {
		position: static;
		min-width: 0;
		padding: 0;
		box-shadow: none;
		opacity: 1;
		visibility: visible;
		transform: none;
	}

	&.mp-left {
		#{$left}: -1.5rem;
		#{$right}: auto;
	}

	&.mp-right {
		#{$left}: auto;
		#{$right}: -1.5rem;
	}

	&.mp-center {
		#{$right}: auto;
	}
}

.menu:not(.collapsible-menu) .megamenu.full-megamenu {
	width: calc(var(--alpha-container-width, 1290px) - 4 * var(--alpha-gap));
}

// 5. Tip
.tip {
	display: inline-block;
	position: relative;
	top: -1px;
	#{$left}: 8px;
	border-radius: 2px;
	padding: 4px 6.5px;
	font-size: 10px;
	font-weight: 600;
	line-height: 1;
	color: var(--alpha-white-color);
	text-transform: uppercase;

	&.tip-hot {
		color: var(--alpha-secondary-color);
	}

	&.tip-new {
		color: var(--alpha-primary-color);
	}
}

// 6. Mobile Menu

// Toggle Button
.toggle-btn {

	&,
	.menu &,
	.mobile-menu & {
		display: flex;
		align-items: center;
		position: absolute;
		padding: 6px;
		#{$right}: 0;
		top: 0;
		bottom: 0;
		opacity: .6;
		cursor: pointer;
	}

	&::before {
		display: block;
		font-size: 1rem;
		font-weight: 600;
		line-height: 1;
		transition: transform .5s;
	}

	.menu &::before,
	.mobile-menu &::before {
		font-family: 'Font Awesome 5 Free';
		content: if-ltr('\f054', '\f053');
		position: static;
		border: none;
		width: auto;
	}

	.menu &,
	.mobile-menu & {
		width: auto;
	}

	.menu &::after,
	.mobile-menu &::after {
		content: none;
	}
}

.show>.toggle-btn::before,
.show>a .toggle-btn::before {
	transform: rotate(if-ltr(270deg, 450deg));
}

// Mobile Menu Wrapper
.mobile-menu-wrapper {
	visibility: hidden;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9999;
	transition: visibility .4s;

	.loading1::before,
	.loading1::after,
	.loading2::before,
	.loading2::after {
		background: var(--alpha-change-color-light-1);
	}

	.loading1::before {
		box-shadow: inset 0 0 0 2px var(--alpha-change-color-light-1);
	}
}

// Mobile Menu Container
.mobile-menu-container {
	position: relative;
	max-width: var(--alpha-mmenu-width);
	padding: 2rem 1.5rem;
	width: 100%;
	height: 100%;
	overflow-y: auto;
	background: #222;
	box-shadow: 1px 0 5px rgba(0, 0, 0, .5);
	margin-#{$left}: calc(-1 * var(--alpha-mmenu-width));
	transition: margin .4s;

	.mmenu-from-end & {
		margin-#{$left}: auto;
		margin-#{$right}: calc(-1 * var(--alpha-mmenu-width));
	}

	.d-loading:before {
		background: transparent;
	}

	.hs-simple .input-wrapper {
		display: flex;
		margin-bottom: .6rem;
		border: none;

		.form-control {
			color: $border-color;
			padding: 1.4rem 1.9rem;
			border: none;
			border-radius: corner-values(var(--alpha-corner-sm) 0 0 var(--alpha-corner-sm));
		}

		.btn-search {
			color: var(--alpha-white-color);
			border-radius: corner-values(0 var(--alpha-corner-sm) var(--alpha-corner-sm) 0);
		}

		.form-control,
		.btn-search {
			background-color: rgba(255, 255, 255, .05);
		}

		.btn-search {
			padding: 0;
			border: 0;
		}

		i {
			vertical-align: initial;
			margin: 0;
			font-size: inherit;
		}
	}

	.mobile-menu {
		margin-bottom: .5rem;

		.menu-item>a>i {
			min-width: 20px;
			text-align: center;
			font-size: 18px;
			margin-#{$right}: 1rem;
			vertical-align: -3px;

			@include if-rtl() {
				float: right;
			}
		}
	}

	.tab {
		margin-top: 2.5rem;
	}

	.tab-pane {
		padding: 1rem 0 0;
	}

	.nav {
		border-bottom: 2px solid var(--alpha-change-border-color-light);
	}

	.nav-wrapper {
		overflow: hidden;
	}

	.nav-link {
		margin-bottom: -2px;
		padding: 10px;
		font-size: 13px;
		color: var(--alpha-change-color-light-1);
		border-bottom: 2px solid transparent;
	}

	.nav-item:hover .nav-link {
		color: var(--alpha-change-color-light-1);
		border-color: transparent;
	}

	.nav-item.show .nav-link,
	.nav-item .nav-link.active {
		color: var(--alpha-primary-color);
		border-color: var(--alpha-primary-color);
	}

	.nav-item+.nav-item {
		margin-#{$left}: 1px;
	}

	.nav-item {
		margin-bottom: 0;
	}
}

.alpha-adminbar .mobile-menu-container {
	padding-top: calc(var(--wp-admin--admin-bar--height) + 2rem);
}

.elementor-widget-#{$theme_name}_header_mmenu_toggle .elementor-widget-container {
	position: relative;
}

// Mobile Menu
.mobile-menu {
	--alpha-menu-has-children-arrow: 1rem;
	color: #e1e1e1;
	font-size: 11px;
	font-weight: 400;
	line-height: 1.5;

	ul {
		display: none;
		width: 100% !important;
	}

	>li {
		&:first-child {
			padding-top: .5rem;
		}

		&:last-child {
			padding-bottom: .5rem;
		}

		&:not(:last-child) {
			border-bottom: 1px solid #323334;
		}

		>ul {
			margin-bottom: 1.3rem;
		}
	}

	li {
		a {
			display: block;
			position: relative;
			padding: side-values(13px 6px 13px 10px);
		}

		// List Padding
		li {
			a {
				padding-#{$left}: 2.4rem;
			}

			li {
				a {
					padding-#{$left}: 3.6rem;
				}
			}
		}
	}

	.expanded,
	.active>a {
		background: var(--alpha-change-color-dark-1);
	}

	.menu-item-has-children>a::after {
		content: none;
	}
}

.mobile-menu-title {
	margin-bottom: .5rem;
	color: var(--alpha-change-color-light-1);
	font-size: 1.4rem;
	font-weight: 700;
	text-transform: uppercase;
}

// Mobile Menu Overlay
.mobile-menu-overlay {
	position: fixed;
	left: 0;
	top: 0;
	bottom: 0;
	right: 0;
	background: #000;
	opacity: 0;
	transition: opacity .4s;
}

// Mobile Menu Close Button
.mobile-menu-close {
	position: fixed;
	#{$left}: calc(100vw - 50px);
	top: 25px;

	.mmenu-from-end & {
		#{$left}: auto;
		#{$right}: calc(100vw - 50px);
	}

	i {
		font-size: 2.8rem;
		color: #e1e1e1;
	}

	transition: opacity .3s;
	opacity: 0;
}

// Mobile menu light skin
.mobile-menu-light {
	.mobile-menu-container {
		background: #fff;
	}

	.hs-simple .input-wrapper {

		.btn-search,
		.form-control {
			background-color: #f1f1f1;
		}

		.btn-search {
			color: #222;
		}

		.form-control {
			color: #888;
		}
	}

	.mobile-menu {
		color: $dark-color;

		>li:not(:last-child) {
			border-color: #e5e5e5;
		}
	}

	.nav-link {
		color: $dark-color;
	}
}

.mmenu-active {
	overflow: hidden;

	.mobile-menu-wrapper {
		visibility: visible;
		z-index: 10002;
	}

	.mobile-menu-container {
		margin-#{$left}: 0;
	}

	&.mmenu-from-end .mobile-menu-container {
		margin-#{$left}: auto;
		margin-#{$right}: 0;
	}

	.mobile-menu-overlay {
		opacity: .8;
	}

	.mobile-menu-close {
		opacity: 1;
	}
}

@include mq(400px, max) {
	.mobile-menu-close {
		#{$left}: calc(100vw - 40px);
		top: 10px;

		.mmenu-from-end & {
			#{$left}: auto;
			#{$right}: calc(100vw - 40px);
		}
	}
}

// 7. Menu LazyLoad
.lazy-menu>li:hover>ul {
	height: 32rem;
	min-width: 22rem;
}

.lazy-menu .d-loading li {
	height: 100%;
}