/* =============================== */
/* CSS for control sap.f/ShellBar  */
/* Evening Horizon theme           */
/* =============================== */

.alwaysCozyOverrideByParent(~"sapFShellBar");

.alwaysDarkModeOverrideByParent(~"sapFShellBar");

.sapFShellBarSizeLargeDesktop,
.sapFShellBarSizeExtraLargeDesktop {
	padding: 0 3rem;
}

.sapFShellBar .sapFShellBarSearchIsOpen .sapFShellBarSearchWrap .sapMBtn:not(.sapFShellBarSearchCancelButton) {
	right: 2.75rem;
}

.sapFShellBarSizeDesktop {
	padding: 0 2rem;
}

.sapFShellBar.sapFShellBarFCLFPHeader,
.sapMPageHeader .sapFShellBar {
	box-shadow: @sapUiShellShadow;
}

.sapFShellBar {
	background: @sapUiShellColor;
	height: 3.25rem;
	box-shadow: inset 0 -0.0625rem 0 0 @sapUiShellBorderColor;

	.sapFShellBarOTB.sapMIBar.sapMTB {
		height: 3.25rem;
	}

	// Copilot
	.CPImage,
	& .sapMIBar.sapMTB .CPImage {
		&:after {
			position: absolute;
			content: "";
			left: 3px;
			right: 3px;
			top: 3px;
			bottom: 3px;
			outline: none;
			pointer-events: none;
			border-radius: 0.5rem;
		}
		.color1 {
			stop-color: #0070F2;
		}
		.color2 {
			stop-color: #EBF8FF;
		}
		.opacity7 {
			stop-opacity:0.7;
		}
		.opacity36 {
			stop-opacity: 0.36;
		}
		.opacity2 {
			stop-opacity: 0.2;
		}
		&:focus {
			outline: @sapUiContentFocusWidth solid @sapUiContentFocusColor;
			border-radius: 0.375rem;
			background-color: @sapUiShellActiveBackground;
			color: @sapUiShellActiveTextColor;
			&:after {
				box-shadow: @sapUiContentSelectedShadow;
			}
		}
		&:hover:not(:focus) {
			background: @sapUiShellHoverBackground;

			&:after {
				box-shadow: @sapUiContentInteractionShadow;
			}
		}
		html[data-sap-ui-browser^="ie"] &:focus:before {
			border-color: @sapUiContentContrastFocusColor;
		}
	}

	&.sapMPageHeader .sapMIBar,
	.sapMIBar {
		height: 3.25rem;
	}
	.sapMBtn:hover > .sapMBtnHoverable.sapMToggleBtnPressed:not(.sapMBtnActive) {
		border-color: @sapUiShellHoverBackground;
	}
	.sapMToggleBtnPressed:not(.sapMBtnDisabled),
	.sapMTB-Transparent-CTX .sapMBtnInner.sapMToggleBtnPressed:not(.sapMBtnDisabled) {
		background-color: @sapUiShellActiveBackground;
		border-color: @sapUiShellActiveBackground;
	}
	.sapFShellBarProfile:not(:focus):hover {
		box-shadow: 0 0 0.125rem 0 fade(@sapContent_ShadowColor, 72);
	}

	// Mega Menu
	.sapFSHMegaMenu {
		color: @sapUiShellTextColor;
		overflow: visible;
		font-size: @sapMFontHeader5Size;
		font-weight: bold;

		.sapMBtn:not(:hover) .sapMBtnInner.sapMBtnTransparent::after,
		.sapMBtnTransparent {
			color: @sapUiShellTextColor;
		}

		.sapMBtn:hover > .sapMBtnTransparent.sapMBtnHoverable:not(.sapMBtnActive):not(.sapMToggleBtnPressed) bdi,
		&.sapMMenuBtn.sapMMenuBtnRegular .sapMBtnInner.sapMBtnTransparent:not(.sapMBtnActive)::after {
			color:  @sapUiShellTextColor;
		}

		.sapMBtn:hover > .sapMBtnHoverable:not(.sapMBtnActive) {
			background: @sapUiShellHoverBackground;
			box-shadow: @sapUiContentInteractionShadow;
			border-color: @sapUiButtonLiteBorderColor;
		}

		.sapMBtn:hover > .sapMBtnHoverable.sapMBtnActive {
			background: @sapUiShellHoverBackground;
			color: @sapUiShellActiveTextColor;
		}

		.sapMBtnInner,
		.sapMBtnInner::after {
			font-weight: normal;
			font-size: 1rem;
		}

		.sapMBtnInner::after {
			content: '\e1ef';
			font-family: 'SAP-icons';
		}
	}

	// Home Icon
	.sapFShellBarHomeIcon {
		max-height: 2rem;
		padding: 0.25rem;
		overflow-clip-margin: border-box;

		&:hover {
			background: @sapUiShellHoverBackground;
			box-shadow: @sapUiContentInteractionShadow;
			border-radius: 0.5rem;
		}

		&:focus {
			outline-offset: -0.125rem;
		}
	}

	//Second Title
	.sapFShellBarSecondTitle {
		font-size: @sapMFontSmallSize;
		color: @sapUiShellTextColor;
		text-overflow: ellipsis;
	}

	// Search
	.sapFShellBarSearch {
		max-width: 35rem; // max width of searchField + button width

		.sapMSF {
			max-width: 35rem;
		}

		// Reflection: styles overwritten
		.sapMBtn:not(.sapFShellBarSearchCancelButton) {
			width: 1.75rem;
			height: 1.75rem;
			line-height: 1.75rem;
			padding: 0;
			margin-top: auto;
			margin-bottom: auto;
			margin-left: 0.25rem;
			position: absolute;
			right: 0;
			top: 0;
			bottom: 0;
			.sapMBtnInner {
				min-width: 1.75rem;
				border-radius: 1.125rem;
				color: @sapUiButtonEmphasizedTextColor;
				.sapMBtnIcon {
					width: 1.75rem;
					height: 1.75rem;
					line-height: 1.75rem;
				}
			}
		}

		.sapMSFVal + .sapMBtn .sapMBtnInner {
			background-color: @sapUiButtonEmphasizedBackground;

			.sapMBtnIcon {
				color: @sapUiButtonEmphasizedTextColor;
			}
		}
	}

	.sapFShellBarSearch.sapFShellBarSearchFullWidth .sapMBtn:not(.sapFShellBarSearchCancelButton) {
		right: 6rem;
	}

	.sapFShellBarSearch.sapFShellBarSearchFullWidth .sapFShellBarSearchWrap .sapMSFF .sapMSFB {
		margin-right: 1.75rem;
	}

	.sapFShellBarSearch.sapFShellBarSearchFullWidth .sapFShellBarSearchWrap {
		max-width: 35rem;
	}

	.sapFShellBarSearch.sapFShellBarSearchFullWidth .sapFShellBarSearchWrap .sapMSF.sapMSFVal form.sapMSFNS:not(.sapMSFReload) {
		padding-right: 0.5rem;
	}

	.sapFShellBarSearchWrap {
		position: relative;
		.sapMSFF {
			background: @sapUiFieldBackgroundStyle;
			background-color: @sapUiShellInteractiveBackground;
			box-shadow: @sapUiFieldShadow;
			border: none;
			color: @sapUiShellInteractiveTextColor;
			border-radius: 1.125rem;
			height: 2.25rem;

			.sapMSFB {
				width: 1.75rem;
				height: 1.75rem;
				line-height: 1.75rem;
				font-size: 1rem;
				text-align: center;
				margin-top: 0.25rem;
				margin-right: 2.25rem;
				padding: 0;
				right: 0;
				top: 0;
			}

			.sapMSFB:hover {
				background: @sapUiShellHoverBackground;
				box-shadow: @sapUiContentInteractionShadow;
				border-radius: 1.125rem;
				height: 1.75rem;
				color: @sapUiShellInteractiveTextColor;
			}

			.sapMSFB:active,
			.sapMSFB.sapMSFBA {
				background: @sapUiShellActiveBackground;
				box-shadow: @sapUiContentSelectedShadow;
				border-radius: 1.125rem;
				color: @sapUiShellActiveTextColor;
			}
		}

		.sapMSF {
			max-width: 35rem;
			margin-right: 0;
		}

		.sapMSF:not(.sapMSFVal) form.sapMSFNS:not(.sapMSFReload) {
			padding-right: 0.5rem;
		}

		.sapMSF:not(.sapMSFDisabled):hover .sapMSFF {
			background-color: @sapUiShellHoverBackground;
			box-shadow: @sapUiFieldHoverShadow;
		}

		.sapMSFI {
			color: @sapUiFieldPlaceholderTextColor;
			font-weight: italic;
		}

		// sap.m.Button
		// Reflection: styles overwritten
		.sapMBtn:not(.sapFShellBarSearchCancelButton) {
			height: 2.25rem;
			line-height: 2.25rem;
			width: 1.75rem;
			padding: 0.250rem 0;
			margin-right: 0.25rem;
			.sapMBtnInner {
				height: 1.75rem;
				min-width: 1.75rem;
				border-radius: 1.125rem;
			}
			.sapMBtnInner.sapMBtnText {
				padding-left: 0.625rem;
				padding-right: 0.625rem;
			}

			.sapMBtnIcon {
				width: 1.75rem;
				font-size: 1rem;
				line-height: 1.75rem;
				max-height: 1.75rem;
				margin: 0;
				padding: 0;
			}
		}
		.sapMSF {
			margin-right: 0;
		}
	}
}

// Overriding styles comming from other controls
html.sap-desktop .sapFShellBarSearchWrap .sapMBtn:not(.sapFShellBarSearchCancelButton):focus > .sapMFocusable:not(.sapMBadgeIndicator):before {
	border-radius: 1.125rem;
}

html.sap-desktop .sapMOverflowToolbarMenu-CTX .sapFShellBarSearchWrap .sapMBtn:not(.sapFShellBarSearchCancelButton):focus > .sapMFocusable:not(.sapMBadgeIndicator):before {
	border-radius: 0.375rem;
}

// Resets of sizes for "Compact" mode - controls should remain in cozy mode
.alwaysCozyOverrideByParent(@controlClass) {
	.sapUiSizeCompact {
		.@{controlClass} {
			height: 3.25rem;

			&.sapMPageHeader .sapMIBar,
			.sapMIBar {
				height: 3.25rem;
			}

			// Reflection: styles overwritten
			// sap.m.MegaMenu
			.sapFSHMegaMenu {
				height: 2.75rem;
			}

			// Reflection: styles overwritten
			// sap.m.Button
			.sapMBtn {
				height: 2.75rem;
				padding: 0.250rem 0;
			}

			.sapMBtnInner {
				height: 2.25rem;
				min-width: 2.25rem;
			}

			.sapMBtnInner.sapMBtnText {
				padding-left: 0.625rem;
				padding-right: 0.625rem;
			}

			.sapMBtnContent {
				line-height: 2.125rem;
			}

			.sapMBtnIcon {
				width: 2.125rem;
				font-size: 1rem;
				line-height: 2.125rem;
				max-height: 2.375rem;
				margin: 0;
				padding: 0;
			}
			.sapMBtnIconLeft + .sapMBtnIconLeft {
				left: 0;
			}
			.sapMBtnText {
				.sapMBtnIconLeft + .sapMBtnIconLeft {
					left: 2.875rem;
				}
			}
			.sapMBtnInner > img {
				width: 2.5rem;
				margin-top: 0.2rem;
				margin-left: 0.2rem;
			}

		  	html.sap-desktop & .sapMTB-Transparent-CTX .sapMBtnInner.sapMToggleBtnPressed, .sapMTB-Transparent-CTX .sapMBtnInner.sapMToggleBtnPressed:not(.sapMBtnDisabled) {
				background-color: @sapUiShellActiveBackground;
			}

			// sap.m.MenuButton
			// Reflection: styles overwritten
			.sapMMenuBtn.sapMMenuBtnRegular .sapMBtnInner::after {
				height: 38px; //ie does not accept rem for height in pseudo elements, but it works with px when you zoom
				line-height: 2.2rem;
				padding-right: 0.75rem;
				padding-left: 0.5625rem;
			}
			.sapMMenuBtn.sapMMenuBtnRegular .sapMBtnInner:not(.sapMBtnText) {
				padding-right: 1.625rem;
			}
			.sapMMenuBtn.sapMMenuBtnRegular .sapMBtnInner {
				padding-right: 2rem;
			}
			.sapMMenuBtn .sapMBtnIconFirst .sapMBtnIcon {
				padding-right: 0.75rem;
			}

			// Reflection: styles overwritten
			// sap.m.SearchField
			.sapFShellBarSearch {
				max-width: 35rem;
				.sapMSF {
					max-width: 35rem;
				}

				.sapMBtn:not(.sapFShellBarSearchCancelButton) {
					width: 1.75rem;
					height: 1.75rem;
					line-height: 1.75rem;
					padding: 0;
					margin-top: auto;
					margin-bottom: auto;
					margin-left: 0.25rem;
					position: absolute;
					top: 0;
					bottom: 0;
					.sapMBtnInner {
						min-width: 1.75rem;
						border-radius: 1.125rem;
						.sapMBtnIcon {
							width: 1.75rem;
							height: 1.75rem;
							line-height: 1.75rem;
						}
					}
				}
			}

			.sapFShellBarSearch.sapFShellBarSearchFullWidth .sapMBtn:not(.sapFShellBarSearchCancelButton) {
				right: 6rem;
			}

			.sapFShellBarSearch.sapFShellBarSearchFullWidth .sapFShellBarSearchWrap .sapMSFF .sapMSFB {
				margin-right: 1.75rem;
			}

			.sapFShellBarSearch.sapFShellBarSearchFullWidth .sapFShellBarSearchWrap {
				max-width: 35rem;
			}

			.sapFShellBarSearchWrap {
				// sap.m.Button
				// Reflection: styles overwritten
				.sapMBtn:not(.sapFShellBarSearchCancelButton) {
					height: 2.25rem;
					line-height: 2.25rem;
					width: 1.75rem;
					padding: 0.250rem 0;
					margin-right: 0.25rem;
					.sapMBtnInner {
						height: 1.75rem;
						min-width: 1.75rem;
						border-radius: 1.125rem;
					}
					.sapMBtnInner.sapMBtnText {
						padding-left: 0.625rem;
						padding-right: 0.625rem;
					}

					.sapMBtnIcon {
						width: 1.75rem;
						font-size: 1rem;
						line-height: 1.75rem;
						max-height: 1.75rem;
						margin: 0;
						padding: 0;
					}
				}
				.sapMSF {
					margin-right: 0;
				}
			}
			.sapMSF {
				min-width: 7rem;
				height: 2.75rem;
				padding: 0.25rem 0;
				.sapMSFI {
					height: 2.125rem
				}
				.sapMSFF {
					height: 2.25rem;
					line-height: 2.125rem;
					padding-left: 0.625rem;
				}
				.sapMSFR:not(.sapMSFNS) {
					right: 2.375rem;
				}
				.sapMSFB {
					width: 1.75rem;
					height: 1.75rem;
					line-height: 1.75rem;
					font-size: 1rem;
					margin-top: 0.25rem;
					margin-right: 0.25rem;
					padding: 0;
					right: 0;
					top: 0;
				}
				.sapMSFB:hover {
					height: 1.75rem;
				}
			}
			// sap.m.Select
			// Reflection: styles overwritten
			.sapMSlt {
				height: 2.5rem;
				.sapMSltArrow {
					line-height: 2.5rem;
					width: 2.5rem;
				}
				.sapMSltLabel {
					line-height: 2.375rem;
					padding: 0 3rem 0 0.625rem;
				}
				.sapMSelectListItem {
					line-height: 2.5rem;
				}
				.sapMSelectListItemBase {
					height: 2.5rem;
				}
			}
		}
	}
}

// Resets all the styles of controls to align with the dark fiori 3 theme
.alwaysDarkModeOverrideByParent(@controlClass) {
	.@{controlClass} {

		// sap.m.Button
		.sapFShellBarItem.sapMBtn,
		.sapFShellBarItem:not(.sapFSHMegaMenu ) .sapMBtn,
		.sapMTB-Transparent-CTX .sapFShellBarItem.sapMBtn,
		.sapMTB-Transparent-CTX .sapFShellBarItem .sapMBtn {
			.sapMBtnInner::after,
			.sapMBtnIcon {
				background: transparent;
				color: @sapUiShellInteractiveTextColor;
			}
			.sapMBtnContent
			{
				background: transparent;
				color: @sapUiShellTextColor;
			}
			&:not(.sapMBtnDisabled) > span.sapMBtnInner.sapMBtnActive {
				background: @sapUiShellActiveBackground;
				border-color: @sapUiShellActiveBackground;
			}
			&:hover:not(.sapMBtnDisabled) {
				>span.sapMBtnInner.sapMBtnHoverable:not(.sapMToggleBtnPressed) {
					&:not(.sapMBtnActive) {
						background: @sapUiShellHoverBackground;
					}
					&.sapMBtnActive,
					&.sapMBtnActive .sapMBtnContent,
					&.sapMBtnActive .sapMBtnContent bdi {
						background: @sapUiShellActiveBackground;
						color: @sapUiShellActiveTextColor;
						border: 1px solid @sapUiButtonLiteActiveBorderColor;
					}
					&.sapMBtnActive:after,
					&.sapMBtnActive >.sapMBtnIcon {
						color: @sapUiShellActiveTextColor;
					}
					&:after,
					>.sapMBtnIcon {
						color: @sapUiShellInteractiveTextColor;
					}
					>.sapMBtnContent,
					>.sapMBtnContent bdi
					{
						color: @sapUiShellTextColor;
					}

				}
				&.sapFShellBarSearchCancelButton:hover:not(.sapMBtnDisabled) > span.sapMBtnInner.sapMBtnHoverable:not(.sapMToggleBtnPressed) {
					&.sapMBtnActive .sapMBtnContent,
					&.sapMBtnActive .sapMBtnContent bdi {
						border: none;
					}
				}
				&.sapMToggleBtnPressed {
					background: @sapUiShellActiveBackground;
					border-color: @sapUiShellActiveBackground;
				}
				&:active {
					>.sapMBtnContent,
					>.sapMBtnInner,
					>.sapMBtnIcon {
						color: @sapUiShellTextColor;
					}
				}
			}

			&:disabled {
				opacity: 0.4;
			}
		}

		.sapMBtnBase.sapMBtn.sapFShellBarItem.sapMBarChild:hover {
			.sapMBtnInner.sapMBtnHoverable.sapMFocusable.sapMBtnIconFirst{
				background: @sapUiShellHoverBackground;
			}
		}

		//sap.m.Label
		.sapMTB > .sapMLabel {
			color: @sapUiShellTextColor;
		}

		//sap.m.SearchField
		.sapMSF {

			&.sapMSFDisabled {
				opacity: 0.4;
			}

		}

		// sap.m.Select
		.sapMSlt {
			background-color: transparent;
			border-color: lighten(@sapUiShellBorderColor,  30);
			color: @sapUiShellTextColor;
			&.sapMSltHoverable:not(.sapMSltState):not(.sapMSltIconOnly):hover {
				background-color: transparent;
				border-color: lighten(@sapUiShellBorderColor,  30);
				color: @sapUiShellTextColor;
				.sapMSltArrow {
					background-color: transparent;
					&:hover {
						background: @sapUiShellHoverBackground;
					}
				}
			}
			&.sapMSltPressed:not(.sapMSltDisabled):not(.sapMSltState) {
				border-color:lighten(@sapUiShellBorderColor,  30);
			}
			.sapMSltLabel {
				color: @sapUiShellTextColor;
				&:hover {
					background-color: @sapUiShellHoverBackground;
					&>.sapMSltArrow {
						background: @sapUiShellHoverBackground;
					}
				}
			}
			.sapMSltArrow {
				background-color: transparent;
				color: @sapUiShellInteractiveTextColor;
				&:hover {
					background: @sapUiShellHoverBackground;
				}
				&:active {
					background: @sapUiShellActiveBackground;
					color: @sapUiShellActiveTextColor;
				}
			}
			&.sapMSltDisabled {
				opacity: 0.4;
			}
		}
	}
}
