
@import (reference) '../../styles/variables';

:root {
	--image_editor_resizer_border_color: #05ff00;
	--image_editor_resizer_target_size: padding-default;
	--image_editor_resizer_target_border_color: #383838;
	--image_editor_resizer_target_bg_color: #8c7878;
}

.jodit-image-editor {
	overflow: hidden;

	width: 100%;
	height: 100%;

	@media (max-width: @screen-sm) {
		height: auto;
	}

	> div,
	> div > div {
		height: 100%;

		@media (max-width: @screen-sm) {
			height: auto;
			min-height: 200px;
		}
	}

	padding: var(--padding-default);

	* {
		box-sizing: border-box;
	}

	.jodit-image-editor__slider {
		&-title {
			padding: 0.8em 1em;
			border-bottom: 1px solid rgba(158, 158, 158, 0.31);
			background-color: #f9f9f9;
			color: rgb(51, 51, 51);
			cursor: pointer;
			font-weight: bold;
			line-height: 1em;
			text-overflow: ellipsis;
			text-shadow: rgb(243, 243, 243) 0 1px 0;
			user-select: none;
			white-space: nowrap;

			svg {
				display: inline-block;
				width: 16px;
				margin-right: var(--padding-default);
				vertical-align: middle;
			}
		}

		&-content {
			display: none;
		}

		&.jodit-image-editor_active .jodit-image-editor__slider-title {
			background-color: rgb(93, 93, 93);
			color: #fff;
			text-shadow: #000 0 1px 0;

			svg {
				fill: white;
			}
		}

		&.jodit-image-editor_active .jodit-image-editor__slider-content {
			display: block;
		}
	}

	&__area {
		position: relative;
		display: none;
		overflow: hidden;

		width: 100%;
		height: 100%;

		background-color: #eee;
		background-image: linear-gradient(
				45deg,
				var(--color-border) 25%,
				transparent 25%,
				transparent 75%,
				var(--color-border) 75%,
				var(--color-border)
			),
			linear-gradient(
				45deg,
				var(--color-border) 25%,
				transparent 25%,
				transparent 75%,
				var(--color-border) 75%,
				var(--color-border)
			);
		background-position: 0 0, 15px 15px;
		background-size: 30px 30px;
		user-select: none;

		&.jodit-image-editor_active {
			display: block;
		}

		.jodit-image-editor__box {
			position: relative;
			z-index: 1;
			overflow: hidden;
			height: 100%;
			pointer-events: none;

			img {
				max-width: 100%;
				max-height: 100%;
				user-select: none;
			}
		}

		.jodit-image-editor__croper,
		.jodit-image-editor__resizer {
			position: absolute;
			z-index: 2;
			top: var(--padding-default);
			left: 20px;
			width: 100px;
			height: 100px;
			border: 1px solid #fff;
			background-repeat: no-repeat;
			box-shadow: 0 0 11px #000;
			pointer-events: none;

			i.jodit_bottomright {
				position: absolute;
				z-index: 4;
				right: calc(var(--padding-default) * -1);
				bottom: calc(var(--padding-default) * -1);

				display: inline-block;
				width: 20px;
				height: 20px;

				border: 1px solid
					var(--image_editor_resizer_target_border_color);
				background-color: var(--image_editor_resizer_target_bg_color);
				border-radius: 50%;
				box-shadow: 0 0 11px #000;
				cursor: se-resize;
				pointer-events: all;

				&:active {
					border: 1px solid yellow;
				}
			}
		}
	}

	&__area.jodit-image-editor__area_crop {
		position: relative;
		height: 100%;
		background: #eee;
		line-height: 100%;
		text-align: center;

		.jodit-image-editor__box {
			overflow: visible;
			height: 100%;
			line-height: 100%;
			pointer-events: all;

			img {
				width: 100%;
				max-width: 100%;
				height: 100%;
				max-height: 100%;
			}

			text-align: left;

			&::after {
				position: absolute;
				z-index: 1;
				top: 0;
				right: 0;
				bottom: 0;
				left: 0;
				margin: auto;
				background: rgba(255, 255, 255, 0.3);
				content: '';
			}

			.jodit-image-editor__croper {
				cursor: move;
				pointer-events: all;

				i.jodit-image-editor__sizes {
					position: absolute;
					bottom: -30px;
					left: 100%;
					display: block;
					padding: 9px 6px;
					background: rgba(0, 0, 0, 0.2);
					border-radius: 0.4em;
					color: rgb(255, 255, 255);
					font-size: 12px;
					text-align: center;
					text-shadow: none;
					white-space: pre;
				}
			}
		}

		&.jodit-image-editor_active {
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}
}
