.wysiwyg-root {
	position: relative;
	width: 100%;
}

.wysiwyg-box {
	position: relative;
	border: 1px solid #dedede;
	border-radius: 4px;
	background: #fff;
	min-height: 200px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.wysiwyg-box.vertical-resize {
	/* The box owns vertical resize. Inner editor MUST NOT have its own overflow, otherwise
	   its scrollbar sits in the same bottom-right corner as the browser-drawn resize handle
	   and steals the mousedown. */
	resize: vertical;
	min-height: 200px;
	overflow: auto;
}

.wysiwyg-toolbar {
	display: flex;
	flex-wrap: wrap;
	padding: 4px 2px;
	background: #f7f7f7;
	border-bottom: 1px solid #dedede;
	gap: 2px;
	user-select: none;
}

.wysiwyg-btn-group {
	display: inline-flex;
	border-right: 1px solid #e0e0e0;
	padding: 0 4px;
}

.wysiwyg-btn-group:last-child {
	border-right: none;
}

.wysiwyg-btn-wrap {
	position: relative;
	display: inline-flex;
}

.wysiwyg-btn {
	background: transparent;
	border: none;
	cursor: pointer;
	height: 32px;
	width: 32px;
	padding: 6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #222;
	border-radius: 3px;
	transition: background 0.1s ease;
}

.wysiwyg-btn:hover {
	background: #e9ecef;
}

.wysiwyg-btn-active {
	background: #d6e3f8;
	color: #1a4cad;
}

.wysiwyg-btn svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
	pointer-events: none;
}

.wysiwyg-has-dropdown::after {
	content: '';
	display: inline-block;
	border-left: 3px solid transparent;
	border-right: 3px solid transparent;
	border-top: 4px solid currentColor;
	margin-left: 2px;
	position: absolute;
	right: 1px;
	bottom: 4px;
}

.wysiwyg-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	background: #fff;
	border: 1px solid #dedede;
	border-radius: 4px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
	z-index: 1500;
	padding: 4px;
	min-width: 160px;
	max-width: 320px;
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
}

.wysiwyg-dropdown-fontsize,
.wysiwyg-dropdown-formatting,
.wysiwyg-dropdown-lineheight {
	flex-direction: column;
}

.wysiwyg-dropdown-fontsize .wysiwyg-dropdown-item,
.wysiwyg-dropdown-formatting .wysiwyg-dropdown-item,
.wysiwyg-dropdown-lineheight .wysiwyg-dropdown-item {
	width: 100%;
	text-align: left;
	padding: 4px 8px;
}

.wysiwyg-dropdown-foreColor,
.wysiwyg-dropdown-backColor {
	min-width: 220px;
	max-width: 240px;
}

.wysiwyg-dropdown-foreColor .wysiwyg-dropdown-item,
.wysiwyg-dropdown-backColor .wysiwyg-dropdown-item {
	width: 20px;
	height: 20px;
	padding: 0;
	border: 1px solid #dedede;
	font-size: 0;
}

.wysiwyg-dropdown-foreColor .wysiwyg-dropdown-item:first-child,
.wysiwyg-dropdown-foreColor .wysiwyg-dropdown-item:nth-child(2),
.wysiwyg-dropdown-backColor .wysiwyg-dropdown-item:first-child,
.wysiwyg-dropdown-backColor .wysiwyg-dropdown-item:nth-child(2) {
	width: 100%;
	height: auto;
	font-size: 13px;
	padding: 4px 8px;
	text-align: left;
}

.wysiwyg-dropdown-item {
	background: #fff;
	border: 1px solid transparent;
	cursor: pointer;
	font-size: 13px;
	color: #333;
	border-radius: 2px;
	white-space: nowrap;
}

.wysiwyg-dropdown-item:hover {
	background: #eef3fa;
}

.wysiwyg-editor {
	flex: 1 1 auto;
	min-height: 180px;
	padding: 12px 16px;
	outline: none;
	/* No overflow here on purpose — the .wysiwyg-box scrolls. If the editor scrolled,
	   its scrollbar would cover the box's resize:vertical handle in the bottom-right corner. */
	background: #fff;
	color: #222;
	font-family: inherit;
	line-height: 1.5;
	overflow-wrap: break-word;
}

.wysiwyg-editor:empty::before {
	content: attr(data-placeholder);
	color: #aaa;
}

.wysiwyg-editor p {
	margin: 0 0 0.6em 0;
}

.wysiwyg-editor blockquote {
	border-left: 4px solid #ccc;
	margin: 0 0 0.6em 0;
	padding: 0.2em 1em;
	color: #666;
}

.wysiwyg-editor pre {
	background: #f5f5f5;
	border: 1px solid #e0e0e0;
	border-radius: 3px;
	padding: 8px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	overflow: auto;
}

.wysiwyg-editor img {
	max-width: 100%;
	height: auto;
}

.wysiwyg-img-selected {
	outline: 2px solid #1a73e8 !important;
	outline-offset: 2px;
}

.wysiwyg-img-resize-handle {
	position: absolute;
	width: 14px;
	height: 14px;
	background: #1a73e8;
	border: 2px solid #fff;
	border-radius: 50%;
	cursor: nwse-resize;
	z-index: 50;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.wysiwyg-html-area {
	flex: 1 1 auto;
	min-height: 180px;
	padding: 12px 16px;
	border: none;
	background: #fafafa;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 13px;
	outline: none;
	resize: none;
	color: #222;
}

.wysiwyg-html-view .wysiwyg-editor {
	display: none;
}

.wysiwyg-fullscreen {
	position: fixed !important;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 10000;
	background: #fff;
}

.wysiwyg-fullscreen .wysiwyg-box {
	height: 100vh;
	max-height: 100vh;
	border-radius: 0;
}

body.wysiwyg-fullscreen-on {
	overflow: hidden;
}

.wysiwyg-modal-host {
	position: relative;
	z-index: 12000;
}

.wysiwyg-modal-form .form-group {
	margin-bottom: 1rem;
}

.wysiwyg-modal-form label {
	display: block;
	font-weight: 500;
	margin-bottom: 4px;
}

.wysiwyg-progress {
	width: 100%;
	height: 4px;
	background: #e9ecef;
	margin-top: 8px;
	border-radius: 2px;
	overflow: hidden;
}

.wysiwyg-progress-bar {
	height: 100%;
	background: #1a73e8;
	transition: width 100ms linear;
}

@media (max-width: 767px) {
	.wysiwyg-box {
		min-height: 150px;
	}
	.wysiwyg-editor,
	.wysiwyg-html-area {
		min-height: 140px;
	}
}
