/** 默认字体 */
@base-font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
/** 输入框默认边距 */
@form-control-padding: 2px 8px;
@form-control-bg: #eef2f7;

ul,
ol {
	line-height: 26px;
	padding-left: 22px;
	margin: 0px;
}

a {
	color: #1890ff;
}

hr {
	border-style: solid;
	border-color: #63636346;
	border-width: 0px;
	border-bottom: 1px solid #63636346;
	margin-block-start: 1em;
	margin-block-end: 1em;
}

.base-style-active-form-control {
	border: 1px solid #ffffff00;
	&:focus {
		border: 1px solid #0e8de290;
		box-shadow: 0px 0px 4px #0e8de252;
	}

	&:focus:not([type='checkbox'], [type='radio']) {
		border: 1px solid #0e8de290;
		box-shadow: 0px 0px 4px #0e8de252;
		background-color: white !important;
	}

	&:hover {
		background-color: #ebeef4;
	}
}

.base-style-input {
	outline: none;
	border: 1px solid #ffffff00;
	padding: @form-control-padding;
	margin: 0px;
	background-color: @form-control-bg;
	border-radius: 2px;
	color: black;

	&::placeholder {
		color: #bababa;
	}
}

.base-style-switch {
	appearance: none;
	-moz-appearance: none;
	-webkit-appearance: none;

	width: fit-content;
	min-width: 36px;
	height: 20px;
	border-radius: 100px;
	display: flex;
	align-items: center;
	padding: 2px 4px;
	transition: all 0.2s ease-in-out;
	width: auto;
	background: gainsboro;

	&:checked {
		background: #1890ff;
	}
	&:disabled {
		background-color: #f7f7f78b;
	}

	&:checked::before {
		transform: translate(100%, 0px);
	}

	&::before {
		background-color: #fff;
		border-radius: 9px;
		box-shadow: 0 2px 4px #00230b33;
		width: 14px;
		height: 14px;
		content: '';
	}
}

.base-style-button {
	appearance: none;
	-moz-appearance: none;
	-webkit-appearance: none;

	border-radius: 4px;
	background-color: white;
	border: 1px solid #2c92ff;
	color: #409eff;
	cursor: pointer !important;
	margin-bottom: 4px;

	&:active {
		box-shadow: 0px 0px 8px #0e8de2a5;
	}

	& + & {
		margin-left: 12px;
	}

	&:hover {
		background-color: #7abbff24;
	}

	&.danger:hover {
		background-color: #ffdede86;
	}

	&:disabled {
		background-color: white;
		border: 1px solid #c0c0c0;
		color: #aeaeae;
		cursor: not-allowed;
	}

	&.danger {
		color: #f36669;
		border-color: #dd5a5d;
	}

	&:disabled:active {
		box-shadow: none;
	}
}

.base-style-button-secondary {
	.base-style-button();

	color: gray;
	background-color: white;
	border: 1px solid #dcdcdc;
}

container-element.hidden {
	display: none;
}

container-element.minimize {
	min-width: unset;
}

container-element {
	position: fixed;
	top: 10%;
	left: 10%;
	z-index: 99999;
	text-align: left;
	min-width: 300px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	color: #636363;
	box-shadow: 0 0 24px -12px #3f3f3f;
	border-radius: 8px;
	letter-spacing: 0.5px;
	border: 1px solid #c1c1c1;
}

@base-height: 32px;
@size: 18px;

header-element {
	display: flex;
	align-items: center;
	background-color: white;
	border-radius: 8px 8px 0px 0px;
	user-select: none;
	padding: 4px;
	padding-bottom: 0px;

	.extra-menu-bar {
		width: 100%;
		padding: 4px;
		padding-bottom: 0px;
		margin-top: 4px;
		border-top: 1px solid #e8e8e8;
		/** 默认隐藏，一直到需要激活的时候再更改 */
		display: none;

		.script-panel-link {
			.base-style-button-secondary();

			padding-bottom: 2px;
			margin-bottom: 0px;
		}

		.script-panel-link.active {
			background-color: #1890ff1a;
			border-color: #1890ff;
			color: #1890ff;
		}

		.script-panel-link + .script-panel-link {
			margin-left: 4px;
		}
	}

	.profile {
		flex: 1;
		cursor: move;
	}

	.switch:hover,
	.dropdown:hover {
		background-color: #f3f3f3;
	}

	.close:hover {
		background-color: #ff000038;
	}

	.switch,
	.close {
		cursor: pointer;
	}

	.dropdown {
		line-height: 24px;
		text-decoration: underline;
	}

	.switch,
	.close,
	.profile {
		display: inline-flex;
		align-items: center;
		padding: 0px 8px;
	}
}

.logo {
	width: 18px;
	height: 18px;
	cursor: pointer;
}

.project-selector {
	display: flex;
	align-items: center;

	select {
		background: #ffffff00;
		border-radius: 4px;
		border: 1px solid #63636346;
		padding: 4px;
	}
}
.project-selector.expand-all {
	display: none;
}

.body {
	overflow: auto;
	width: auto;
	height: 100%;
}

script-panel-element {
	display: block;
	background-color: white;
	border-radius: 0px 0px 8px 8px;
	padding: 0px 8px 12px 8px;
	overflow: auto;

	.script-panel-body {
		padding: 0px 8px;
	}
}

script-panel-element + script-panel-element {
	margin-top: 12px;
}

.card + .card {
	margin-top: 12px;
}

.card {
	background-color: white;
	border-radius: 2px;
	padding: 0px 8px;
}

.notes {
	background: #0099ff0e;
	border-left: 4px solid #0099ff65;
	width: -webkit-fill-available;
	margin: 0px 8px;
	line-height: 26px;
	letter-spacing: 1px;
}

.secondary {
	font-size: 12px;
	color: #8b8b8b;
}

.tooltip-container {
	z-index: 99999999999999;
	margin: 12px 0px 0px 12px;
	padding: 4px;
	color: black;
	background: #f0f0f0;
	box-shadow: 0px 0px 4px #949494;
	position: fixed;
	white-space: normal;
	max-width: 200px;
	height: auto;
	border-radius: 2px;
	line-height: 18px;
}

.configs-container {
	&.lock {
		filter: blur(1px);
		user-select: none;
		-webkit-user-select: none;
		-moz-user-select: none;
		-ms-user-select: none;
	}
	.lock-wrapper {
		cursor: not-allowed !important;
		border-radius: 4px;
		position: absolute;
		left: 0px;
		z-index: 1;
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	.lock-message {
		background-color: #ffffff7d;
		border-radius: 4px;
		box-shadow: 0px 0px 12px #6a6a6a98;
		padding: 2px;
	}
}

.configs {
	display: table;
	background: #e1e1e107;
	width: -webkit-fill-available;

	.configs-body {
		display: table-row-group;

		config-element + config-element {
			label {
				padding-top: 4px;
			}
			.config-wrapper {
				padding-top: 4px;
			}
		}

		config-element {
			width: 100%;
			display: table-row;
			line-height: 26px;

			label {
				white-space: nowrap;
				color: #4e5969;
				display: table-cell;
				padding-right: 12px;
				text-align: left;
				vertical-align: top;
				margin-right: 12px;
			}

			.config-wrapper {
				display: table-cell;
				vertical-align: middle;

				select {
					outline: none;
					border: none;
					border: 1px solid #e4e4e4;
					border-radius: 4px;
					padding: @form-control-padding;

					.base-style-active-form-control();
				}

				textarea {
					padding: @form-control-padding;
					outline: none;
					border: none;
					.base-style-active-form-control();
				}

				input:not([type='button']) {
					.base-style-input();
					.base-style-active-form-control();
				}
				input[type='range'] {
					// 取消左右间隔，否则滚动条不能滚到头尾
					padding: 0px;
				}

				input[type='button'] {
					.base-style-button();
				}

				/** check box 的样式 */
				input[type='checkbox'] {
					.base-style-switch();
				}

				input:not([type='checkbox'], [type='radio']),
				textarea,
				select {
					width: -webkit-fill-available;
					font-size: inherit;
				}

				input[type='checkbox'],
				input[type='radio'],
				input[type='range'] {
					accent-color: #0e8ee2;
				}
			}

			.config-wrapper > *:not(.tooltip) {
				background-color: @form-control-bg;
				border-radius: 2px;
				color: black;
				float: right;
			}
			.config-wrapper > *:disabled {
				cursor: not-allowed;
				background-color: #f7f7f78b;
			}
		}
	}
}

// 消息推送

.message-container {
	margin-bottom: 4px;
	position: absolute;
	bottom: 100%;
	left: 50%;
	width: 100%;
	transform: translate(-50%, 0px);
	min-width: 300px;

	// 提示内容
	message-element {
		display: flex;
		border-radius: 4px;
		padding: 4px 12px;
		margin-bottom: 4px;

		.message-content-container {
			margin-right: 8px;
			flex: auto;
		}

		.message-text {
			letter-spacing: 1px;
			font-weight: bold;
		}

		// 关闭按钮
		.message-closer {
			width: 18px;
			min-width: 18px;
			cursor: pointer;
			background-color: #ffffffb3;
			color: #a1a1a1;
			border-radius: 100%;
			text-align: center;
			height: 18px;
			vertical-align: middle;
			font-size: 12px;
		}

		&.error {
			background-color: #ffe6e6;
			color: #c70208;
			border: 1px solid #ff6b6ded;
		}

		&.info {
			background-color: #c9e7ff;
			color: #004d95;
			border: 1px solid #1890ff69;
		}

		&.success {
			background-color: #e8ffe0;
			color: #3e8d0d;
			border: 1px solid #6fd91d;
		}

		&.warn {
			background-color: #ffefc8;
			color: #9b7400;
			border: 1px solid #ffc107;
		}
	}
}

modal-element {
	position: absolute;
	top: 50%;
	left: 50%;
	background-color: white;
	border-radius: 4px;
	box-shadow: 0px 0px 24px -12px black;
	border: 1px solid #929292;
	height: fit-content;
	transform: translate(-50%, -50%);
	padding: 12px 18px 18px 18px;
	font-family: @base-font-family;
	z-index: 99999999999;
	line-height: 24px;

	.modal-profile {
		zoom: 0.9;
		color: #969696;
		user-select: none;
		margin-bottom: 4px;
	}

	.modal-title {
		font-size: 18px;
		font-weight: bold;
		user-select: none;
	}

	.modal-body {
		margin: 12px 0px;
		overflow: auto;
	}

	.modal-footer {
		display: flex;
		white-space: nowrap;
		justify-content: end;
		align-items: end;

		> * + * {
			margin-left: 12px;
		}
	}

	.modal-input {
		.base-style-input();
		.base-style-active-form-control();
		width: -webkit-fill-available;
	}

	.modal-cancel-button {
		.base-style-button();

		color: gray;
		background-color: white;
		border: 1px solid #dcdcdc;
	}
	.modal-confirm-button {
		.base-style-button();
	}
}

modal-element.alert {
	.modal-input,
	.modal-cancel-button {
		display: none;
	}
	.modal-confirm-button {
		margin: 0;
	}
}

modal-element.prompt {
	.modal-input,
	.modal-cancel-button,
	.modal-confirm-button {
		display: block;
	}
}

modal-element.confirm {
	.modal-input {
		display: none;
	}
}

.modal-wrapper {
	width: 100%;
	height: 100%;
	z-index: 9999;
	position: fixed;
	top: 0px;
	left: 0px;
	z-index: 9999999;
	background-color: rgba(0, 0, 0, 0.265);
	color: #636363;
	font: 14px @base-font-family;
}

.pointer {
	cursor: pointer;
}

.separator {
	display: flex;
	align-items: center;
	text-align: center;
	padding: 4px 0px 8px 0px;

	&::before,
	&::after {
		content: '';
		flex: 1;
		border-bottom: 1px solid #63636346;
	}

	&:not(:empty)::before {
		margin-right: 0.25em;
	}

	&:not(:empty)::after {
		margin-left: 0.25em;
	}
}

container-element.minimize {
	.body,
	header-element .dropdown,
	.footer {
		display: none;
	}
}

container-element.minimize header-element {
	padding: 8px;
	border-radius: 8px;
	box-shadow: 0px 0px 24px -12px black;
}

.user-guide {
	& > li {
		padding: 4px 0px;
	}
}

.search-infos-num {
	width: 26px;
	margin: 2px;
	height: 20px;
	border-radius: 4px;
	display: inline-block;
	background-color: white;
	text-align: center;
	cursor: pointer;
	border: 1px solid #b6b6b6;

	&.requested {
		border: 1px solid #63b4ff;
		color: #63b4ff;
	}

	&.active {
		background-color: #127de1 !important;
		color: white;
	}

	&.error {
		border: 1px solid #ff8789ed;
		background-color: #ff6b6ded;
		color: white;
	}

	&.finish {
		background-color: #63b4ff;
		border: 1px solid #63b4ff;
		color: white;
	}
}

search-infos-element {
	display: block;
	overflow: auto;

	.search-result {
		margin-bottom: 12px;
		padding-left: 12px;

		.question {
			font-weight: bold;
		}
		.answer {
			color: #7c7c7c;

			code {
				// background-color: #f3f3f3;
				border-bottom: 1px solid #dcdcdc;
				padding: 2px 0px;
				border-radius: 2px;
				margin: 4px;
				line-height: 22px;
			}

			code + code {
				margin-left: 4px;
			}
		}

		.search-result-answer-tag {
			padding: 2px 4px;
			border-radius: 2px;
			font-size: 12px;
			cursor: pointer;
		}
		.search-result-answer-tag + .search-result-answer-tag {
			margin-left: 4px;
		}

		.search-result-answer-tag.blue {
			background-color: #e6f7ff;
			border: 1px solid #91d5ff;
			color: #1890ff;
		}

		.search-result-answer-tag.green {
			background-color: #f6ffed;
			border: 1px solid #b7eb8f;
			color: #52c41a;
		}

		.search-result-answer-tag.gray {
			background-color: #fafafa;
			border: 1px solid #d9d9d9;
			color: #595959;
		}

		.search-result-answer-tag.red {
			background-color: #fff1f0;
			border: 1px solid #ffa39e;
			color: #ff4d4f;
		}

		.search-result-answer-tag.yellow {
			background-color: #fffbe6;
			border: 1px solid #ffe58f;
			color: #faad14;
		}
	}

	.search-result-question-type {
		background-color: #e6f7ff;
		border: 1px solid #91d5ff;
		color: #1890ff;
		margin-right: 8px;
		padding: 0px 4px;
		border-radius: 4px;
	}

	.error {
		color: #ff6b6ded;
		display: inline-block;
		padding-left: 12px;
	}
}

.copy,
.question-title-extra-btn {
	margin-left: 4px;
	padding: 2px 4px;
	border-radius: 2px;
	box-shadow: 0 0 4px #b1b1b1;
	cursor: pointer !important;
	font-weight: normal;
	font-size: 12px;
}

.work-result-question-container {
	position: absolute;
	width: 400px;
	left: -100%;
	top: 0px;
	background: white;
	border: 1px solid #cbcbcb;
	border-radius: 4px;
	box-shadow: 0px 0px 12px #d1cfcf;
	padding: 12px;

	.close-search-result {
		font-size: 12px;
		margin-left: 8px;
		text-decoration: underline;
		color: gray;
		cursor: pointer;
	}
}

.work-result-list {
	max-height: 400px;
	overflow: auto;
	margin: 12px 0px;
	padding: 6px;
	border: 1px solid #e1e1e1;
	border-radius: 4px;
}

.search-info-title {
	border: 1px solid #e1e1e1;
	border-radius: 4px;
	padding: 8px 12px;
	margin-bottom: 12px;
	line-height: 20px;
}

.search-info-details {
	margin-left: 4px;
}

.console {
	max-height: 300px;
	max-width: 400px;
	overflow: auto;
	background-color: #292929;
	padding: 12px 6px;
	color: #ececec;
	font-size: 12px;

	.item {
		padding: 3px 0px;
		border-radius: 2px;

		.time {
			color: #757575;
		}

		.info {
			background-color: #2196f3a3;
		}

		.warn {
			background-color: #ffc107db;
		}

		.error {
			background-color: #f36c71cc;
		}

		.debug,
		.log {
			background-color: #9e9e9ec4;
		}
	}

	// 文字选中样式
	& *::selection {
		background-color: #ffffff6b;
	}
}

/* 设置滚动条的样式 */
::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}

/* 滚动槽 */
::-webkit-scrollbar-track {
	background: #ffffffd8;
	border-radius: 4px;
	margin: 4px;
}

/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.253);
	box-shadow: inset006pxrgba(0, 0, 0, 0.3);
}

.markdown {
	max-width: 400px;
	max-height: 50vh;
	overflow: auto;

	code {
		padding: 2px 4px;
		background-color: #f0f0f0;
		border-radius: 6px;
		font-size: 12px;
	}

	blockquote {
		padding: 4px 4px 4px 12px;
		margin: 0px;
		color: #b5b5b5;
		border-left: #ababab 2px solid;

		p {
			margin: 0px;
		}
	}

	h1,
	h2,
	h3,
	h4,
	h5,
	h6,
	p {
		margin: 8px 0px;
	}
}

.dropdown {
	position: relative;
	display: inline-block;

	&.active {
		.dropdown-trigger-element {
			color: #1890ff;
		}
	}
}

.dropdown-trigger-element {
	cursor: pointer;
}

.dropdown-content {
	display: none;
	position: absolute;
	background-color: #ffffff;
	overflow: auto;
	box-shadow: 0px 8px 16px 0px #00000033;
	z-index: 1;
	border-radius: 4px;
	padding: 8px 12px;
	min-width: 120px;

	&.show {
		display: block;
	}
}

.dropdown-content {
	cursor: pointer;
	z-index: 999;

	.dropdown-option {
		padding-left: 4px;
		white-space: nowrap;
	}

	.dropdown-option:hover {
		background-color: #f3f3f3;
	}

	.dropdown-option.active {
		background-color: #1890ff1a;
		color: #1890ff;
	}
}

.space {
	display: inline-flex;
}

.config-details {
	label {
		padding-left: 12px;
	}
}

.alert-info-wrapper {
	margin-bottom: 8px;

	.result-info {
		padding: 12px;
		text-align: center;
		border-radius: 6px;
	}

	.unresolved {
		color: #a1a1a1;
		background-color: #f7f7f7;
	}

	.no-answer {
		color: #a1a1a1;
		background-color: #f7f7f7;
	}

	.error {
		color: #ff4d4f;
		background-color: #fff1f0;
	}
}

message-element {
	animation: show 0.5s;
}

script-panel-element > div,
script-panel-link,
container-element,
modal-element {
	animation: fade-in 0.3s;
}

@keyframes show {
	0% {
		transform: translateY(20px);
		opacity: 0;
	}
	100% {
		transform: translateY(0);
		opacity: 1;
	}
}

@keyframes fade-in {
	0% {
		opacity: 0;
	}
	100% {
		opacity: 1;
	}
}

@keyframes fade-out {
	0% {
		opacity: 1;
	}
	100% {
		opacity: 0;
	}
}
