/*!
 * 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';
@import (reference) 'jodit/core/ui/button/button/button';

:root {
	--button-trigger-size: @icon-middle-size;
}

.trigger-size(@size) {
	width: calc(var(--button-trigger-size, @size) + 2px);

	svg {
		width: calc(var(--button-trigger-size, @size) - 4px);
	}
}

.jodit-toolbar-button {
	display: flex;
	overflow: hidden;
	align-items: center;
	justify-content: center;
	border: 1px solid transparent;
	border-radius: var(--border-radius-default);

	.jodit-ui-button-icon-text();

	&__icon:empty + &__text:not(:empty) {
		padding: 0;
	}

	.jodit-ui-button-sizes();

	&__button {
		.jodit-ui-button-interaction();
		.jodit-ui-button_clear();
		.jodit-ui-button-style();
	}

	&__trigger {
		display: flex;
		height: 100%;
		align-items: center;
		justify-content: center;
		border-radius: 0 var(--border-radius-default)
			var(--border-radius-default) 0;
		opacity: 0.4;

		.jodit-ui-button-interaction();

		--button-trigger-size: @icon-middle-size;
		.trigger-size(@icon-middle-size);
	}

	&_size_tiny &__trigger {
		--button-trigger-size: @icon-tiny-size;
		.trigger-size(@icon-tiny-size);
	}

	&_size_xsmall &__trigger {
		--button-trigger-size: @icon-xsmall-size;
		.trigger-size(@icon-xsmall-size);
	}

	&_size_small &__trigger {
		--button-trigger-size: @icon-small-size;
		.trigger-size(@icon-small-size);
	}

	&_size_large &__trigger {
		--button-trigger-size: @icon-large-size;
		.trigger-size(@icon-large-size);
	}

	&_with-trigger_true {
		.jodit-toolbar-button__button {
			border-radius: var(--border-radius-default) 0 0
				var(--border-radius-default);
		}

		&:hover:not([disabled]) {
			border-color: var(--color-border);
		}
	}

	&_stroke_false svg {
		stroke: none;
	}
}
