/*****************************************************************************
 * Open MCT Web, Copyright (c) 2014-2015, United States Government
 * as represented by the Administrator of the National Aeronautics and Space
 * Administration. All rights reserved.
 *
 * Open MCT Web is licensed under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 *
 * Open MCT Web includes source code licensed under additional open source
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 * this source code distribution or the Licensing information page available
 * at runtime from the About dialog for additional information.
 *****************************************************************************/
/******************************************************** MENU BUTTONS */
.s-menu-btn {
	// Formerly .btn-menu
	@extend .s-btn;
	span.l-click-area {
		// In markup, this element should not enclose anything.
		@extend .abs;
	}

	.icon {
		font-size: 120%;
	}

	.title-label {
		margin-left: $interiorMarginSm;
	}

	&:after {
		// Adds the downward facing 'context available / invoke menu' arrow element
		@include contextArrow();
		color: rgba($colorInvokeMenu, percentToDecimal($contrastInvokeMenuPercent));
	}

	&.create-btn {
		&:before {
			content:'\2b';
			display: inline;
			font-family: symbolsfont;
		}
		.title-label {
			font-size: 1rem;
		}
		//&:after {
		//	color: rgba($colorInvokeMenu, 0.5);
		//}
	}

	.menu {
		left: 0;
		text-align: left;
		.ui-symbol.icon {
			width: 12px;
		}
	}
}

/******************************************************** MENUS THEMSELVES */
.menu-element {
	cursor: pointer;
	position: relative;
}

.s-menu {
	@include border-radius($basicCr);
	@include containerSubtle($colorMenuBg, $colorMenuFg);
	@include boxShdw($shdwMenu);
	@include txtShdw($shdwMenuText);
	padding: $interiorMarginSm 0;
}

.menu {
	@extend .s-menu;
	display: block;
	position: absolute;
	z-index: 10;
	ul {
		@include menuUlReset();
		li {
			@include box-sizing(border-box);
			border-top: 1px solid pullForward($colorMenuBg, 10%);
			color: pullForward($colorMenuBg, 60%);
			line-height: $menuLineH;
			padding: $interiorMarginSm $interiorMargin * 2 $interiorMarginSm ($interiorMargin * 2) + $treeTypeIconW;
			position: relative;
			white-space: nowrap;
			&:first-child {
				border: none;
			}
			&:hover {
				background: $colorMenuHovBg;
				color: $colorMenuHovFg;
				.icon {
					color: $colorMenuHovIc;
				}
			}
			.type-icon {
				left: $interiorMargin * 2;
			}
		}
	}
}

.menu,
.context-menu,
.super-menu {
	pointer-events: auto;
	ul li {
		//padding-left: 25px;
		a {
			color: $colorMenuFg;
		}
		.icon {
			color: $colorMenuIc;
		}
		.type-icon {
			left: $interiorMargin;
		}
		&:hover .icon {
			//color: lighten($colorMenuIc, 5%);
		}
	}
}

.checkbox-menu {
	// Used in search dropdown in tree
	@extend .context-menu;
	ul li {
		padding-left: 50px;
		.checkbox {
			$d: 0.7rem;
			position: absolute;
			left: $interiorMargin;
			top: ($menuLineH - $d) / 1.5;
			em {
				height: $d;
				width: $d;
				&:before {
					font-size: 7px !important;// $d/2;
					height: $d;
					width: $d;
					line-height: $d;
				}
			}
		}
		.type-icon {
			left: 25px;
		}
	}
}

.super-menu {
	$w: 500px;
	$h: $w - 20;
	$plw: 50%;
	$prw: 50%;
	display: block;
	width: $w;
	height: $h;
	.contents {
		@include absPosDefault($interiorMargin);
	}
	.pane {
		@include box-sizing(border-box);
		&.left {
			//@include test();
			border-right: 1px solid pullForward($colorMenuBg, 10%);
			left: 0;
			padding-right: $interiorMargin;
			right: auto;
			width: $plw;
			overflow-x: hidden;
			overflow-y: auto;
			ul {
				li {
					@include border-radius($controlCr);
					padding-left: 30px;
					border-top: none;
				}
			}
		}
		&.right {
			//@include test(red);
			left: auto;
			right: 0;
			padding: $interiorMargin * 5;
			width: $prw;
		}
	}
	.menu-item-description {
		.desc-area {
			&.icon {
				$h: 150px;
				color: $colorCreateMenuLgIcon;
				position: relative;
				font-size: 8em;
				left: 0;
				height: $h;
				line-height: $h;
				margin-bottom: $interiorMargin * 5;
				text-align: center;
			}
			&.title {
				color: $colorCreateMenuText;
				font-size: 1.2em;
				margin-bottom: 0.5em;
			}
			&.description {
				//color: lighten($colorMenuBg, 30%);
				color: $colorCreateMenuText;
				font-size: 0.8em;
				line-height: 1.5em;
			}
		}
	}
}
.context-menu {
	font-size: 0.80rem;
}

.context-menu-holder,
.menu-holder {
	position: absolute;
	z-index: 70;
	.context-menu-wrapper {
		position: absolute;
		height: 100%;
		width: 100%;
	}
	&.go-left .context-menu,
	&.go-left .menu {
		right: 0;
	}
	&.go-up .context-menu,
	&.go-up .menu {
		bottom: 0;
	}
}

.context-menu-holder {
	pointer-events: none;
	height: 200px;
	width: 170px;
}

.btn-bar.right .menu,
.menus-to-left .menu {
	left: auto;
	right: 0;
	width: auto;
}