// Navbar

.navbar {
	border-width: 0;
	font-size: $navbar-font-size;

	.container,
	.container-fluid {
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}
}

.navbar-nowrap {
	flex-wrap: nowrap;

	.container,
	.container-fluid,
	.navbar-nav {
		flex-wrap: nowrap !important;
	}

	.navbar-text {
		min-width: 0;
		white-space: nowrap;
	}
}

.navbar-nav,
.navbar-form {
	.dropdown-menu-right {
		left: auto;
		right: 0;
	}
}

.navbar-nav {
	flex-direction: row;

	.dropdown-menu {
		position: absolute;
	}

	.nav-link {
		padding-left: $navbar-nav-link-padding-x;
		padding-right: $navbar-nav-link-padding-x;
	}
}

.navbar-nav-expand {
	flex-grow: 1;
	min-width: 0;
}

.navbar-nav-last {
	margin-left: auto;
}

.navbar-nav .nav-item {
	word-wrap: normal;

	> .custom-control,
	> .form-check {
		margin-bottom: 0;
		margin-left: $navbar-nav-link-padding-x;
		margin-right: $navbar-nav-link-padding-x;
	}
}

.nav-item-expand {
	flex-grow: 1;
	min-width: 0;
}

.nav-item-shrink {
	min-width: 0;
}

.navbar-title {
	font-size: $navbar-title-font-size;
	font-weight: $navbar-title-font-weight;
	margin-bottom: $navbar-title-margin-bottom;
	text-transform: $navbar-title-text-transform;
}

.navbar-text {
	padding-left: $navbar-nav-link-padding-x;
	padding-right: $navbar-nav-link-padding-x;
}

.navbar-collapse {
	max-width: 100%;

	.navbar-nav {
		flex-direction: column;
	}

	.dropdown-toggle .navbar-text-truncate {
		max-width: calc(100% - #{$navbar-text-truncate-spacer-right});
	}
}

.navbar-text-truncate {
	display: inline-block;
	max-width: 100%;

	@include text-truncate;

	vertical-align: bottom;
}

// Navbar Toggler

.navbar-toggler {
	&:focus {
		z-index: $zindex-navbar-toggler-focus;
	}

	&:not(:disabled):not(.disabled) {
		cursor: $navbar-toggler-cursor;
	}
}

.navbar-toggler-link {
	align-items: center;
	display: flex;
	border-width: 0;
	line-height: $line-height-base;
	max-width: 100%;
	padding: $navbar-brand-padding-y $navbar-nav-link-padding-x;
	position: relative;

	.lexicon-icon {
		min-width: 1em;
		margin-left: 3px;
		margin-top: 0;
	}
}

// Navbar Brand

.navbar-brand {
	margin-right: 0;
	max-width: calc(100% - 72px);
	padding-left: $navbar-nav-link-padding-x;
	padding-right: $navbar-nav-link-padding-x;
}

// Navbar Form

.navbar-form {
	align-items: center;
	display: flex;
	padding-left: $navbar-nav-link-padding-x;
	padding-right: $navbar-nav-link-padding-x;

	> form {
		width: 100%;
	}
}

.navbar-form-autofit {
	flex-basis: 100px;
	flex-grow: 1;

	form {
		display: flex;
		width: 100%;
	}
}

// Navbar Overlay

.navbar-overlay {
	background-color: $body-bg;
}

// Navbar Display Utilities

.navbar-breakpoint-d-block,
.navbar-breakpoint-d-inline-block,
.navbar-breakpoint-d-flex {
	display: none !important;
}

// Navbar Expand

.navbar-expand {
	flex-wrap: wrap;
	justify-content: space-between;

	.navbar-nav {
		flex-wrap: wrap;
	}

	@each $breakpoint in map-keys($grid-breakpoints) {
		$next: breakpoint-next($breakpoint, $grid-breakpoints);
		$infix: breakpoint-infix($next, $grid-breakpoints);

		&#{$infix} { // .navbar-expand, sm, md, lg, xl
			justify-content: space-between;

			.nav-item {
				align-items: center;
				display: flex;
			}

			.nav-item .navbar-text-truncate {
				max-width: $navbar-text-truncate-max-width;
			}

			.container,
			.container-fluid {
				display: flex;
				flex-wrap: wrap;
				justify-content: space-between;
				padding-left: $grid-gutter-width / 2;
				padding-right: $grid-gutter-width / 2;
			}

			.navbar-collapse {
				.container,
				.container-fluid {
					padding-left: 0;
					padding-right: 0;
				}
			}

			@if not ($infix == '') { // .navbar-expand-sm, md, lg, xl
				@include media-breakpoint-down($breakpoint) {
					&.navbar-collapse-absolute {
						.navbar-collapse {
							left: 0;
							padding: 0 $navbar-padding-x;
							position: absolute;
							right: 0;
							top: 100%;
							z-index: $zindex-navbar-collapse-absolute;

							.container,
							.container-fluid {
								padding-left: $grid-gutter-width / 2;
								padding-right: $grid-gutter-width / 2;
							}

							.navbar-nav,
							.navbar-form {
								&:last-child {
									padding-bottom: $navbar-padding-y;
								}
							}
						}
					}

					.navbar-collapse {
						.container,
						.container-fluid {
							display: block;
							padding-left: 0;
							padding-right: 0;
						}

						.nav-item {
							display: block;
						}

						.navbar-text-truncate {
							max-width: 100%;
						}

						.navbar-nav {
							.dropdown-toggle .navbar-text-truncate {
								max-width: calc(100% - #{$navbar-text-truncate-spacer-right});
							}

							.dropdown-divider {
								margin-left: -$navbar-padding-x;
								margin-right: -$navbar-padding-x;
							}

							.dropdown-item {
								&:hover,
								&:focus {
									background-color: transparent;
								}

								&.active {
									background-color: transparent;
								}
							}

							.dropdown-menu {
								background-color: transparent;
								border-width: 0;
								box-shadow: none;
								margin: 0;
								max-height: none;
								max-width: none;
								overflow: visible;
								padding: 0;
								position: static;
							}
						}
					}

					.show-dropdown-on-collapse {
						.dropdown-header,
						.dropdown-item {
							padding: $nav-link-padding-y $navbar-nav-link-padding-x;
						}

						.dropdown-menu {
							display: block;
						}

						.dropdown-toggle {
							display: none;
						}
					}

					.navbar-breakpoint-down-d-block {
						display: block !important;
					}

					.navbar-breakpoint-down-d-inline-block {
						display: inline-block !important;
					}

					.navbar-breakpoint-down-d-flex {
						display: flex !important;
					}

					.navbar-breakpoint-down-d-none {
						display: none !important;
					}
				}
			}

			@include media-breakpoint-up($next) {
				@if not ($infix == '') { // .navbar-expand-sm, md, lg, xl
					.navbar-brand .navbar-text-truncate {
						max-width: $navbar-text-truncate-max-width;
					}

					.navbar-collapse {
						flex-grow: 1;
						flex-wrap: wrap;
						justify-content: space-between;

						.navbar-nav {
							flex-direction: row;
							flex-wrap: wrap;
						}

						.dropdown-toggle .navbar-text-truncate {
							max-width: $navbar-text-truncate-max-width - $navbar-text-truncate-spacer-right;
						}
					}

					.navbar-breakpoint-d-block {
						display: block !important;
					}

					.navbar-breakpoint-d-inline-block {
						display: inline-block !important;
					}

					.navbar-breakpoint-d-flex {
						display: flex !important;
					}

					.navbar-breakpoint-d-none {
						display: none !important;
					}
				}
			}
		}
	}
}

// Navbar Overlay Styles for `.navbar-overlay-xs-down`,
// `.navbar-overlay-sm-down`, `.navbar-overlay-md-down`,
// `.navbar-overlay-lg-down`, `.navbar-overlay-up`

@each $breakpoint in map-keys($grid-breakpoints) {
	$index: index(map-keys($grid-breakpoints), $breakpoint);
	$length: length(map-keys($grid-breakpoints));
	$infix: '.navbar-overlay-#{$breakpoint}-down';

	@if ($index == $length) {
		$infix: '.navbar-overlay-up';
	}

	#{$infix} {
		@include media-breakpoint-down($breakpoint) {
			@include border-radius($navbar-border-radius);

			bottom: 0;
			display: none;
			justify-content: space-between;
			left: 0;
			margin-left: 0;
			margin-right: 0;
			padding-bottom: $navbar-padding-y;
			padding-left: $navbar-padding-x;
			padding-right: $navbar-padding-x;
			padding-top: $navbar-padding-y;
			position: absolute;
			right: 0;
			top: 0;
			z-index: $zindex-navbar-overlay;

			&.show {
				display: flex;
			}
		}
	}
}

// Navbar Underline

.navbar-underline {
	.navbar-toggler-link {
		&:after {
			background-color: $navbar-underline-active-bg;
			bottom: -$navbar-padding-y;
			content: '';
			display: block;
			height: $nav-underline-link-active-highlight-height;
			left: 0;
			position: absolute;
			right: 0;
			width: auto;
		}
	}
}

.navbar-underline.navbar-expand {
	@each $breakpoint in map-keys($grid-breakpoints) {
		$next: breakpoint-next($breakpoint, $grid-breakpoints);
		$infix: breakpoint-infix($next, $grid-breakpoints);

		&#{$infix} { // .navbar-expand, sm, md, lg, xl
			@include media-breakpoint-up($next) {
				.navbar-nav .nav-link {
					&.active:after {
						background-color: $navbar-underline-active-bg;
						bottom: -$navbar-padding-y;
						content: '';
						display: block;
						height: $nav-underline-link-active-highlight-height;
						left: 0;
						position: absolute;
						right: 0;
						width: auto;
					}
				}
			}
		}
	}
}