.dropdown-header {
	font-size: $dropdown-header-font-size;
	margin-bottom: $dropdown-header-margin-bottom;
	margin-top: $dropdown-header-margin-top;
	text-transform: $dropdown-header-text-transform;
	white-space: normal;
	word-wrap: break-word;

	@if not ($dropdown-header-padding-y == $dropdown-padding-y) {
		padding-bottom: $dropdown-header-padding-y;
		padding-top: $dropdown-header-padding-y;
	}

	@if not ($dropdown-header-padding-x == $dropdown-item-padding-x) {
		padding-left: $dropdown-header-padding-x;
		padding-right: $dropdown-header-padding-x;
	}

	@include clay-scale-component {
		font-size: $dropdown-header-font-size-mobile;
	}

	&:first-child {
		margin-top: 0;
	}
}

.dropdown-subheader {
	color: $dropdown-subheader-color;
	font-size: $dropdown-subheader-font-size;
	font-weight: $dropdown-subheader-font-weight;
	margin-bottom: $dropdown-subheader-margin-bottom;
	margin-top: $dropdown-subheader-margin-top;
	padding-bottom: $dropdown-subheader-padding-y;
	padding-left: $dropdown-subheader-padding-x;
	padding-right: $dropdown-subheader-padding-x;
	padding-top: $dropdown-subheader-padding-y;
	text-transform: $dropdown-subheader-text-transform;
	white-space: normal;
	word-wrap: break-word;

	&:first-child {
		margin-top: 0;
	}
}

.dropdown-caption {
	color: $dropdown-caption-color;
	font-size: $dropdown-caption-font-size;
	font-weight: $dropdown-caption-font-weight;
	padding: $dropdown-item-padding-y $dropdown-item-padding-x;
	white-space: normal;
	word-wrap: break-word;
}

.dropdown-item {
	@include clay-dropdown-item-variant($dropdown-item-base);

	.form-check {
		margin-bottom: 0;
	}

	.custom-control {
		margin-bottom: 0;
		margin-right: 0;
		min-height: $custom-control-indicator-size;
	}
}

.dropdown-section {
	padding: $dropdown-item-padding-y $dropdown-item-padding-x;

	.form-group + .form-group {
		margin-top: $dropdown-item-padding-y * 2;
	}
}

.dropdown-menu {
	border-style: $dropdown-border-style;
	font-size: $dropdown-font-size;
	max-height: $dropdown-max-height;
	max-width: $dropdown-max-width;
	min-height: $dropdown-min-height;
	overflow: auto;

	// Firefox clips overflowing content and doesn't respect `padding-bottom` on `.dropdown-menu`

	padding-bottom: 0;

	&::after {
		content: '';
		display: block;
		padding-top: $dropdown-padding-y;
	}

	@include media-breakpoint-down(md) {
		max-height: $dropdown-max-height-mobile;
		max-width: $dropdown-max-width-mobile;
	}

	@include clay-scale-component {
		font-size: $dropdown-font-size-mobile;
	}

	.alert {
		font-size: $dropdown-alert-font-size;
		line-height: $dropdown-alert-line-height;
		margin: $dropdown-alert-margin;
		padding: $dropdown-alert-padding-y $dropdown-alert-padding-x;

		&:first-child {
			margin-top: 0;
		}

		&:last-child {
			margin-bottom: 0;
		}
	}

	.alert-fluid {
		margin-left: 0;
		margin-right: 0;

		&:first-child {
			margin-top: -$dropdown-padding-y;
		}

		&:last-child {
			margin-bottom: -$dropdown-padding-y;
		}
	}

	.form-group {
		margin-bottom: 0;
	}

	.inline-scroller {
		max-height: $dropdown-inline-scroller-max-height;

		@include media-breakpoint-down(md) {
			max-height: $dropdown-inline-scroller-max-height-mobile;
		}
	}

	> .list-unstyled {
		margin-bottom: 0;
	}
}

// Dropdown Action

.dropdown-action {
	display: inline-block;
	font-size: $dropdown-action-toggle-font-size;
	vertical-align: middle;

	> .dropdown-toggle {
		align-items: center;

		@include border-radius($dropdown-action-toggle-border-radius);

		cursor: $btn-cursor;
		display: flex;

		@include clay-monospace($dropdown-action-toggle-size);

		font-size: inherit;
		font-weight: inherit;
		justify-content: center;
		line-height: inherit;
		padding: 0;
		text-transform: inherit;
		vertical-align: baseline;

		&:disabled,
		&.disabled {
			cursor: $dropdown-action-toggle-disabled-cursor;
			opacity: $dropdown-action-toggle-disabled-opacity;
		}

		.inline-item .lexicon-icon,
		.lexicon-icon {
			margin-top: 0;
		}
	}
}

// Dropdown Menu with Indicators

.dropdown-menu-indicator-start {
	// `.dropdown-item-indicator` is deprecated in v2.3.5 use
	// `.dropdown-item-indicator-start` instead
	.dropdown-item-indicator {
		height: $dropdown-item-indicator-size;
		left: $dropdown-item-padding-x;
		position: absolute;
		top: $dropdown-item-padding-y;
		width: $dropdown-item-indicator-size;
	}

	.dropdown-item-indicator-start {
		height: $dropdown-item-indicator-size;
		left: $dropdown-item-padding-x;
		position: absolute;
		right: auto;
		top: $dropdown-item-padding-y;
		width: $dropdown-item-indicator-size;
	}

	.dropdown-header,
	.dropdown-subheader,
	.dropdown-caption,
	.dropdown-item {
		padding-left: $dropdown-item-padding-x + $dropdown-item-indicator-size + $dropdown-item-indicator-spacer-x;
	}
}

.dropdown-menu-indicator-end {
	// `.dropdown-item-indicator` is deprecated in v2.3.5 use
	// `.dropdown-item-indicator-end` instead
	.dropdown-item-indicator {
		position: absolute;
		right: $dropdown-item-padding-x;
		top: $dropdown-item-padding-y;
	}

	.dropdown-item-indicator-end {
		left: auto;
		position: absolute;
		right: $dropdown-item-padding-x;
		top: $dropdown-item-padding-y;
	}

	.dropdown-item {
		padding-right: $dropdown-item-padding-x + $dropdown-item-indicator-size + $dropdown-item-indicator-spacer-x;
	}
}

// Dropdown Menu Positions

.dropdown-menu-top {
	bottom: 100% !important;
	left: 0 !important;
	margin-top: 0;
	margin-bottom: $dropdown-spacer;
	right: auto !important;
	top: auto !important;
	transform: none !important;
	will-change: auto !important;
}

.dropdown-menu-top-right {
	bottom: 100% !important;
	left: auto !important;
	margin-top: 0;
	margin-bottom: $dropdown-spacer;
	right: 0 !important;
	top: auto !important;
	transform: none !important;
	will-change: auto !important;
}

.dropdown-menu-top-center {
	bottom: 100% !important;
	left: 50% !important;
	margin-top: 0;
	margin-bottom: $dropdown-spacer;
	right: auto !important;
	top: auto !important;
	transform: translateX(-50%) !important;
	will-change: auto !important;
}

.dropdown-menu-center {
	bottom: auto !important;
	left: 50% !important;
	right: auto !important;
	top: 100% !important;
	transform: translateX(-50%) !important;
	will-change: auto !important;
}

.dropdown-menu-left-side {
	bottom: auto !important;
	left: auto !important;
	margin-right: $dropdown-spacer;
	margin-top: 0;
	right: 100% !important;
	top: 0 !important;
	transform: none !important;
	will-change: auto !important;
}

.dropdown-menu-left-side-bottom {
	bottom: 0 !important;
	left: auto !important;
	margin-right: $dropdown-spacer;
	margin-top: 0;
	right: 100% !important;
	top: auto !important;
	transform: none !important;
	will-change: auto !important;
}

.dropdown-menu-left-side-middle {
	bottom: auto !important;
	left: auto !important;
	margin-right: $dropdown-spacer;
	margin-top: 0;
	right: 100% !important;
	top: 50% !important;
	transform: translate(0 , -50%) !important;
	will-change: auto !important;
}

.dropdown-menu-right-side {
	bottom: auto !important;
	left: 100% !important;
	margin-left: $dropdown-spacer;
	margin-top: 0;
	right: auto !important;
	top: 0 !important;
	transform: none !important;
	will-change: auto !important;
}

.dropdown-menu-right-side-bottom {
	bottom: 0 !important;
	left: 100% !important;
	margin-left: $dropdown-spacer;
	margin-top: 0;
	right: auto !important;
	top: auto !important;
	transform: none !important;
	will-change: auto !important;
}

.dropdown-menu-right-side-middle {
	bottom: auto !important;
	left: 100% !important;
	margin-left: $dropdown-spacer;
	margin-top: 0;
	right: auto !important;
	top: 50% !important;
	transform: translate(0 , -50%) !important;
	will-change: auto !important;
}

// Dropdown wide / full

%dropdown-full-wide-dropdown-menu {
	max-width: none;
	width: 100%;

	@include media-breakpoint-up(md) {
		max-height: none;
		width: 100%;
	}
}

.dropdown-full,
.dropdown-wide {
	.dropdown-header ~ .dropdown-header {
		margin-top: $dropdown-full-wide-header-spacer-y;
	}

	.dropdown-menu {
		@extend %dropdown-full-wide-dropdown-menu;

		> .row {
			margin-left: 0;
			margin-right: 0;
			min-width: $dropdown-wide-width;
		}
	}
}

.dropdown-wide .dropdown-menu {
	@include media-breakpoint-up(lg) { // min-width 992px
		min-width: $dropdown-wide-width;
	}
}

// Dropdown Menu Autocomplete

.dropdown-full .autocomplete-dropdown-menu,
.dropdown-full .dropdown-menu-autocomplete {
	max-height: map-get($autocomplete-dropdown-menu, max-height-mobile);

	@include media-breakpoint-up(md) {
		max-height: map-get($autocomplete-dropdown-menu, max-height);
	}
}

.autocomplete-dropdown-menu,
.dropdown-menu-autocomplete {
	@include clay-dropdown-menu-variant($autocomplete-dropdown-menu);
}

// Navbar Component Dropdowns

.nav-item.dropdown-full {
	position: static;
}

.nav-item.dropdown-wide {
	@include media-breakpoint-down(md) { // max-width 991px
		position: static;
	}
}

.navbar-nav .dropdown-menu-center {
	@include media-breakpoint-down(sm) { // max-width 767px
		-ms-transform: none;
		transform: none;
	}
}

.navbar-right .dropdown-menu-center {
	left: 50%;
	right: auto;
}