.corso-rich-editor {
	border: 1px solid var(--bs-border-color);
	border-radius: 0.375rem;
	background: var(--bs-body-bg);
	overflow: hidden;
}

.corso-rich-editor:focus-within {
	border-color: rgba(var(--bs-primary-rgb), 0.65);
	box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

.corso-rich-editor-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem;
	padding: 0.4rem;
	border-bottom: 1px solid var(--bs-border-color);
	background: var(--bs-tertiary-bg);
}

.corso-rich-editor-toolbar .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
}

.corso-rich-editor-toolbar .material-symbols-outlined {
	font-size: 1.2rem;
}

.corso-rich-editor-format {
	width: auto;
	min-width: 8.5rem;
	height: 2.25rem;
	padding-top: 0.25rem;
	padding-bottom: 0.25rem;
}

.corso-rich-editor-content {
	min-height: 11rem;
	max-height: 32rem;
	overflow: auto;
	padding: 0.75rem;
	line-height: 1.5;
	outline: none;
	word-break: break-word;
}

.corso-rich-editor-content[contenteditable]:empty::before {
	content: attr(data-placeholder);
	color: var(--bs-secondary-color);
	pointer-events: none;
}

.corso-rich-editor-content table {
	width: 100%;
	border-collapse: collapse;
}

.corso-rich-editor-content th,
.corso-rich-editor-content td {
	border: 1px solid var(--bs-border-color);
	padding: 0.35rem;
}

.corso-rich-editor-content img,
.corso-rich-editor-content video,
.corso-rich-editor-content iframe {
	max-width: 100%;
	height: auto;
}

.corso-rich-editor-readonly .corso-rich-editor-content {
	background: var(--bs-secondary-bg);
}

@media (max-width: 575.98px) {
	.corso-rich-editor-format {
		width: 100%;
	}
}

/* Plain text keeps the native textarea, its rows, validity and form ownership. */
textarea.corso-rich-editor-plain {
    min-height: 0;
    width: 100%;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    resize: vertical;
}

textarea.corso-rich-editor-plain:focus {
    border-color: rgba(var(--bs-primary-rgb), 0.65);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.15);
}

textarea.corso-rich-editor-plain:read-only,
textarea.corso-rich-editor-plain:disabled {
    background-color: var(--bs-secondary-bg);
}

/* Keep the original HTML source in its form and native constraint validation. */
textarea.corso-rich-editor-source {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
}

.corso-rich-editor-invalid {
    border-color: var(--bs-form-invalid-border-color, #dc3545);
}

.corso-rich-editor-disabled {
    opacity: 0.75;
}
