@use 'sass:color';

span[id^='mq-answer'] {
	/*rtl:ignore*/
	direction: ltr;
	padding: 4px;
	border-radius: 4px !important;
	background-color: white;
	margin-right: 0;
	margin-left: 0;
}

input[type='text'].codeshard.mq-edit {
	display: none !important;
}

.mq-latex-editor-container {
	max-width: 100%;

	.mq-latex-editor-inner-container {
		display: inline-block;
		max-width: 100%;

		.mq-latex-editor-textarea-container {
			position: relative;

			// This is redundant for the textarea in a problem, but is needed for a latex editor that is not in a
			// problem (for instance the comment textareas for the problem graders).
			.latexentryfield {
				margin-bottom: 0;
				padding: 4px 6px;
				vertical-align: middle;
				font-weight: 400;
				line-height: 18px;
				font-family:
					Helvetica Neue,
					Helvetica,
					Arial,
					sans-serif;
			}

			.mq-latex-editor-backdrop-container {
				pointer-events: none;
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				overflow: auto;
				text-size-adjust: none;
				visibility: hidden;

				.mq-latex-editor-backdrop {
					border: 1px solid transparent;
					padding: 4px 6px;
					line-height: 18px;
					white-space: pre-wrap;
					word-wrap: break-word;
					font-family:
						Helvetica Neue,
						Helvetica,
						Arial,
						Helvetica,
						sans-serif;
					color: transparent;
					visibility: hidden;

					mark {
						visibility: hidden;
					}

					&.mq-latex-editor-backdrop-show {
						visibility: visible;

						.mq-latex-editor-selection {
							visibility: visible;
							padding: 0;
							color: white;
							background-color: color.adjust(#3373e5, $lightness: 20%);

							&:empty {
								border-left: 1px solid #b0b0b0;
							}
						}

						&.mq-latex-editor-backdrop-blink .mq-latex-editor-selection:empty {
							visibility: hidden;
						}
					}
				}
			}
		}

		.mq-editable-field {
			flex-grow: 1;
		}
	}
}

.quill-toolbar {
	position: absolute;
	font-size: 0.75em;
	/*rtl:ignore*/
	direction: ltr;
	display: flex;
	flex-direction: column;
	justify-content: start;
	box-sizing: border-box;
	border-radius: 4px;
	border: 2px solid darkgray;
	background-color: white;
	/*rtl:ignore*/
	right: 10px;
	z-index: 1001;
	overflow-x: hidden;
	overflow-y: auto;
	scrollbar-width: thin;
	opacity: 1;
	transition: opacity 500ms ease;

	.symbol-button {
		box-sizing: border-box;
		text-align: center;
		flex-shrink: 0;
		padding: 3px;
		margin: 2px;
		display: block;
		width: 45px;
		height: 45px;
		border-radius: 4px;
		background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
		box-shadow:
			inset 0 1px 0 rgba(255, 255, 255, 0.15),
			0 1px 1px rgba(0, 0, 0, 0.075);

		&:focus {
			z-index: 9999;
		}

		span[id^='icon-']:hover {
			cursor: pointer;
		}

		&:not([id^='text-mq-answer']) .mq-text-mode {
			height: 10px;
			width: 8px;
			transform: translateY(2px);
			background-color: skyblue !important;
		}

		.mq-nthroot,
		.mq-sup,
		.mq-sub {
			& > .mq-text-mode {
				height: 6px;
				width: 6px;
			}
		}

		.mq-sup > .mq-text-mode {
			transform: translateY(2px);
		}

		.mq-sub > .mq-text-mode {
			transform: translateY(0);
		}

		.mq-supsub {
			height: 6px;
			width: 6px;
			margin-left: 2px;
		}
	}
}
