/*!
 * 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';
@import (reference) '../../styles/mixins';

.jodit-dialog {
	.font();

	&_moved_true {
		user-select: none;
	}

	position: absolute;
	display: none;
	width: 0;
	height: 0;
	box-sizing: border-box;
	border: 0;
	will-change: left, top, width, height;

	* {
		box-sizing: border-box;
	}

	.jodit_elfinder {
		&,
		& * {
			box-sizing: initial;
		}
	}

	&__overlay {
		position: fixed;
		z-index: var(--z-index-dialog-overlay);
		top: 0;
		left: 0;
		display: none;
		overflow: auto;
		width: 100%;
		height: 100%;
		background-color: rgb(0 0 0 / 50%);
		text-align: center;
		white-space: nowrap;
	}

	&_static_true &__overlay {
		display: none;
	}

	&_modal_true &__overlay {
		display: block;
	}

	&_active_true {
		display: block;
	}

	&__panel {
		position: fixed;
		z-index: var(--z-index-dialog);
		top: 0;
		left: 0;
		display: flex;
		min-width: 200px;
		max-width: 100%;
		min-height: 100px;
		max-height: 100%;
		flex-flow: column nowrap;
		background-color: #fff;

		--box-shadow-blur: calc(var(--padding-default) * 2);
		--box-shadow-1: 0 var(--padding-default) var(--box-shadow-blur)
			rgb(0 0 0 / 19%);

		box-shadow:
			var(--box-shadow-1),
			0 6px 6px rgb(0 0 0 / 23%);
		text-align: left;
		white-space: normal;
	}

	&:not(&_adaptive_false) &__panel {
		@media (max-width: @screen-xs) {
			top: 0 !important;
			left: 0 !important;
			width: 100% !important;
			max-width: 100%;
			height: 100% !important;
		}
	}

	&_static_true {
		position: relative;
		z-index: inherit;
		display: block;
		width: auto;
		height: auto;
		box-sizing: border-box;
	}

	&_static_true &__panel {
		position: relative;
		z-index: inherit;
		top: auto !important;
		left: auto !important;
		width: 100% !important;
		border: 1px solid var(--color-border);
		box-shadow: none;
	}

	&_theme_dark,
	&_theme_dark &__panel {
		background-color: var(--dark-background-darknes);
		color: var(--dark-text-color);
	}

	&__header {
		display: flex;
		min-height: 50px;
		justify-content: space-between;
		border-bottom: 1px solid var(--color-border);
		cursor: move;
		text-align: left;

		&-toolbar,
		&-title {
			display: flex;
			flex-shrink: 3;
			align-items: center;
			padding: 0 var(--padding-default);
			margin: 0;
			font-size: 18px;
			font-weight: 400;
			line-height: 48px;
			vertical-align: top;
		}

		&-toolbar {
			@media (max-width: @screen-xs) {
				padding-left: 0;
			}
		}

		&-button {
			height: 48px;
			flex-basis: 48px;
			color: #222;
			font-size: 28px;
			line-height: 48px;
			text-align: center;
			text-decoration: none;
			transition: background-color 0.2s ease 0s;

			&:hover {
				background-color: var(--color-background-button-hover);
			}
		}

		.jodit_toolbar {
			border: 0;
			background: transparent;
			box-shadow: none;

			> li.jodit-toolbar-button {
				.jodit-input {
					width: auto;
					padding-left: var(--padding-default);
				}
			}
		}
	}

	&:not(&_adaptive_false) &__header {
		@media (max-width: @screen-xs) {
			flex-direction: column;
		}
	}

	&_slim_true &__header {
		min-height: 10px;

		&-toolbar,
		&-title {
			padding: 0 calc(var(--padding-default) / 4);
		}
	}

	&_theme_dark &__header {
		border-color: var(--color-dark);
	}

	&_fullsize_true &__header {
		cursor: default;
	}

	&__content {
		overflow: auto;
		min-height: 100px;
		flex: 1;

		.jodit-form__group {
			padding: 0 var(--padding-default);
			margin-bottom: calc(var(--padding-default) * 1.5);

			&:first-child {
				margin-top: var(--padding-default);
			}

			.jodit-input_group {
				display: table;
				width: 100%;
				border-collapse: separate;

				> * {
					display: table-cell;
					height: 34px;
					vertical-align: middle;
				}

				> input {
					margin: 0 !important;

					&:not([class*='col-']) {
						width: 100%;
					}
				}

				&-buttons {
					width: 1%;
					font-size: 0;
					vertical-align: middle;
					white-space: nowrap;

					> .jodit-button {
						height: 34px;
						border: 1px solid var(--color-border);
						border-radius: 0;
						margin-left: -1px;
						line-height: 34px;
					}
				}
			}
		}
	}

	&__footer {
		display: none;
		flex-wrap: nowrap;
		justify-content: space-between;
		padding: var(--padding-default);

		button {
			margin-right: calc(var(--padding-default) / 2);

			&:last-child {
				margin-right: 0;
			}
		}
	}

	&__column {
		display: flex;
	}

	&__resizer {
		display: none;
		.resize-handle();
	}

	&_resizable_true &__resizer {
		display: block;
	}

	@media (max-width: @screen-xs) {
		&__resizer {
			display: none;
		}
	}

	&_prompt {
		min-width: 200px;
		max-width: 300px;
		padding: var(--padding-default);
		word-break: break-all;

		label {
			display: block;
			margin-bottom: calc(var(--padding-default) / 2);
		}
	}

	&_alert {
		min-width: 200px;
		max-width: 300px;
		padding: var(--padding-default);
		word-break: break-all;
	}

	.jodit-dialog_footer_true &__footer {
		display: flex;
	}
}

.jodit_fullsize .jodit-dialog__panel {
	width: 100% !important;
	height: 100% !important;
	inset: 0 !important;

	.jodit-dialog__resizer {
		display: none;
	}
}

// stylelint-disable-next-line
.jodit-dialog {
	.jodit-ui-messages {
		z-index: var(--z-index-dialog);
	}
}
