$base-index: 99999 !default;

:is( .wp-block-themeisle-blocks-modal, .wp-block-themeisle-blocks-popup ) {
	--min-width: 400px;
	--background-color: #fff;
	--close-color: #000;
	--overlay-color: rgba(0, 0, 0, 0.5);
	--overlay-opacity: 1;
	--brd-width: 0px;
	--brd-radius: 0px;
	--brd-color: #000;
	--brd-style: solid;

	--width: 500px;
	--width-tablet: var(--width);
	--width-mobile: var(--width-tablet);

	--height: auto;
	--height-tablet: var(--height);
	--height-mobile: var(--height-tablet);

	--padding: 20px;
	--padding-tablet: var(--padding);
	--padding-mobile: var(--padding-tablet);
	--box-shadow: unset;

	&.has-dark-bg {
		color: #fff;
		--close-color: #fff;
	}

	&.is-front {
		display: none;
	}

	&.is-front.active {
		display: block;
	}

	&.is-selected {
		z-index: 10;
	}

	.otter-popup__modal_wrap_overlay {
		background-color: var(--overlay-color);
		opacity: var(--overlay-opacity);
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		position: absolute;
		z-index: $base-index - 1;
	}

	.otter-popup__modal_wrap {
		position: fixed;
		top: 0;
		bottom: 0;
		right: 0;
		left: 0;
		z-index: $base-index;
		display: flex;
		align-items: center;
		justify-content: center;

		animation-duration: .8s;
		animation-name: popupFadeIn;
		animation-fill-mode: both;
	}

	.otter-popup__modal_content {
		position: absolute;
		z-index: $base-index + 1;
		background-color: var(--background-color);
		width: var(--width);
		max-width: 100%;
		height: var(--height);
		padding: var(--padding);
		border-width: var(--brd-width);
		border-radius: var(--brd-radius);
		border-color: var(--brd-color);
		border-style: var(--brd-style);
		box-sizing: border-box;
		scroll-behavior: auto;
		box-shadow: var(--box-shadow);

		@media (min-width: 600px) and (max-width: 960px) {
			width: var(--width-tablet);
			height: var(--height-tablet);
			padding: var(--padding-tablet);
		}

		@media (max-width: 600px) {
			width: var(--width-mobile);
			height: var(--height-mobile);
			padding: var(--padding-mobile);
		}
	}

	.otter-popup__modal_body {
		-ms-overflow-style: none; /* IE and Edge */
		scrollbar-width: none; /* Firefox */
		max-height: 75vh;
		overflow: auto;
		height: 100%;
		min-height: 70px; // For Safari.

		@media (max-width: 600px) {
			padding-top: 20px;
		}

		&::-webkit-scrollbar {
			display: none;
		}
	}

	.otter-popup__modal_body > * {
		max-width: 100%;
	}

	.otter-popup__modal_header {
		position: absolute;
		right: var( --padding );

		@media (max-width: 600px) {
			padding-bottom: 0px;
		}

		button {
			background-color: transparent !important;
			color: var(--close-color);
			height: auto !important;
			display: flex;
			align-items: center;
			padding: 0 !important;
			border: none;
			cursor: pointer;
			z-index: 2;

			&:hover {
				opacity: .75;
			}

			&:focus {
				border: none !important;
				outline: none;
			}

			svg {
				fill: currentColor;
			}
		}
	}


	&.with-outside-button {
		.otter-popup__modal_header {
			position: initial;
			padding-bottom: 0px;

			button {
				position: absolute;
				top: -15px;
				right: -15px;
				background: var(--background-color) !important;
				border-radius: 60%;
				border: unset;
				box-shadow: 0 0 4px 0 rgba(0, 0, 0, .133), 0 0 3px 1px rgba(0, 0, 0, .067);
				height: 36px !important;
				width: 36px !important;
				display: flex;
				justify-content: center;
				align-items: center;
				z-index: 9;

				&:hover {
					box-shadow: 0 0 4px 0 rgba(0, 0, 0, .133), 0 0 3px 1px rgba(0, 0, 0, .067);
					opacity: 1;
				}
			}

			svg {
				width: 32px;
				height: 32px;
			}
		}
	}

	&> .block-editor-block-variation-picker .block-editor-block-variation-picker__variations .components-button {
		box-shadow: unset;
		margin-bottom: 0px;
	}
}

.o-lock-body {
	height: 100%;
	overflow-y: hidden;
}

body:has(#wpadminbar) {
	:is( .wp-block-themeisle-blocks-modal, .wp-block-themeisle-blocks-popup ) {
		.otter-popup__modal_content {
			margin-top: 25px;
		}
	}
}


@-webkit-keyframes popupFadeIn {
	0% {
		opacity:0
	}
	to {
		opacity:1
	}
}

.wp-block-themeisle-blocks-modal:not( .is-active ) {
    display: none;
}
