/*****************************************************************************
 * 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.
 *****************************************************************************/

ul.tree {
	@include menuUlReset();
	@include user-select(none);
	li {
		display: block;
		position: relative;
	}
	ul.tree {
		margin-left: $treeVCW + $interiorMargin;
	}
}

.tree-item,
.search-result-item {
	$runningItemW: 0;
	@include box-sizing(border-box);
	@include border-radius($basicCr);
	@include single-transition(background-color, 0.25s);
	display: block;
	font-size: 0.8rem;
	height: $menuLineH;
	line-height: $menuLineH;
	margin-bottom: $interiorMarginSm;
	position: relative;

	.view-control {
		color: $colorItemTreeVC;
		display: inline-block;
		margin-left: $interiorMargin;
		font-size: 0.75em;
		width: $treeVCW;
		$runningItemW: $interiorMargin + $treeVCW;
		@include desktop {
			&:hover {
				color: $colorItemTreeVCHover !important;
			}
		}
	}

	.label,
	.t-object-label {
		display: block;
		@include absPosDefault();
		line-height: $menuLineH;

        .t-item-icon {
            @include txtShdwSubtle($shdwItemTreeIcon);
            font-size: $treeTypeIconH;
            color: $colorItemTreeIcon;
            position: absolute;
            left: $interiorMargin;
            top: 50%;
            width: $treeTypeIconH;
            @include transform(translateY(-50%));
        }

		.type-icon {
			//@include absPosDefault(0, false);
			$d: $treeTypeIconH;
			@include txtShdwSubtle($shdwItemTreeIcon);
			font-size: $treeTypeIconH;
			color: $colorItemTreeIcon;
			left: $interiorMargin;
			position: absolute;
			@include verticalCenterBlock($menuLineHPx, $treeTypeIconHPx);
			line-height: 100%;
			right: auto; width: $treeTypeIconH;

			.icon {
				&.l-icon-link,
				&.l-icon-alert {
					position: absolute;
					z-index: 2;
				}
				&.l-icon-alert {
					$d: 8px;
					@include ancillaryIcon($d, $colorAlert);
					top: 1px;
					right: -2px;
				}
				&.l-icon-link {
					$d: 8px;
					@include ancillaryIcon($d, $colorIconLink);
					left: -3px;
					bottom: 0px;
				}
			}
		}
		.title-label,
        .t-title-label {
			@include absPosDefault();
			display: block;
			left: $runningItemW + ($interiorMargin * 3);
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}
	}

	&.selected {
		background: $colorItemTreeSelectedBg;
		color: $colorItemTreeSelectedFg;
		.view-control {
			color: $colorItemTreeSelectedVC;
		}
		.t-object-label .t-item-icon {
			color: $colorItemTreeSelectedFg; //$colorItemTreeIconHover;
		}
	}

	&:not(.selected) {
		// NOTE: [Mobile] Removed Hover on Mobile
		@include desktop {
			&:hover {
				background: $colorItemTreeHoverBg;
				color: $colorItemTreeHoverFg;
				.t-item-icon {
					color: $colorItemTreeIconHover;
				}
			}
		}
	}

	&:not(.loading) {
		cursor: pointer;
	}

	.context-trigger {
		$h: 0.9rem;
		top: -1px;
		position: absolute;
		right: $interiorMarginSm;
		.invoke-menu {
			font-size: 0.75em;
			height: $h;
			line-height: $h;
		}
	}
}

.tree-item {
	.t-object-label {
		left: $interiorMargin + $treeVCW;
	}
}