@import "@automattic/typography/styles/fonts";
@import "@automattic/onboarding/styles/mixins";
@import "@automattic/calypso-color-schemes";

$wpcom-modal-breakpoint: 600px;

$wpcom-modal-padding-v: 30px;
$wpcom-modal-padding-h: 25px;
$wpcom-modal-content-min-height: 420px;
$wpcom-modal-footer-padding-v: 20px;
$wpcom-modal-footer-height: 30px + ( $wpcom-modal-footer-padding-v * 2 );

// Core modal style overrides
.modal__main {
	&.components-modal__frame {
		overflow: visible;
		height: 50vh;
		top: calc(17.5vh - #{$wpcom-modal-footer-height * 0.5});
		min-height: $wpcom-modal-content-min-height;

		@media (max-width: $wpcom-modal-breakpoint) {
			width: 90vw;
			min-width: 90vw;
			left: 5vw;
			right: 5vw;
			height: auto;
			min-height: unset;
		}

		@media (min-width: $wpcom-modal-breakpoint) {
			width: 720px;
			height: $wpcom-modal-content-min-height;
			top: calc(50% - #{$wpcom-modal-footer-height * 0.5});
		}
	}

	// Colour scheme for Google Workspace sale JITM
	&.modal--google_workspace_engagement_customers {
		.modal__sidebar {
			background: var(--color-surface);
			margin-right: 20px;
		}

		.components-button:hover svg {
			fill: var(--color-neutral-20);
		}
	}

	.components-modal__header {
		display: flex;
		position: absolute;

		button.components-button {
			span {
				.components-popover.components-tooltip {
					left: unset !important;
					right: -48px;

					.components-popover__content {
						overflow: visible !important;
						max-width: unset !important;
					}
				}
			}
		}
	}

	.components-guide__container {
		margin-top: 0;
		min-height: unset;
	}

	.components-guide__footer {
		display: none;
	}

	.components-guide__page {
		@media (min-width: $wpcom-modal-breakpoint) {
			flex-direction: row;
		}
	}

	.components-guide__page-control {
		position: relative;
		height: 0;
		top: 100%;
		overflow: visible;
		margin: 0 auto;
		z-index: 2;

		&::before {
			display: inline-block;
			content: "";
			height: $wpcom-modal-footer-height;
			vertical-align: middle;
		}

		li {
			vertical-align: middle;
			margin-bottom: 0;
		}

		// Temporarily disable dots on mobile as alignment is wonky.
		display: none;
		@media (min-width: $wpcom-modal-breakpoint) {
			display: block;
		}
	}
}

.components-modal__screen-overlay {
	background-color: rgba(0, 0, 0, 0.7);
}

.modal__container {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	background: var(--studio-white);
	height: 100%;
	padding: 0 7%;

	:last-child {
		margin-bottom: 5%;
	}

	:first-child {
		margin-top: 13%;
	}

	@media (min-width: $wpcom-modal-breakpoint) {
		flex-direction: column;
		justify-content: flex-end;
		min-height: $wpcom-modal-content-min-height;
		bottom: 0;
		padding: 0 2% 0 7%;
	}
}

.modal__text,
.modal__visual {
	@media (min-width: $wpcom-modal-breakpoint) {
		flex: 1 auto;
	}
}

.modal__text {
	padding: 1em 0;
	margin: 0;
	font-family: $sans;
	font-size: $font-body-small;
	display: flex;
	flex-direction: column;

	button,
	a {
		margin-top: 13%;
		padding: 10px 24px;
	}

	.components-button {
		align-self: flex-start;
	}
}

.modal__disclaimer {
	margin: 0;
	font-size: calc(#{$font-body-extra-small} * 0.65);
	color: var(--color-text-subtle);

	@media (max-width: $wpcom-modal-breakpoint) {
		font-size: $font-body-extra-small;
	}
}

.modal__limited-offer {
	margin-bottom: 0.7rem;
	color: var(--studio-blue-40);
	font-size: calc(#{$font-body-extra-small} * 0.9);
	font-weight: bold;
	letter-spacing: 0.1rem;
}

.modal__visual {
	height: 40%;
	padding: 25px 25px 0;
	background: var(--color-primary);
	text-align: center;
	display: flex;
	flex-direction: column;
	flex: 1;

	@media (min-width: $wpcom-modal-breakpoint) {
		height: auto;
	}
}

.modal__heading {
	@include onboarding-font-recoleta;
	/* Gray / Gray 90 */
	color: var(--studio-gray-90);

	font-size: $font-title-medium;
	line-height: 1;

	@media (min-width: $wpcom-modal-breakpoint) {
		font-size: $font-headline-small;
	}

	// overflowing text
	body.locale-de & {
		font-size: $font-headline-small;

		@media (min-width: $wpcom-modal-breakpoint) {
			font-size: $font-title-medium;
		}
	}
}

.modal__sidebar {
	display: none;

	@media (min-width: $wpcom-modal-breakpoint) {
		display: block;
		background-color: var(--studio-blue-5);
		min-width: 45%;
		position: relative;
		overflow: hidden;
	}

	img {
		position: absolute;
	}

	img.modal__plans {
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
	}

	img.modal__embedded-inbox {
		left: 50%;
		width: 100%;
		bottom: 0;
		transform: translate(-50%, 0);
	}
}

.modal__description p {
	font-size: $font-body;
	line-height: 22px;
	margin: 10px 0;

	/* Gray / Gray 60 */
	color: var(--studio-gray-60);

	@media (min-width: $wpcom-modal-breakpoint) {
		font-size: $font-body;
		line-height: 26px;
	}
}
