/*
 * Rich Post Editor
 *
 * 1. How [spoiler], [member] and [mod] look in posts.
 * 2. The editor frame and toolbar. The layout rules are adapted from the default theme of
 *    SCEditor (C) Sam Clarke, MIT licence. Colours are kept neutral and translucent so the
 *    editor sits on light and dark board styles alike.
 */

/* ---------------------------------------------------------------------------------------
   1. Posts
   --------------------------------------------------------------------------------------- */

.richeditor-spoiler {
	margin: 0.6em 0;
	border: 1px dashed rgba(128, 128, 128, 0.6);
	border-radius: 4px;
	background: rgba(128, 128, 128, 0.06);
}

.richeditor-spoiler > summary {
	padding: 0.45em 0.8em;
	font-weight: bold;
	cursor: pointer;
	user-select: none;
}

.richeditor-spoiler > summary:hover,
.richeditor-spoiler > summary:focus-visible {
	background: rgba(128, 128, 128, 0.12);
}

.richeditor-spoiler[open] > summary {
	border-bottom: 1px dashed rgba(128, 128, 128, 0.6);
}

.richeditor-spoiler-body {
	padding: 0.6em 0.8em;
}

.richeditor-member {
	margin: 0.6em 0;
	padding: 0.5em 0.8em;
	border: 1px solid rgba(190, 120, 20, 0.5);
	border-left-width: 4px;
	border-radius: 4px;
	background: rgba(240, 170, 40, 0.1);
}

.richeditor-member-label {
	margin-bottom: 0.3em;
	font-size: 0.85em;
	font-weight: bold;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: #a35f00;
}

.richeditor-member-locked {
	font-style: italic;
	opacity: 0.85;
}

.richeditor-mod {
	margin: 0.6em 0;
	padding: 0.5em 0.8em;
	border: 1px solid rgba(190, 50, 50, 0.5);
	border-left-width: 4px;
	border-radius: 4px;
	background: rgba(220, 60, 60, 0.08);
}

.richeditor-mod-label {
	margin-bottom: 0.3em;
	font-size: 0.85em;
	font-weight: bold;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: #b02a2a;
}

/* ---------------------------------------------------------------------------------------
   2. Editor
   --------------------------------------------------------------------------------------- */

/* The board's own toolbar and colour palette make way for the editor's */
.richeditor-active #format-buttons,
.richeditor-active #colour_palette {
	display: none !important;
}

.richeditor-active #message-box textarea.richeditor-original {
	display: none;
}

.sceditor-container {
	display: flex;
	flex-direction: column;
	position: relative;
	box-sizing: border-box;
	width: 100% !important;
	max-width: 100%;
	height: 320px;
	min-height: 140px;
	background: #fff;
	color: #333;
	border: 1px solid rgba(128, 128, 128, 0.55);
	border-radius: 4px;
	font-family: Verdana, Helvetica, Arial, sans-serif;
	font-size: 13px;
	line-height: 1;
}

.sceditor-container:focus-within {
	border-color: rgba(60, 120, 190, 0.9);
	box-shadow: 0 0 0 2px rgba(60, 120, 190, 0.2);
}

.sceditor-container,
.sceditor-container div,
div.sceditor-dropdown,
div.sceditor-dropdown div {
	margin: 0;
	padding: 0;
	z-index: 3;
}

.sceditor-container iframe,
.sceditor-container textarea {
	display: block;
	flex: 1 1 0%;
	box-sizing: border-box;
	width: auto !important;
	height: auto !important;
	min-width: 0;
	min-height: 1px;
	max-width: none;
	margin: 5px;
	padding: 0;
	border: 0;
	outline: none;
	resize: none;
	background: transparent;
	color: inherit;
	font-family: Verdana, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.4;
}

.sceditor-container textarea {
	margin: 7px 9px;
	font-family: Monaco, "Andale Mono", "Courier New", Courier, monospace;
	font-size: 13px;
	box-shadow: none;
}

div.sceditor-resize-cover {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: #000;
	opacity: 0.2;
	z-index: 10;
}

div.sceditor-grip {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 12px;
	height: 12px;
	overflow: hidden;
	line-height: 0;
	cursor: ns-resize;
	opacity: 0.6;
}

div.sceditor-grip svg {
	width: 12px;
	height: 12px;
	fill: currentColor;
}

.sceditor-maximize {
	position: fixed;
	top: 0;
	left: 0;
	width: 100% !important;
	height: 100% !important;
	border-radius: 0;
	z-index: 2000;
}

html.sceditor-maximize,
body.sceditor-maximize {
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
}

.sceditor-maximize div.sceditor-grip {
	display: none;
}

/* Toolbar */

div.sceditor-toolbar {
	flex-shrink: 0;
	padding: 4px 5px 2px;
	background: rgba(128, 128, 128, 0.12);
	border-bottom: 1px solid rgba(128, 128, 128, 0.4);
	border-radius: 3px 3px 0 0;
	line-height: 0;
	text-align: left;
	user-select: none;
}

div.sceditor-group {
	display: inline-block;
	margin: 0 6px 2px 0;
	padding: 0 6px 0 0;
	border-right: 1px solid rgba(128, 128, 128, 0.35);
	vertical-align: top;
}

div.sceditor-group:last-child {
	margin-right: 0;
	padding-right: 0;
	border-right: 0;
}

.sceditor-button {
	display: block;
	float: left;
	width: 18px;
	height: 20px;
	padding: 4px 6px;
	border-radius: 3px;
	color: inherit;
	cursor: pointer;
}

.sceditor-button:hover,
.sceditor-button:focus,
.sceditor-button.active {
	background: rgba(128, 128, 128, 0.25);
	color: inherit;
	text-decoration: none;
}

.sceditor-button:active,
.sceditor-button.active {
	box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}

.sceditor-button.disabled,
.sceditor-button.disabled:hover {
	background: none;
	box-shadow: none;
	cursor: default;
	opacity: 0.35;
}

.sceditor-button svg {
	display: inline-block;
	width: 18px;
	height: 18px;
	margin: 1px 0;
	fill: currentColor;
	line-height: 1;
	pointer-events: none;
}

.sceditor-button div {
	display: none;
}

/* Drop-down panels */

div.sceditor-dropdown {
	position: absolute;
	padding: 10px;
	background: #fff;
	color: #333;
	border: 1px solid #bbb;
	border-radius: 4px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
	font-family: Verdana, Helvetica, Arial, sans-serif;
	font-size: 13px;
	font-weight: normal;
	line-height: 1.3;
	z-index: 4000;
}

div.sceditor-dropdown,
div.sceditor-dropdown * {
	box-sizing: border-box;
}

div.sceditor-dropdown a,
div.sceditor-dropdown a:link {
	color: #333;
	text-decoration: none;
}

div.sceditor-dropdown a:hover {
	background: #e9eef3;
}

div.sceditor-dropdown label {
	display: block;
	padding: 2px 0 4px;
	font-weight: bold;
	color: #3c3c3c;
}

div.sceditor-dropdown input[type="text"] {
	display: block;
	width: 16em;
	max-width: 70vw;
	margin: 0 0 0.75em;
	padding: 5px 6px;
	border: 1px solid #b5b5b5;
	border-radius: 3px;
	background: #fff;
	color: #222;
	font: inherit;
}

div.sceditor-dropdown input[type="text"]:focus {
	border-color: #3c78be;
	outline: 0;
}

div.sceditor-dropdown .button {
	display: inline-block;
	float: none;
	margin: 0;
	padding: 5px 14px;
	border: 1px solid #b5b5b5;
	border-radius: 3px;
	background: #ececec;
	color: #333;
	font: inherit;
	font-weight: bold;
	cursor: pointer;
}

div.sceditor-dropdown .button:hover {
	background: #f6f6f6;
}

div.sceditor-color-picker {
	padding: 4px;
}

.sceditor-color-column {
	float: left;
}

.sceditor-color-option {
	display: block;
	width: 18px;
	height: 18px;
	border: 2px solid #fff;
	overflow: hidden;
}

.sceditor-color-option:hover {
	border: 1px solid #888;
}

div.sceditor-emoticons,
div.sceditor-more-emoticons {
	max-width: 260px;
	padding: 6px;
}

.sceditor-emoticons img,
.sceditor-more-emoticons img {
	margin: 3px;
	padding: 0;
	cursor: pointer;
	vertical-align: middle;
}

.sceditor-more {
	display: block;
	margin-top: 4px;
	padding: 6px 0;
	border-top: 1px solid #ccc;
	text-align: center;
	font-weight: bold;
	cursor: pointer;
}

div.sceditor-richeditor-menu {
	min-width: 9em;
	max-height: 260px;
	padding: 4px 0;
	overflow-y: auto;
}

.richeditor-menu-item {
	display: block;
	padding: 6px 14px;
	white-space: nowrap;
	cursor: pointer;
}

/* Right-to-left boards */

.rtl div.sceditor-toolbar {
	text-align: right;
}

.rtl .sceditor-button {
	float: right;
}

.rtl div.sceditor-grip {
	right: auto;
	left: 0;
}

/* Small screens: keep buttons easy to hit */

@media (max-width: 700px) {
	.sceditor-button {
		padding: 6px 7px;
	}
}
