/*!
 * Jodit Editor (https://xdsoft.net/jodit/)
 * Released under MIT see LICENSE.txt in the project root for license information.
 * Copyright (c) 2013-2024 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
 */

@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 rgb(158 158 158 / 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);
				border-radius: 50%;
				background-color: var(--image-editor-resizer-target-bg-color);
				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;
				margin: auto;
				background: rgb(255 255 255 / 30%);
				content: '';
				inset: 0;
			}

			.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;
					border-radius: 0.4em;
					background: rgb(0 0 0 / 20%);
					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;
		}
	}
}
