// Navigation

$first-level-padding: 1.2em; // get it from settings $dropdownmenu-padding
$submenu-padding-top-bottom: 1.75em;
$submenu-padding-left-right: 1.5em;

.barberry-navigation {
	position: relative;
}

.drilldown a {
    background: transparent;
}

.navigation-foundation {
	position: relative;

	ul {

		@include breakpoint(medium down) {
			// display: none;
		}

		list-style: none;
		

		li {
			margin: 0;

			&.active > a {
			    background: transparent;
			    color: #000;
			}


			a {
				font-size: 20px;
				line-height: 1.2;
				font-weight: 400;				
				color: #000;

				&:hover {
					@include opacity(.6);
				}							

			}

			.opens-right {

				ul.is-dropdown-submenu {
					margin-left: -1px;

					li {
					    opacity: 0;
					    @include transform(translateY(10px));
					    @include transition(.5s transform cubic-bezier(.19,1,.22,1),.5s opacity cubic-bezier(.19,1,.22,1));
					    transition-delay: 0s;				
					}

				}

				@include breakpoint(large) {

					&.is-active	{
						.js-dropdown-active	{

							li {

								@include transform(none);
								opacity: 1;
								@include transition(.5s transform cubic-bezier(.19,1,.22,1),.5s opacity cubic-bezier(.19,1,.22,1));
								// transition-delay: 2s;
								@for $i from 1 through 100 {
									&:nth-child(#{$i}) {
										transition-delay: (0.06s * $i);
									}
								}
							}

						}


					}
				}

			}

			.opens-left {

				ul.is-dropdown-submenu {
					margin-right: 0;
				}

				@include breakpoint(large) {

					&.is-active	{
						.js-dropdown-active {
							li {
								@include transform(none);
								opacity: 1;
								@include transition(.5s transform cubic-bezier(.19,1,.22,1),.5s opacity cubic-bezier(.19,1,.22,1));
								// transition-delay: 2s;
								@for $i from 1 through 100 {
									&:nth-child(#{$i}) {
										transition-delay: (0.06s * $i);
									}
								}
							}							
						}
					}
				}

			}
		}


		&.is-dropdown-submenu {
			opacity: 0;
			display: block;
			padding: $submenu-padding-top-bottom 0;
			margin: 0 (-$submenu-padding-left-right);
			outline: 0px solid transparent;
			z-index: 999;
			min-width: 300px;
			background-color: transparent;
			visibility: hidden;
			height: auto;
		    @include transform(scaleY(0));	
		    -webkit-transform-origin: top;
		    transform-origin: top;	
    		-webkit-overflow-scrolling: touch;	 

			@include transition(.2s transform cubic-bezier(.165,.84,.44,1));


			&:after {
				opacity: 0;
			    content: "";
			    position: absolute;
			    top: 0;
			    bottom: 0;
			    right: 0;
			    left: 0;
				z-index: -1;
				@include transition(opacity 1s cubic-bezier(.165,.84,.44,1), box-shadow 1s cubic-bezier(.165,.84,.44,1));
				@include box-shadow(5px 5px 0px -10px rgba(0,0,0,0));
				transition-delay: .6s;
			} 


			li {
			    opacity: 0;
			    @include transform(translateY(10px));
			    @include transition(.5s transform cubic-bezier(.165,.84,.44,1),.5s opacity cubic-bezier(.165,.84,.44,1));
			    transition-delay: 0s;				
			}	

			&.js-dropdown-active {
				opacity: 1;
				visibility: visible;

				@include transition(.75s transform cubic-bezier(.19,1,.22,1));
		        @include transform(none);

		        pointer-events: inherit;
		        -webkit-animation-name: show-menu-section;
		        animation-name: show-menu-section;
		        -webkit-animation-duration: .001s;
		        animation-duration: .001s;
		        -webkit-animation-fill-mode: forwards;
		        animation-fill-mode: forwards;

				&:before {
				    content: "";
				    position: absolute;
				    top: 0;
				    bottom: 0;
				    right: 0;
				    left: 0;
				    background-color: #fff;
				    // -webkit-animation: topCanvasNavOpen 0.5s forwards ease;
				    // animation: topCanvasNavOpen 0.5s forwards ease;	
				    // -webkit-clip-path: polygon(0 0, 100% 0, 100% 60%, 0 100%);
				    // clip-path: polygon(0 0, 100% 0, 100% 60%, 0 100%);	
				    z-index: -1;
				}			        		        

				&:before {
					opacity: 1;
					
				}

				&:after {
					opacity: 1;
					@include box-shadow(5px 5px 60px -10px rgba(0,0,0,.15));

				} 				

				li {
					@include transform(none);
					opacity: 1;
					 @include transition(.5s transform cubic-bezier(.19,1,.22,1),.5s opacity cubic-bezier(.19,1,.22,1));
					// transition-delay: .4s;
					@for $i from 1 through 100 {
						&:nth-child(#{$i}) {
							transition-delay: (0.06s * $i);
						}
					}

					a {
						font-size: 18px;
						font-weight: 300;

					}
				}
			}

			li {
				padding-top: 0;
				padding-bottom: 0;

				&.menu-item-has-children {

					> a {
						background-color: transparent;
						position: relative;

						&:after	{
							transition: all .7s;
							line-height: inherit;
							margin-top: -0.6em;

						}						
					}

					&.opens-right {

						> a	{
							&:after {
								right: $submenu-padding-left-right + $first-level-padding + 1.5em;
							}
						}
					}					

					&.opens-left {

						> a	{
							&:after {
								right: $submenu-padding-left-right + $first-level-padding + 1.5em;
								left: auto;
							}
						}
					}
				}

				a {
					position: relative;
					line-height: 1.3;
					padding: .4em $submenu-padding-left-right + $first-level-padding;

					.items-badge {
						position: absolute;
					    bottom: 78%;
					    white-space: nowrap;
					    z-index: 1;
					    display: inline-block;
					    margin-left: -13px;
					    vertical-align: middle;

					    span {
						    font-size: 10px;
						    line-height: 12px;
						    font-weight: bold;
						    font-weight: 600;
						    padding: 3px 5px 2px 5px;
						    color: #fff; 
						    position: relative;

							&:before {
							    content: "";
							    position: absolute;
							    bottom: -4px;
							    left: 7px;
							    width: 0;
							    height: 0;
							    border-style: solid;
							    border-top-width: 4px;
							    border-bottom-width: 0;
							    border-right-width: 7px;
							    border-left-width: 0;
							    border-top-color: transparent;
							    border-left-color: transparent!important;
							    border-right-color: transparent!important;
							    border-bottom-color: transparent!important;
							}

							&.hot-badge {
								background: #ed3737;
								&:before {
									border-color: #ed3737;
								}
							}

							&.new-badge {
								background: #65b32c;
								&:before {
									border-color: #65b32c;
								}
							}							

							&.trending-badge {
								background: #e4b425;
								&:before {
									border-color: #e4b425;
								}
							}					  	
					    } 


						& > span {
							opacity: 0;

							&:last-child {
								opacity: 1;
							}
						}												
					}
				}

			}

			ul {
				margin-top: -$submenu-padding-top-bottom;
			}
		}
	}

	> ul {
		margin: 0 (-$first-level-padding);
		margin: 0;

		> li {
			padding-right: 1.4em;
			@include poly-fluid-sizing('padding-right', (1024px:20px, 1440px:30px));
			position: relative;

			&:first-child {
				> a {
					padding-left: 0;
				}
			}


			> a {
				position: relative;

				> span {
					position: relative;
					// overflow: hidden;
					display: block;
					padding: 0;									
				}

				&:hover {
					&:before {
					    right: auto;
					    left: 0px;
					    width: 100%;					
					}					
				}

				&.hover {
					opacity: 1 !important;										
				}
			}

			&:hover,
			&.is-active	{
				> a	{
					opacity: 1 !important;
					color: inherit;
					&:before {
					    right: auto;
					    left: 0px;
					    width: 100%;					
					}					
				}
			}
			
		}
	}

	.no_menu {
		min-height: 60px;
	}	

	// Style for mega menu
	.menu {

		.is-mega-menu {
			position: static;
			position: relative;

			.is-dropdown-submenu {
			    top: 0;
			    right: auto;
			    left: 100%;
			    padding: $submenu-padding-top-bottom 2.7em;
			}

			.dropdown-submenu {
				padding: 0;


				.mega-menu-content {
					padding: 3rem 4rem;
					-webkit-transform: none;
					transform: none;

					.cell {
						&:nth-child(n+5) {
							margin-top: 20px;
						}
					}
				
					.menu-item-mega {
						margin-bottom: 0rem;

						a.dropdown-toggle {
							padding: 0;
							padding-left: 0;
							margin-left: 0rem;
							margin-bottom: 1rem;
							font-size: 22px;
							font-weight: 600;
						}

						.mega-menu-submenu {
							ul.sub-menu {
								margin-top: 0;
								margin-left: 0rem;
								margin-right: 1.5rem;

								li {
									a {
										padding-left: 0;
										padding-right: 0;
										transition: opacity 1s cubic-bezier(.19,1,.22,1);

										&:hover {
											opacity: .5;
										}
									}
								}
							}
						}

					}

				}
			}

			&.is-active {
				.mega-menu-content {
					-webkit-animation: 2s ease 0s normal forwards 1 fadeIn;
					animation: 2s ease 0s normal forwards 1 fadeIn;					
				}
			}			
		}
	}

}

.dropdown.menu {
	> li {
		> a {
			background:transparent;
			padding: 0rem 0rem;
			span {
				padding: .5rem 0;
			}
		}		
	}
}


.dropdown.menu > li.is-dropdown-submenu-parent > a::after {
    font-size: 11px;
    position: absolute;
    right: 0;
    top: calc(50% - 6px);
    opacity: .5;
    width: 11px;
    height: 11px;
    border: none;
    transition: .25s transform ease;
    margin-top: 0;
}

.dropdown.menu.my-account-no-drop > li.is-dropdown-submenu-parent > a {
	padding-right: 0 !important;
	&:after {
		display: none ;
	}
}

.dropdown.menu > li.is-dropdown-submenu-parent.opens-left > a::after {
    right: auto;
    left: .7em;

}

.is-dropdown-submenu .is-dropdown-submenu-parent.opens-right > a::after,
.is-dropdown-submenu .is-dropdown-submenu-parent.opens-left > a::after {
	font-size: 11px;
    display: block;
    width: 11px;
    height: 11px;
    border: none;
    font-family: 'Barberry';
    top: calc(50%);
    opacity: .5;
}

.dropdown.menu > li.is-dropdown-submenu-parent > a {
    position: relative;
    padding-right: 1.2rem;
}


.drilldown .is-drilldown-submenu-parent > a::after {
    position: absolute;
    top: 50%;
    margin-top: -6px;
    right: 1rem;
    display: block;
    width: 0;
    height: 0;
    border: inset 6px;
    content: '';
    border-right-width: 0;
    border-left-style: solid;
    border-color: transparent transparent transparent #1779ba;
    @include barberry-icon('\ea21');
    font-size: 16px;
    top: calc(50% - 3px);
    right: 1rem;
    border:none;
}

.drilldown .js-drilldown-back > a::before {
    display: block;
    width: 0;
    height: 0;
    border: inset 6px;
    content: '';
    border-left-width: 0;
    border-right-style: solid;
    border-color: transparent #1779ba transparent transparent;
    border-left-width: 0;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.75rem;
    border-left-width: 0;

    @include barberry-icon('\ea24');
    font-weight: bold;
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-top: -4px;
    border:none;    
}

// Mobile Menu Burger

.menu-trigger {
	display: none;
	width: auto;
	float: left;
	cursor: pointer;

	.site-header.header-offcanvas & {
		display: flex;
	}


	.nav_burger {

	    width: 20px;
	    height: 12px;
	    position: relative;
	    overflow: hidden;	
	    
		span {
			height: 2px;
		    position: absolute;
		    display: inline-block;
		    width: 100%;
		    background: #000000;
		    left: 0;
		    -webkit-transform-origin: left center;
		    -ms-transform-origin: left center;
		    transform-origin: left center;
		    -webkit-transition: -webkit-transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
		    transition: -webkit-transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
		    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
		    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);

			&:before {
			    -webkit-transform: translateX(-200%);
			    -ms-transform: translateX(-200%);
			    transform: translateX(-200%);
			    width: 100%;
			    display: inline-block;
			    height: 100%;
			    content: "";
			    background: #000000;
			    -webkit-transition: -webkit-transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
			    transition: -webkit-transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
			    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
			    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
			    position: absolute;
			    top: 0;
			    left: 0;				
			}	
			


			&.burger_top {
				top: 0;
			}

			&.burger_middle {
			    top: 50%;
			    margin-top: -1px;
			    transition-delay: .03s;


			}

			&.burger_bottom {
			    bottom: 0;
			    width: 60%;
			    -webkit-transition: margin 0.4s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.4s 0s cubic-bezier(0.4, 0, 0.2, 1);
			    transition: margin 0.4s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.4s 0s cubic-bezier(0.4, 0, 0.2, 1);
			    transition: transform 0.4s 0s cubic-bezier(0.4, 0, 0.2, 1), margin 0.4s cubic-bezier(0.4, 0, 0.2, 1);
			    transition: transform 0.4s 0s cubic-bezier(0.4, 0, 0.2, 1), margin 0.4s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.4s 0s cubic-bezier(0.4, 0, 0.2, 1);
				transition-delay: .07s;

			}			

		}

	}	

	&:hover {
		.nav_burger {
			span {
				  -webkit-transform: translateX(200%);
				      -ms-transform: translateX(200%);
				          transform: translateX(200%);			
			}
		}
	}

	.menu-title {
		span {
			margin-left: 15px;
		}
		@include breakpoint(small only) {
			display: none;
		}
	}
}

// Light version of Navigation

header.site-header:not(.header--clone) {
	&.header-color-light {
		.dropdown.menu {
			> li {
				> a {
					color: #fff;
					span {
						color:#fff;
					}
					&:after {
						color:#fff;
					}
				}
			}
		}

		.menu-trigger {
			.nav_burger {
				span,
				span:before {
					background: #fff;
				}
			}
			.menu-title {
				span {
					color: #fff;
				}
			}
		}
	}
}


header.header-left {
	&.header-nav-center {
		.navigation-foundation > ul {
			justify-content: center;
		}		
	}
}
