// Dropdown menu
//
// By default, it appears attached to the bottom right
// of the parent element (specified by `o-dropdown-wrapper`)
// -----------------------------------------------------------
@import '../less/variables/colors.less';
@import '../less/variables/effects.less';
@import '../less/variables/typography.less';
@import '../less/variables/z-index.less';

.o-dropdown-menu__wrapper {
	// Provides a target for the menu to be positioned against
	display: inline-block;
	position: relative;
}

// Override focus rectangles while the menu is open
.o-button.o-dropdown-menu__toggle {
	&:focus,
	&:active:focus {
		outline: none;
	}

	.fa-angle-down,
	.fa-angle-up {
		padding-left: 4px;
	}
}

@dropdown-menu-margin: 2px;

.o-dropdown-menu__contents {
	background-color: #fff;
	border: 1px solid @color-gray-x-light;
	border-radius: 4px;
	display: none;
	min-width: 250px;
	padding: 10px 0;
	position: absolute;
	text-align: left;
	z-index: @z-index-dropdown-menu;

	// All <li> tags generated by the dropdown-menu need to have no list-bullets.
	& li {
		list-style-type: none;
	}

	&.is-visible {
		display: block;
	}

	&.is-pinned-left {
		left: 0;
		right: auto;
	}

	&.is-pinned-right {
		left: auto;
		right: 0;
	}

	&.is-pinned-bottom {
		box-shadow: @dropdown-box-shadow;
		margin-bottom: 0;
		margin-top: @dropdown-menu-margin;
		top: 100%;
	}

	&.is-pinned-top {
		bottom: 100%;
		box-shadow: @dropup-box-shadow;
		margin-bottom: @dropdown-menu-margin;
		margin-top: 0;
	}
}

// List items
.o-dropdown-menu__item {
	&.o-dropdown-menu__item--separator {
		border-bottom: 1px solid @color-gray-xx-light;
		margin: 10px 0;
		padding: 0;
	}

	&.o-dropdown-menu__item--note {
		color: @color-gray-medium;
		cursor: text;
		font-style: italic;
	}

	&.o-dropdown-menu__header {
		color: @color-gray-x-dark;
		font-size: 13px;
		font-weight: @font-weight-bold;
	}

	// Disabled actions
	&.o-dropdown-menu__item--link.is-disabled {
		color: @color-gray-x-light;
		cursor: default;

		&:hover {
			background-color: #fff;
		}
	}
}

// Themeing
.is-dark-theme {
	&.o-dropdown-menu__contents {
		background-color: rgba(0, 0, 0, 0.8);
		border: none;
		box-shadow: none;
		color: #fff;
	}

	& .o-dropdown-menu__item {
		color: #fff;
	}

	& .o-dropdown-menu__item--link:hover {
		background-color: @color-gray-dark;
		color: #fff;
	}

	& .o-dropdown-menu__item--link.is-disabled {
		color: @color-gray-medium;

		&:hover {
			background: none;
		}
	}

	& .o-dropdown-menu__item--separator {
		border-bottom-color: @color-gray-medium;
	}

	& .o-dropdown-menu__item--note {
		color: @color-gray-light;
	}
}
