/* ============================= */
/* CSS for control sap.m/Dialog  */
/* Base theme                    */
/* ============================= */

@_sap_m_Dialog_MarginHeight: 7%;
@_sap_m_Dialog_BarHeight: 3rem;
@_sap_m_Dialog_BarCompactHeight: 2.5rem;
@_sap_m_Dialog_Padding: 1rem;

.sapMDialog,
.sapMMessageDialog .sapMDialogScrollCont,
.sapMDialogSection {
	box-sizing: border-box;
}

.sapMDialog {
	// scale(1) - Chrome does not clip children when transform is not applied resulting in non-visible border-radius
	// translateZ(0px) - Safari Problem with z-index - After dialog was opened it was inserted behind the dark overlay
	-webkit-transform: scale(1) translateZ(0px);
	background-clip: padding-box;
	min-height: 6rem;
	outline: none;
	overflow: hidden;
	position: fixed !important;
	opacity: 0;
	-webkit-transition: opacity .15s, left 0.2s, top 0.2s;
	transition: opacity .15s, left 0.2s, top 0.2s;
	border-radius: 0.25rem;
	box-shadow: @sapUiShadowLevel3;

	&:not(.sapMDialogHighPixelDensity) {
		//prevent blurring when the device pixel ration is 1 (not high density screens)
		//this is done with style and not with media query for wider support
		-webkit-filter: blur(0);
		filter: blur(0);
	}
}

// set max height and max width ========================================================================================

.sapMDialog {
	max-width: 90%;
}

.sapMDialog > .sapMDialogSection {
	max-width: 100%;
}

// =====================================================================================================================
// there are 6 cases (3 vars - header, subheader, and footer)
// =====================================================================================================================

.setDialogMaxHeight(@_barHeight, @_path) {

	//with header, subheader and footer (3 bars)
	@{_path}.sapMDialogWithSubHeader:not(.sapMDialog-NoHeader):not(.sapMDialog-NoFooter) {
		max-height: calc(~"100% - " @_barHeight * 3 ~" - " @_sap_m_Dialog_MarginHeight);
	}

	//with header, no subheader and footer (2 bars)
	@{_path}:not(.sapMDialog-NoHeader):not(.sapMDialog-NoFooter):not(.sapMDialogWithSubHeader) {
		max-height: calc(~"100% - " @_barHeight * 2 ~" - " @_sap_m_Dialog_MarginHeight);
	}

	//with no headers and footer (1 bar)
	@{_path}.sapMDialog-NoHeader:not(.sapMDialog-NoFooter):not(.sapMDialogWithSubHeader) {
			max-height: calc(~"100% - " @_barHeight ~" - " @_sap_m_Dialog_MarginHeight);
	}

	//with 2 headers with no footer (2 bars)
	@{_path}:not(.sapMDialog-NoHeader).sapMDialog-NoFooter.sapMDialogWithSubHeader {
		max-height: calc(~"100% - " @_barHeight ~" - " @_sap_m_Dialog_MarginHeight);
	}

	//with 1 sub-header and no footer (1 bar)
	@{_path}.sapMDialog-NoHeader.sapMDialog-NoFooter.sapMDialogWithSubHeader {
		max-height: calc(~"100% - " @_barHeight ~" - " @_sap_m_Dialog_MarginHeight);
	}

	//with header, no sub-header and no footer (1 bar)
	@{_path}:not(.sapMDialog-NoHeader).sapMDialog-NoFooter:not(.sapMDialogWithSubHeader) {
		max-height: calc(~"100% - " @_barHeight ~" - " @_sap_m_Dialog_MarginHeight);
	}

	//with no headers and no footer (0 bars)
	@{_path}.sapMDialog-NoHeader.sapMDialog-NoFooter:not(.sapMDialogWithSubHeader) {
		max-height: calc(~"100% - " @_barHeight);
	}
}

.setDialogMaxHeight(@_sap_m_Dialog_BarHeight, ~".sapMDialog");
.setDialogMaxHeight(@_sap_m_Dialog_BarCompactHeight, ~".sapUiSizeCompact .sapMDialog");


// end max height and max width ========================================================================================

.sapMDialog .sapMDialogScrollCont > * {
	vertical-align: middle;
}

.sapMDialog.sapMDialogStretched {
	top: 5% !important; //this is for preventing inline size/top sizes set the top
	bottom: 5% !important;
	left: 3.5% !important; //this is for preventing inline size/top sizes set the top
	right: 3.5% !important;
	max-height: none !important;
	max-width: none !important;
	height: auto !important; //this is for preventing inline size/width sizes set the width
	width: auto !important; //this is for preventing inline size/height sizes set the height
	min-width: 0 !important; //this is for preventing the dialog to hold it's width in small screens
	min-height: 0 !important; //this is for preventing the dialog to hold it's width in small screens
}

// Removing borders, shadow, and rounded corners when the dialog is on fullscreen
html.sap-phone .sapMDialog.sapMDialogStretched {
	border: none;
	box-shadow: 0;
	border-radius: 0;
	top: 0 !important; // this is for forcing mobile dialog when stretch property is set
	bottom: 0 !important; // this is for forcing mobile dialog when stretch property is set
	left: 0 !important; // this is for forcing mobile dialog when stretch property is set
	right: 0 !important; // this is for forcing mobile dialog when stretch property is set
}

html.sap-phone .sapMDialog {
	min-width: 18rem;
	overflow: hidden;

	& > footer .sapMFooter-CTX {
		display: -webkit-box; /* OLD - iOS 6-, Safari 3.1-6 */
		display: -webkit-flex; /* NEW - Chrome */
		display: flex;
		padding: 0 0.25rem;

		.sapMTBSpacer {
			display: none;
		}

		.sapMBtn {
			-webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
			-webkit-flex: 1; /* Chrome */
			flex: 1;
			min-width: 31%;
		}
	}
}
html.sap-desktop .sapMDialog {
	min-width: 20rem;
}

html.sap-tablet:not(.sap-combi) .sapMDialog {
    min-width: 10rem;
}

.sapMDialog .sapMIBar {
	position: relative;
	width: auto;
}

.sapMDialog .sapMDialogSection {
	overflow: hidden;
	position: relative;
}

.sapMDialogScroll {
	display: inline-block; /*this is for horizontal scrolling enablement */
	height: auto;
	width: 100%;
	vertical-align: middle;
}

.sapMDialog.sapMDialogVerticalScrollIncluded .sapMDialogScroll {
	width: auto;
}

/* disable scrolling automatically for sap.m.Page sap.m.NavContainer sap.m.ScrollingContainer inside Dialog */
.sapMDialogVerScrollDisabled .sapMDialogScroll {
	height: 100%;
}

/* disable scrolling automatically for sap.m.Page sap.m.NavContainer sap.m.ScrollingContainer inside Dialog */
.sapMDialogHorScrollDisabled .sapMDialogScroll {
	display: block;
	/* This div has position set to absolute when runs in android native browser with version less than 4.1. */
	/* Width needs to be set to 100% due to position absolute */
	width: 100%;
}

.sapMDialogHidden {
	/* display: none; */
	/* visibility need to be used instead of display none, because some control inside dialog may need to do calculation */
	visibility: hidden;
}

.sapMDialogBlockLayer {
	opacity: 0.6;
}

.sapMDialogTransparent {
	opacity: 0;
}

.sapUiPopupWithPadding .sapMDialogScrollCont {
	padding: @_sap_m_Dialog_Padding;
}

.sapUiPopupWithPadding .sapMDialogScrollCont.sapMDialogStretchContent {
	height: calc(~"100% - 2 * " @_sap_m_Dialog_Padding);
}

.sapMDialogScrollCont.sapMDialogStretchContent {
	height: 100%;
}

/* messagedialog always has content padding */
.sapMMessageDialog .sapMDialogScrollCont {
	box-sizing: border-box;
	padding: 1rem;
}

.sapMDialogWithScrollCont .sapMDialogScroll {
	/*
	  This property together with the position: absolute in sapMDialogScrollCont fixes the browser bug stated here:
	  http://stackoverflow.com/questions/8468066/child-inside-parent-with-min-height-100-not-inheriting-height
  */
	position: relative;
}
.sapUiPopupWithPadding.sapMDialogWithScrollCont .sapMDialogScrollCont {
	height: 100%;
}

.sapMDialogWithScrollCont .sapMDialogScrollCont {
	height: 100%;
	padding: 0;
	position: absolute;
	width: 100%;
}

.sapMActionSheetDialog .sapMDialogScrollCont {
	padding: 0; /* no content padding for action sheet */
}

.sapMDialogOpen {
	opacity: 1;
}

.sapMDialogBlockLayerAnimation {
	position: absolute;
	transition: opacity 0.2s linear;
	-webkit-transition: opacity 0.2s linear;
}

/* mixin call for creating container content padding classes (arguments: rootContainer, contentSelector) */
.sapUiContainerContentPadding(~".sapMDialog", ~"> section > .sapMDialogScroll > .sapMDialogScrollCont");

/* ====================================================== */

.sapMDialog.sapMMessageDialog {
	font-size: 0.875rem;
}

.sapMDialog > header.sapMDialogTitle,
.sapMDialog > header.sapMDialogSubHeader {
	font-size: 1rem;
}

.sapMDialog:not(.sapMDialogWithSubHeader) .sapMDialogSubHeader {
	display: none;
}

.sapMDialogIcon ~ .sapMDialogTitle {
	display: inline;
}

/* remove the branding color of bar in page when page is in dialog*/
.sapMDialog .sapMIBar.sapMPageHeader::before {
	border-top: none;
}

.sapMMessageDialog.sapMPopup-CTX > header.sapMDialogTitle {
	background-image: none;
	filter: none;
}

.sapMDialog > header.sapMDialogTitle .sapMTitle {
	color: @sapUiPageHeaderTextColor;
	margin: 0;
	vertical-align: middle;
}

.sapMDialog > header.sapMDialogTitle .sapMImg {
	height: 2.25rem;
	margin-right: 0.625rem;
	vertical-align: middle;
	width: 2.25rem;
}

.sapMDialog > header.sapMDialogTitle .sapMDialogIcon.sapUiIcon {
	font-size: 1.25rem;
	margin-right: 0.5rem;
	vertical-align: middle;
}

.sapMTB.sapMTBNoBorders {
	border-bottom: none;
}

.sapMDialog > footer {

	#dialogWithManyButtons-footer-overflowButton-inner {
		padding-left: 0;
	}

	#dialogWithManyButtons-footer-overflowButton-img {
		position: static;
	}
}

/* Compact size */
.sapUiSizeCompact {

	&.sapMDialog,
	.sapMDialog {
		min-height: @_sap_m_Dialog_BarCompactHeight;
		padding-bottom: @_sap_m_Dialog_BarCompactHeight;
		padding-top: @_sap_m_Dialog_BarCompactHeight;

		&.sapMDialogWithSubHeader {
			padding-top: @_sap_m_Dialog_BarCompactHeight + @_sap_m_Dialog_BarCompactHeight;

			&.sapMDialog-NoHeader {
				padding-top: @_sap_m_Dialog_BarCompactHeight;

				& > .sapMDialogSubHeader {
					top: 0;
				}
			}
		}

		& > .sapMDialogTitle {
			height: @_sap_m_Dialog_BarCompactHeight;

			.sapMHeader-CTX,
			.sapMSubHeader-CTX{
				height: @_sap_m_Dialog_BarCompactHeight;
				padding-top: 0.25rem;
				padding-bottom: 0.25rem;
				box-sizing: border-box;
			}
		}

		& > .sapMDialogSection {
			min-height: @_sap_m_Dialog_BarCompactHeight;
		}

		& > footer {
			height: @_sap_m_Dialog_BarCompactHeight;

			.sapMFooter-CTX {
				height: @_sap_m_Dialog_BarCompactHeight;
			}
		}

		& header.sapMDialogSubHeader {
			height: @_sap_m_Dialog_BarCompactHeight;
			top: @_sap_m_Dialog_BarCompactHeight;

			.sapMIBar {
				height: @_sap_m_Dialog_BarCompactHeight;
			}
		}
	}

	&.sapMDialog > header.sapMDialogTitle .sapMBarMiddle > .sapMBarPH > .sapMImg {
		&.sapMDialog > header.sapMDialogTitle .sapMBarMiddle > .sapMBarPH > .sapMImg,
		& .sapMDialog > header.sapMDialogTitle .sapMBarMiddle > .sapMBarPH > .sapMImg {
			height: 1.5rem;
			width: 1.5rem;
		}

		&.sapMDialog > header.sapMDialogTitle .sapMBarMiddle > .sapMBarPH > .sapUiIcon,
		& .sapMDialog > header.sapMDialogTitle .sapMBarMiddle > .sapMBarPH > .sapUiIcon {
			font-size: 1rem;
			height: 1.5rem;
			line-height: 1.5rem;
			width: 1rem;
		}

		&.sapMDialog > header:first-of-type .sapMHeader-CTX,
		&.sapMDialog > footer:last-of-type .sapMFooter-CTX,
		& .sapMDialog > header:first-of-type .sapMHeader-CTX,
		& .sapMDialog > footer:last-of-type .sapMFooter-CTX {
			height: 2.5rem;

			.sapMBarLeft,
			.sapMBarRight,
			.sapMBarPH {
				padding-bottom: 0.25rem;
				padding-top: 0.25rem;
			}
		}
	}
}

.sapMDialogResizing,
.sapMDialogResizing * {
	-moz-user-select: none;
	-webkit-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

.sapDialogDisableTransition {
	transition: none;
	-webkit-transition: none;
}

.sapMDialogResizeHandler {
	bottom: 0;
	cursor: se-resize;
	position: absolute;
	right: 0;
	width: .5rem;
	z-index: 2;
	line-height: 1rem;

	&:before {
		left: 0;
		position: relative;
		top: 0;
	}
}

.sapMDialog {
	box-sizing: content-box;
	min-height: @_sap_m_Dialog_BarHeight;
	padding-bottom: @_sap_m_Dialog_BarHeight;
	padding-top: @_sap_m_Dialog_BarHeight;

	&.sapMDialog-NoFooter {
		padding-bottom: 0;
	}

	&.sapMDialog-NoHeader {
		padding-top: 0;
	}

	&.sapMDialogWithSubHeader {
		padding-top: @_sap_m_Dialog_BarHeight + @_sap_m_Dialog_BarHeight;

		&.sapMDialog-NoHeader {
			padding-top: @_sap_m_Dialog_BarHeight;

			& > .sapMDialogSubHeader {
				top: 0;
			}
		}
	}

	& > .sapMDialogTitle {
		height: @_sap_m_Dialog_BarHeight;
		left: 0;
		position: absolute;
		right: 0;
		top: 0;
	}

	& > .sapMDialogSection {
		height: 100%;
		min-height: @_sap_m_Dialog_BarHeight;
	}

	& > footer {
		bottom: 0;
		height: @_sap_m_Dialog_BarHeight;
		left: 0;
		position: absolute;
		right: 0;
	}

	&.sapMDialogDraggable > header {
		cursor: move;
	}

	& header.sapMDialogSubHeader {
		cursor: default;
		height: @_sap_m_Dialog_BarHeight;
		left: 0;
		position: absolute;
		right: 0;
		top: @_sap_m_Dialog_BarHeight;
		z-index: 2;
	}
}

//remove transition when animation is off
html[data-sap-ui-animation='off'] {
	.sapMDialog,
	.sapMDialogBlockLayerAnimation {
		transition: none;
	}
}

.sapMDialog > .sapMDialogSection {
	background: @sapUiGroupContentBackground;
}

.sapMDialogWarning > header {
	&.sapMDialogTitle .sapMDialogIcon.sapUiIcon {
		color: @sapUiCriticalElement;
	}

	&:last-of-type .sapMIBar.sapMIBar { // .sapMIBar.sapMIBar - doubles the specificity in order to override other styles
		box-shadow: inset 0 -0.125rem @sapUiWarningBorder;
	}
}

.sapMDialogError > header {

	&.sapMDialogTitle .sapMDialogIcon.sapUiIcon {
		color: @sapUiNegativeElement;
	}

	&:last-of-type .sapMIBar.sapMIBar { // .sapMIBar.sapMIBar - doubles the specificity in order to override other styles
		box-shadow: inset 0 -0.125rem @sapUiErrorBorder;
	}
}

.sapMDialogSuccess > header {
	&.sapMDialogTitle .sapMDialogIcon.sapUiIcon {
		color: @sapUiPositiveElement;
	}

	&:last-of-type .sapMIBar.sapMIBar { // .sapMIBar.sapMIBar - doubles the specificity in order to override other styles
		box-shadow: inset 0 -0.125rem @sapUiSuccessBorder;
	}
}

.sapMDialogInformation > header {

	&.sapMDialogTitle .sapMDialogIcon.sapUiIcon {
		color: @sapHighlightColor;
	}

	&:last-of-type .sapMIBar.sapMIBar { // .sapMIBar.sapMIBar - doubles the specificity in order to override other styles
		box-shadow: inset 0 -0.125rem @sapHighlightColor;
	}
}