@use "@wordpress/base-styles/colors" as *;
@use "@wordpress/base-styles/variables" as *;
@use "@wordpress/base-styles/z-index" as *;
@use "../utils/theme-variables" as *;

.components-drop-zone {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: z-index(".components-drop-zone");
	visibility: hidden;
	opacity: 0;
	border-radius: $radius-small;

	&.is-active {
		opacity: 1;
		visibility: visible;
	}

	.components-drop-zone__content {
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		right: 0;
		height: 100%;
		width: 100%;
		display: flex;
		background-color: $components-color-accent;
		align-items: center;
		justify-content: center;
		z-index: z-index(".components-drop-zone__content");
		text-align: center;
		color: $white;
		opacity: 0;

		// Without this, when this div is shown,
		// Safari calls a onDropZoneLeave causing a loop because of this bug
		// https://bugs.webkit.org/show_bug.cgi?id=66547
		pointer-events: none;
	}

	.components-drop-zone__content-inner {
		opacity: 0;
		transform: scale(0.9);
	}

	&.is-active.is-dragging-over-element {
		.components-drop-zone__content {
			opacity: 1;

			@media not (prefers-reduced-motion) {
				transition: opacity 0.2s ease-in-out;
			}
		}

		.components-drop-zone__content-inner {
			opacity: 1;
			transform: scale(1);

			@media not (prefers-reduced-motion) {
				transition:
					opacity 0.1s ease-in-out 0.1s,
					transform 0.1s ease-in-out 0.1s;
			}
		}
	}
}

.components-drop-zone__content-icon,
.components-drop-zone__content-text {
	display: block;
}

.components-drop-zone__content-icon {
	margin: 0 auto $grid-unit-10;
	line-height: 0;
	fill: currentColor;
	pointer-events: none;
}

.components-drop-zone__content-text {
	font-family: $default-font;
	font-size: $default-font-size;
}
