/**
 * Edit CSS on the live site: a panel docked on the left of the page, where the Customizer kept
 * its controls.
 *
 * Every rule is scoped to the panel's own classes, and the few that must win over a theme's
 * button and textarea styles say so, because the panel sits inside whatever theme is active.
 */

html.adminkeep-live-css-open {
	margin-left: 380px !important;
}

.adminkeep-live-css {
	--adminkeep-live-css-top: var(--wp-admin--admin-bar--height, 32px);
	position: fixed;
	top: var(--adminkeep-live-css-top);
	left: 0;
	bottom: 0;
	z-index: 99998;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	width: 380px;
	padding: 12px;
	gap: 8px;
	background: #fff;
	color: #1e1e1e;
	border-right: 1px solid #c3c4c7;
	box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
	font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	text-align: left;
}

.adminkeep-live-css *,
.adminkeep-live-css *::before,
.adminkeep-live-css *::after {
	box-sizing: border-box;
}

.adminkeep-live-css__head {
	display: flex;
	align-items: center;
	gap: 8px;
}

.adminkeep-live-css__title {
	flex: 1;
	font-size: 14px;
	font-weight: 600;
}


.adminkeep-live-css__close {
	color: #50575e !important;
	font-size: 13px;
	text-decoration: underline !important;
	text-underline-offset: 2px;
}

.adminkeep-live-css__close:hover,
.adminkeep-live-css__close:focus {
	color: #1e1e1e !important;
}

.adminkeep-live-css__hint {
	margin: 0 !important;
	color: #50575e;
	font-size: 12px;
}

.adminkeep-live-css__label {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	white-space: nowrap;
}

.adminkeep-live-css__code,
.adminkeep-live-css .CodeMirror {
	flex: 1;
	min-height: 0;
	width: 100%;
	margin: 0;
	border: 1px solid #c3c4c7;
	border-radius: 2px;
	font: 13px/1.5 Menlo, Consolas, Monaco, monospace !important;
}

.adminkeep-live-css__code {
	resize: none;
	padding: 8px;
	background: #fff;
	color: #1e1e1e;
}

.adminkeep-live-css .CodeMirror {
	height: auto;
}

.adminkeep-live-css__error {
	padding: 8px 10px;
	border-left: 4px solid #d63638;
	background: #fcf0f1;
	color: #1e1e1e;
}

.adminkeep-live-css__error[hidden] {
	display: none;
}

.adminkeep-live-css__foot {
	display: flex;
	align-items: center;
	gap: 12px;
}

.adminkeep-live-css__foot button {
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
	margin: 0 !important;
	border-radius: 3px !important;
	font-family: inherit !important;
	font-size: 13px !important;
	font-weight: 600 !important;
	line-height: 1.5 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	cursor: pointer;
}

.adminkeep-live-css__save {
	/* Wide enough for "Saving…", so the footer does not shift while saving. */
	justify-content: center;
	min-width: 104px;
	padding: 6px 16px !important;
	border: 1px solid #2271b1 !important;
	background: #2271b1 !important;
	color: #fff !important;
}

.adminkeep-live-css__save:hover:not(:disabled),
.adminkeep-live-css__save:focus:not(:disabled) {
	background: #135e96 !important;
	border-color: #135e96 !important;
}

.adminkeep-live-css__save:disabled {
	border-color: #c3c4c7 !important;
	background: #f0f0f1 !important;
	color: #8c8f94 !important;
	cursor: default;
}

/* While saving: keeps its blue, shows a spinner, and cannot be pressed again. */
.adminkeep-live-css__save.is-busy:disabled {
	border-color: #2271b1 !important;
	background: #2271b1 !important;
	color: #fff !important;
	cursor: progress;
}

.adminkeep-live-css__spinner {
	display: none;
	width: 12px;
	height: 12px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: adminkeep-live-css-spin 0.7s linear infinite;
}

.adminkeep-live-css__save.is-busy .adminkeep-live-css__spinner {
	display: inline-block;
}

@keyframes adminkeep-live-css-spin {
	to {
		transform: rotate(360deg);
	}
}

.adminkeep-live-css__revert {
	padding: 6px 2px !important;
	border: 0 !important;
	background: none !important;
	color: #2271b1 !important;
	box-shadow: none !important;
}

.adminkeep-live-css__revert:hover:not(:disabled),
.adminkeep-live-css__revert:focus:not(:disabled) {
	color: #135e96 !important;
	text-decoration: underline;
}

.adminkeep-live-css__revert:disabled {
	color: #a7aaad !important;
	cursor: default;
}

.adminkeep-live-css__status {
	flex: 1;
	min-width: 0;
	text-align: right;
	color: #50575e;
	font-size: 12px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.adminkeep-live-css__status[data-kind="unsaved"]::before,
.adminkeep-live-css__status[data-kind="saved"]::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 6px;
	border-radius: 50%;
	vertical-align: 1px;
	background: #dba617;
}

.adminkeep-live-css__status[data-kind="saved"]::before {
	background: #00a32a;
}

@media (prefers-reduced-motion: reduce) {
	.adminkeep-live-css__spinner {
		animation-duration: 2s;
	}
}

/* Phones: a sheet across the bottom half instead of a column down the side. */
@media screen and (max-width: 782px) {
	html.adminkeep-live-css-open {
		margin-left: 0 !important;
		padding-bottom: 50vh !important;
	}

	.adminkeep-live-css {
		top: auto;
		right: 0;
		width: auto;
		height: 50vh;
		border-right: 0;
		border-top: 1px solid #c3c4c7;
		box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
	}
}

@media print {
	.adminkeep-live-css {
		display: none !important;
	}

	html.adminkeep-live-css-open {
		margin-left: 0 !important;
	}
}
