/* Rich text editor - see js/rte.js and func/rte.php.
 *
 * Every class is prefixed rte- because this loads on every CRM page next to
 * bootstrap, chosen, font-awesome and style.css. Nothing here is a bare
 * element selector for the same reason: .rte-content styles only what is
 * inside an editor or a rendered comment body.
 */

/* The upgraded textarea is hidden with a class, never an inline style: some of
 * the pages this loads on rewrite style="" wholesale (the .text_feed
 * auto-grow in projects.php does exactly that) and would un-hide it. */
.rte-hidden{display:none !important}

.rte-wrap{
	background:#fff;
	border:1px solid #cfd4d9;
	border-radius:5px;
	position:relative;
}
.rte-wrap.rte-focus{
	border-color:#2b7de9;
	box-shadow:0 0 0 2px rgba(43,125,233,.12);
}

/* ---------------- toolbar ---------------- */
.rte-toolbar{
	display:flex;
	align-items:center;
	flex-wrap:wrap;
	gap:1px;
	padding:4px 6px;
	border-bottom:1px solid #eceff1;
	background:#fbfcfd;
	border-radius:5px 5px 0 0;
}
.rte-tb{
	width:27px;height:27px;
	border:0;background:none;border-radius:3px;
	display:inline-flex;align-items:center;justify-content:center;
	cursor:pointer;color:#5f6368;padding:0;
	line-height:1;
}
.rte-tb:hover{background:#eef1f4;color:#3c4043}
.rte-tb.rte-on{background:#e3ecfb;color:#1a6fd8}
.rte-tb svg{pointer-events:none;display:block}
.rte-sep{width:1px;height:17px;background:#e3e6ea;margin:0 4px;flex:none}

/* ---------------- editing surface ---------------- */
.rte-editor{
	min-height:90px;
	max-height:460px;
	overflow-y:auto;
	padding:8px 12px;
	outline:none;
	font-size:14px;
	line-height:1.6;
	overflow-wrap:anywhere;
	word-break:break-word;
}
.rte-editor:empty:before{
	content:attr(data-ph);
	color:#9aa0a6;
	pointer-events:none;
}

/* Shared by the editor and by rendered comment bodies, so what you type is
 * what you see after posting. */
.rte-content table{border-collapse:collapse;margin:8px 0;max-width:100%}
.rte-content td,.rte-content th{border:1px solid #c9ced4;padding:4px 8px;min-width:50px}
.rte-content blockquote{
	margin:8px 0;padding:2px 12px;
	border-inline-start:3px solid #c9ced4;
	color:#5f6368;
}
.rte-content pre{
	background:#f1f3f4;padding:9px;border-radius:5px;
	font-family:Consolas,Monaco,monospace;font-size:13px;
	overflow:auto;white-space:pre-wrap;
}
.rte-content hr{border:0;border-top:1px solid #e3e6ea;margin:11px 0}
.rte-content a{color:#2b7de9;text-decoration:underline}
.rte-content ul,.rte-content ol{padding-inline-start:24px;margin:5px 0}
.rte-content img{max-width:100%;height:auto}
.rte-content h1{font-size:20px;margin:8px 0 4px}
.rte-content h2{font-size:17px;margin:8px 0 4px}
.rte-content h3{font-size:15px;margin:8px 0 4px}
.rte-content p{margin:0 0 6px}

/* Checklists. The box is drawn by the marker, so the list survives a round
 * trip through the sanitizer without needing an <input> in the whitelist. */
.rte-content ul[data-check]{list-style:none;padding-inline-start:4px}
.rte-content ul[data-check] li:before{content:"\2610 ";cursor:pointer}
.rte-content ul[data-check] li.done{text-decoration:line-through;color:#9aa0a6}
.rte-content ul[data-check] li.done:before{content:"\2611 "}

/* ---------------- bottom bar ---------------- */
.rte-bottom{
	display:flex;align-items:center;justify-content:space-between;
	gap:8px;flex-wrap:wrap;
	padding:5px 6px;
	border-top:1px solid #eceff1;
}
.rte-bl{display:flex;align-items:center;gap:1px;flex:none}
.rte-br{flex:1 1 auto;min-width:0}
/* the adopted controls keep their own layout, they just live here now */
.rte-br>*{margin:0}

/* ---------------- popovers ---------------- */
.rte-pop{
	position:absolute;z-index:1060;
	background:#fff;border:1px solid #e3e6ea;border-radius:6px;
	box-shadow:0 6px 20px rgba(16,24,40,.18);
	padding:5px;display:none;
	max-height:280px;overflow:auto;
}
.rte-pop.rte-open{display:block}
.rte-pop .rte-item{
	display:flex;align-items:center;gap:8px;
	padding:6px 11px;border-radius:4px;cursor:pointer;
	font-size:13px;white-space:nowrap;color:#3c4043;
}
.rte-pop .rte-item:hover{background:#f1f3f4}
.rte-pop h6{margin:5px 7px 2px;font-size:10px;color:#80868b;font-weight:600;letter-spacing:.03em}
.rte-swatches{display:grid;grid-template-columns:repeat(8,19px);gap:4px;padding:5px}
.rte-swatches i{width:19px;height:19px;border-radius:3px;cursor:pointer;border:1px solid rgba(0,0,0,.12);display:block}
.rte-grid{display:grid;grid-template-columns:repeat(6,17px);gap:3px;padding:7px}
.rte-grid i{width:17px;height:17px;border:1px solid #cfd4d9;border-radius:2px;display:block;cursor:pointer}
.rte-grid i.rte-sel{background:#cfe1fb;border-color:#2b7de9}
.rte-tlbl{text-align:center;font-size:11px;color:#80868b;padding-bottom:5px}
.rte-emojis{display:grid;grid-template-columns:repeat(8,26px);gap:2px;padding:5px;max-height:170px;overflow:auto}
.rte-emojis i{font-style:normal;font-size:17px;text-align:center;cursor:pointer;border-radius:3px;line-height:26px}
.rte-emojis i:hover{background:#f1f3f4}
.rte-linkbox{padding:7px;display:flex;gap:5px}
.rte-linkbox input{border:1px solid #e3e6ea;border-radius:4px;padding:5px 7px;font-size:13px;width:190px}
.rte-linkbox button{border:0;background:#2b7de9;color:#fff;border-radius:4px;padding:5px 11px;cursor:pointer}

/* ---------------- 5 minute edit window ---------------- */
.rte-editbtn{
	display:inline-flex;align-items:center;gap:4px;
	border:1px solid #cfe1fb;background:#f0f6ff;color:#1a6fd8;
	font-family:inherit;font-size:11px;font-weight:600;
	border-radius:11px;padding:1px 8px;cursor:pointer;
	vertical-align:middle;
}
.rte-editbtn:hover{background:#e3ecfb}
.rte-editbtn .rte-cd{
	font-variant-numeric:tabular-nums;
	background:#fff;border:1px solid #dfe6f0;border-radius:7px;
	padding:0 4px;font-size:10px;color:#5f6368;
}
.rte-editbtn.rte-warn{border-color:#f6c8c4;background:#fff2f0;color:#c5221f}
.rte-editbtn.rte-warn .rte-cd{border-color:#f6c8c4;color:#c5221f}

.rte-editing{
	background:#f8faff;
	border:1px dashed #2b7de9;
	border-radius:5px;
	padding:7px;
	outline:none;
}
.rte-editrow{display:flex;gap:5px;margin-top:7px;align-items:center;flex-wrap:wrap}
.rte-hint{font-size:11px;color:#9aa0a6}
.rte-edited{
	font-size:10px;background:#eceff1;color:#5f6368;
	border-radius:8px;padding:1px 6px;font-weight:600;
	margin-inline-start:5px;
}

/* A floating copy of the toolbar, so the buttons are reachable while an
 * already posted comment is being edited in place. */
.rte-float{
	position:absolute;z-index:1055;
	background:#fff;border:1px solid #cfd4d9;border-radius:5px;
	box-shadow:0 4px 14px rgba(16,24,40,.16);
}
.rte-float .rte-toolbar{border-bottom:0;background:#fff;border-radius:5px}
