/* -------------------------------------------
	Menu
		1. Default Menu Styles
		2. Horizontal Menu
		3. Vertical Menu
		4. Menu Collapsible
		5. Underline Hover Style
		6. Mega Menu
		7. Tip
		8. Mobile Menu
			- Toggle B
			// Toggle Button
			utton
			- Mobile Menu Wrapper
			- Mobile Menu
			// Toggle Button
			 Container
			- Mobile Menu
			// Toggle Button

			- Mobile Menu
			// Toggle Button
			 Overlay
			- Mobile Menu
			// Toggle Button
			 Close Button

			// Toggle Button

		9. Dropdown Menu
		10. Flyout Menu
		11. Menu LazyLoad
 ------------------------------------------- */

// 1. Default Menu Styles
:root {
	--alpha-menu-has-children-arrow: 2rem;
	--alpha-dropdown-triangle-pos: calc(100% - 22px);
}

.menu {
	.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 {
		display: inline-block;
		margin: side-values(-1px 7px 0 0);
		line-height: 0;
		font-size: 17px;
		vertical-align: middle;
	}

	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);
			}
		}
	}

	ul .menu-item>a {
		font-size: .93em;
	}

	.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. Vertical Menu
.menu.vertical-menu {
	display: block;
	max-width: 100%;

	li>a {
		display: block;
	}

	>li {
		>ul {
			transform: translate3d(if-ltr(-15px, 15px), 0, 0);
		}

		>a {
			&::after {
				content: none;
			}
		}

		&:hover,
		&.show {
			>ul {
				#{$left}: 100%;
				top: 0;
				transform: translate3d(0, 0, 0);
			}
		}

		&:first-child:hover,
		&:first-child.show {
			>ul {
				top: -1rem;
			}
		}
	}

	>.menu-item-has-children {
		&::after {
			border: 11px solid transparent;
			border-#{$right}: 11px solid var(--alpha-change-color-light-1);
		}

		&:hover,
		&.show {
			&::after {
				top: 50%;
				#{$left}: calc(100% - 20px);
				transform: translate3d(0, -50%, 0);
			}

			>a::after {
				#{$right}: calc(var(--alpha-menu-has-children-arrow) - 8px);
			}
		}

		>a {
			&::after {
				position: absolute;
				#{$right}: 0;
				content: if-ltr('\f054', '\f053');
				font-size: .7em;
				transition: #{$right} .3s ease;
			}
		}
	}

	.megamenu {
		>li {
			>a {
				margin-bottom: 1.6rem;

				&:before {
					position: absolute;
					content: '';
					left: 0;
					right: 0;
					height: 1px;
					background-color: var(--alpha-change-border-color);
					bottom: -.8rem;
				}
			}
		}
	}

	&.no-arrow {
		>li {
			display: flex;

			>a {
				&::after {
					content: none;
				}
			}
		}
	}
}

.vertical-menu.dropdown-menu>li {
	padding: 0 1rem;
}

// 4. Menu Collapsible
.menu.collapsible-menu {
	display: block;

	>.menu-item {
		margin-#{$right}: 0;
	}

	.menu-item-has-children {

		&::after,
		>a::after {
			content: none;
		}

		li {
			padding: side-values(0 0 0 .7rem);
		}
	}

	li>ul {
		display: none;
		position: static;
		visibility: visible;
		opacity: 1;
		min-width: 0;
		transform: none;
		background: transparent;
		box-shadow: none;
	}

	ul {
		padding: 0;
	}
}

// 5. 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);
		}
	}
}

// 6. 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));
}

// 7. Tip
.tip {
	display: inline-block;
	position: relative;
	top: -1px;
	#{$left}: 8px;
	border-radius: 2px;
	padding: 4px 6.5px;
	font-size: 1rem;
	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);
	}
}

// 8. Mobile Menu

// Toggle Button
.toggle-btn {

	&,
	.menu &,
	.mobile-menu & {
		display: block;
		position: absolute;
		padding: 6px;
		#{$right}: 0;
		top: 50%;
		transform: translateY(-50%);
		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($corner-sm 0 0 $corner-sm);
		}

		.btn-search {
			color: var(--alpha-white-color);
			border-radius: corner-values(0 $corner-sm $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: 5.4rem;
}

// Mobile Menu
.mobile-menu {
	--alpha-menu-has-children-arrow: 1rem;
	color: #e1e1e1;
	font-size: 1.3rem;
	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(1.3rem .6rem 1.3rem 1rem);
		}

		// 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);
		}
	}
}

// 9. Dropdown Menu
.toggle-menu {
	width: 280px;

	>a {
		position: relative;
		padding: 1.8rem 2rem;
		transition: background .3s, color .3s;

		&:after {
			position: absolute;
			content: '\e910';
			top: 50%;
			transform: translateY(-50%);
			#{$right}: 18px;
			font-family: $framework-font;
			color: inherit;
		}

		i {
			margin-top: -1px;
			font-size: 1.2em;
		}

		i+span {
			margin-#{$left}: 7px;
		}

		.hover {
			position: absolute;
			top: 50%;
			transform: translateY(-50%);
			opacity: 0;
		}
	}

	&:hover>a {
		i:not(:first-child) {
			opacity: 0;
		}

		.hover {
			opacity: 1;
		}
	}

	.menu {
		padding: 2rem 0;

		.menu-item-has-children>a:after {
			right: 1rem;
		}
	}

	.menu>li {
		margin-#{$right}: 0;
	}

	.dropdown-box {
		padding: 0;
		#{$right}: auto;
	}

	&::before,
	&::after {
		#{$left}: 25px;
	}

	&.show .dropdown-box,
	.home &.show-home .dropdown-box {
		box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
	}

	&.has-border {

		&.show,
		&:hover {
			&::after {
				top: calc(var(--alpha-dropdown-triangle-pos) + 2px); // Because of border
			}
		}

		&::before {
			content: '';
			position: absolute;
			z-index: 1001;
			top: -9999px;
			transform: translateX(-50%);
			border: 11px solid transparent;
			border-bottom: 11px solid #e1e1e1;
			transition: opacity .4s ease;
			visibility: hidden;
			opacity: 0;
			cursor: pointer;
		}

		&.show::before,
		&:hover::before {
			visibility: visible;
			opacity: 1;
			top: calc(var(--alpha-dropdown-triangle-pos) + 1px);
			transform: translate3d(-50%, 0, 0);
		}

		.menu {
			border: 1px solid var(--alpha-change-border-color);
		}
	}
}

.sticky-content:not(.fixed) {
	.show-home {
		&::after {
			top: 100%;
		}

		.dropdown-box {
			top: calc(100% + 20px);
		}

		.dropdown-box,
		&::after {
			visibility: visible;
			opacity: 1;
		}

		.dropdown-box {
			transform: translate3d(0, 0, 0);
		}

		&::after {
			transform: translate3d(-50%, 0, 0);
		}

		@if use(menu-toggle-border) {
			&.has-border {
				&::before {
					top: calc(100% - 1px);
					visibility: visible;
					opacity: 1;
				}

				@include only-for-retina() {
					&::before {
						top: calc(100% - 2px);
					}
				}
			}
		}
	}
}


@include mq(1199px, max) {
	.toggle-menu {
		width: 240px;
	}
}

// 10. Flyout Menu
.flyout-menu-container {
	width: auto;

	nav {
		display: flex;
		align-items: center;
		justify-content: center;
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		z-index: 2999;
		visibility: hidden;
		opacity: 0;
		background-color: rgba(255, 255, 255, .95);
		transition: opacity .5s, visibility .5s;
		overflow-x: auto;
	}

	.flyout-close {
		position: fixed;
		#{$right}: 2em;
		top: 2em;
		padding: 0;
		visibility: hidden;
		opacity: 0;
		transition: opacity .3s, visibility .3s;
		z-index: 2999;
	}

	.menu {
		display: block;
	}

	>a {
		display: inline-flex;

		&:after {
			content: none;
		}
	}

	&.show {

		nav,
		.flyout-close {
			visibility: visible;
			opacity: 1;
		}
	}
}

.flyout-menu {
	.menu-item-has-children {

		&::after,
		>a::after {
			content: none;
		}
	}

	li>ul {
		display: none;
		position: static;
		visibility: visible;
		opacity: 1;
		min-width: 0;
		max-width: 100%;
		transform: none;
		background: transparent;
		box-shadow: none;
	}

	li li:hover>a {
		background: transparent;
	}

	.megamenu {
		display: none;
	}

	.menu-item a {
		display: flex;
		align-items: center;
		justify-content: center;
		z-index: 1;
	}

	>li {
		>a {
			font-size: 30px;
			opacity: 0;
			transition: transform .3s, opacity .3s;
		}

		&:nth-child(odd)>a {
			transform: translateY(-100%) rotate(10deg);
		}

		&:nth-child(even)>a {
			transform: translateY(-100%) rotate(-10deg);
		}
	}

	.show &>li>a {
		opacity: 1;
		transform: translateY(0) rotate(0);
		pointer-events: auto;
		transition-timing-function: ease;
	}

	@for $i from 1 through 10 {
		>li:nth-of-type(#{$i})>a {
			transition-delay: calc(0s + (#{$i} - 1) * 0.05s);
		}

		.show &>li:nth-of-type(#{$i})>a {
			transition-delay: calc(0.5s - (10 - #{$i}) * 0.05s);
		}
	}

	ul {
		padding: 0;
	}

	.toggle-btn {
		position: static;
		transform: none;
		margin-#{$left}: 5px;

		&:before {
			content: '\f078';
			font-size: .5em;
		}
	}

	.show>.toggle-btn::before {
		transform: rotate(180deg);
	}

	.flyout-menu-image {
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		opacity: 0;
		background-size: cover;
		background-position: center;
		transition: opacity cubic-bezier(.25, .46, .45, .94) 450ms;
		pointer-events: none;
		z-index: -1;
	}

	.menu-item:hover>.flyout-menu-image {
		opacity: 1;
	}
}

// 11. Menu LazyLoad
.lazy-menu>li:hover>ul {
	height: 32rem;
	min-width: 22rem;
}

.lazy-menu .d-loading li {
	height: 100%;
}