/**
 * Shared front-end styling for all six Utilities: Text & Web Dev shortcode
 * widgets. Deliberately scoped under .util-textweb-widget so it can't leak
 * into the surrounding theme, and deliberately plain (no theme-color
 * guessing) so it looks reasonable on any site.
 */

.util-textweb-widget {
	box-sizing: border-box;
	max-width: 760px;
	margin: 1.5em 0;
	padding: 1.25em;
	border: 1px solid #d5d8dc;
	border-radius: 6px;
	background: #fbfbfc;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: #1d2327;
}

.util-textweb-widget *,
.util-textweb-widget *::before,
.util-textweb-widget *::after {
	box-sizing: inherit;
}

.util-textweb-widget .util-textweb-field {
	margin-bottom: 1em;
}

.util-textweb-widget label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.35em;
}

.util-textweb-widget textarea,
.util-textweb-widget input[type="text"],
.util-textweb-widget input[type="number"],
.util-textweb-widget select {
	width: 100%;
	padding: 0.5em 0.6em;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
	color: #1d2327;
	font-family: Consolas, Monaco, "Courier New", monospace;
	font-size: 13px;
	line-height: 1.5;
}

.util-textweb-widget input[type="number"] {
	width: 6em;
	font-family: inherit;
}

.util-textweb-widget textarea:focus,
.util-textweb-widget input:focus,
.util-textweb-widget select:focus {
	outline: 2px solid #2271b1;
	outline-offset: -1px;
}

.util-textweb-widget .util-textweb-toggle-row {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25em;
	align-items: center;
	margin-bottom: 1em;
	font-size: 14px;
}

.util-textweb-widget .util-textweb-toggle-row label {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	font-weight: 400;
	margin-bottom: 0;
	white-space: nowrap;
}

.util-textweb-widget fieldset {
	display: flex;
	gap: 1em;
	border: none;
	margin: 0;
	padding: 0;
}

.util-textweb-widget .util-textweb-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6em;
	margin-bottom: 1em;
}

.util-textweb-widget .button {
	display: inline-flex;
	align-items: center;
	padding: 0.45em 1em;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #f6f7f7;
	color: #1d2327;
	font-family: inherit;
	font-size: 14px;
	cursor: pointer;
	text-decoration: none;
}

.util-textweb-widget .button:hover {
	background: #f0f0f1;
}

.util-textweb-widget .button-primary {
	background: #2271b1;
	border-color: #2271b1;
	color: #fff;
}

.util-textweb-widget .button-primary:hover {
	background: #135e96;
}

.util-textweb-widget .button[disabled] {
	opacity: 0.55;
	cursor: default;
}

.util-textweb-widget .util-textweb-status {
	font-size: 13px;
	color: #50575e;
	min-height: 1.4em;
}

.util-textweb-widget .util-textweb-status.is-error {
	color: #d63638;
	font-weight: 600;
}

.util-textweb-widget .util-textweb-status.is-success {
	color: #008a20;
	font-weight: 600;
}

.util-textweb-widget .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* Markdown preview */

.util-md2rtf-preview {
	padding: 0.75em 1em;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
	min-height: 4em;
	font-family: Georgia, "Times New Roman", serif;
	font-size: 15px;
}

.util-md2rtf-preview h1,
.util-md2rtf-preview h2,
.util-md2rtf-preview h3,
.util-md2rtf-preview h4 {
	margin: 0.6em 0 0.3em;
	font-family: inherit;
}

.util-md2rtf-preview p {
	margin: 0.5em 0;
}

.util-md2rtf-preview pre {
	background: #f6f7f7;
	padding: 0.75em;
	border-radius: 4px;
	overflow-x: auto;
	font-family: Consolas, Monaco, monospace;
	font-size: 13px;
}

.util-md2rtf-preview code {
	font-family: Consolas, Monaco, monospace;
	font-size: 0.9em;
	background: #f0f0f1;
	padding: 0.1em 0.3em;
	border-radius: 3px;
}

.util-md2rtf-preview pre code {
	background: none;
	padding: 0;
}

.util-md2rtf-preview blockquote {
	margin: 0.5em 0;
	padding-left: 1em;
	border-left: 3px solid #c3c4c7;
	color: #50575e;
}

.util-md2rtf-preview table {
	border-collapse: collapse;
	width: 100%;
	margin: 0.75em 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
}

.util-md2rtf-preview th,
.util-md2rtf-preview td {
	border: 1px solid #c3c4c7;
	padding: 0.4em 0.7em;
	text-align: left;
}

.util-md2rtf-preview th {
	background: #f6f7f7;
	font-weight: 600;
}

/* JSON formatter output */

.util-jsonfmt-output {
	display: block;
	width: 100%;
	max-height: 420px;
	overflow: auto;
	margin: 0;
	padding: 0.75em 1em;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	background: #fff;
	font-family: Consolas, Monaco, monospace;
	font-size: 13px;
	white-space: pre;
}

.util-jsonfmt-output.is-error {
	border-left: 4px solid #d63638;
	color: #8a1f1f;
	background: #fcf0f1;
}

.util-jsonfmt-controls select {
	width: auto;
	display: inline-block;
}

/* Responsive */

@media (max-width: 480px) {
	.util-textweb-widget {
		padding: 1em;
	}

	.util-textweb-widget .util-textweb-toggle-row,
	.util-textweb-widget fieldset {
		flex-direction: column;
		align-items: flex-start;
		gap: 0.5em;
	}
}
