@use './styles/scrollbars';
@use './styles/utils';

html {
	height: 100%;
	font-size: 62.5%;
	box-sizing: border-box;
}

body {
	background-color: var(--color-background);
	color: var(--color-foreground);
	height: 100%;
	line-height: 1.4;
}

@include scrollbars.scrollableBase();

a {
	border: 0;
	color: var(--color-link-foreground);
	font-weight: 400;
	outline: none;
	text-decoration: none;

	&:not([href]):not([tabindex]):focus,
	&:not([href]):not([tabindex]):hover {
		color: inherit;
		text-decoration: none;
	}

	&:focus {
		outline-color: var(--color-focus-border);
	}
}

b {
	font-weight: 600;
}

h1 {
	border: none;
	font-size: 4rem;
	font-weight: 400;
	margin: 0;
	padding: 0;
	white-space: nowrap;
}

h2 {
	font-size: 2.2rem;
	font-weight: 200;
	line-height: normal;
	margin: 1em 0 0.3em 0;
	white-space: nowrap;
}

h3 {
	font-size: 1.8rem;
	font-weight: 200;
	line-height: normal;
	margin: 1em 0 0.3em 0;
	white-space: nowrap;
}

h4 {
	font-size: 1rem;
	font-weight: 200;
	line-height: normal;
	margin: 1em 0 0.3em 0;
	white-space: nowrap;
}

button,
input,
select,
textarea {
	font-family: var(--font-family);
	font-size: inherit;
	margin: 0;
}

button:not(:disabled) {
	cursor: pointer;
}

input[type='checkbox'] {
	background: none;
	border: none;
	cursor: pointer;
	margin: 0;
	padding: 0 10px;
	accent-color: var(--color-background--lighten-30);

	&:focus {
		background: rgba(0, 0, 0, 0.1);
		border-radius: 5px;
		outline: 1px solid var(--vscode-focusBorder);
		outline-offset: -1px;
	}

	&[disabled] {
		color: var(--color-foreground--75);
		cursor: default;
	}

	@include utils.light-theme($selectorPostfix: ' &') {
		accent-color: var(--color-background--darken-50);
	}
}

input[type='number'],
input[type='text'],
input:not([type]),
textarea {
	background: none;
	color: var(--color-foreground);
	margin: 0 10px;
	max-width: 300px;
	padding: 4px;
	width: 100%;

	@include utils.dark-theme($selectorPostfix: ' &') {
		border: 1px solid rgba(255, 255, 255, 0.3);
	}

	@include utils.light-theme($selectorPostfix: ' &') {
		border: 1px solid rgba(0, 0, 0, 0.3);
	}

	&:focus {
		outline-color: var(--color-focus-border);

		@include utils.light-theme($selectorPostfix: ' &') {
			background-color: rgba(255, 255, 255, 0.4);
		}

		@include utils.dark-theme($selectorPostfix: ' &') {
			background-color: rgba(0, 0, 0, 0.2);
		}
	}

	&[disabled] {
		color: var(--color-foreground--75);
		cursor: default;
	}

	&::placeholder {
		color: var(--vscode-input-placeholderForeground);
	}
}

input[type='number'] {
	max-width: 100px;
	text-align: center;
}

kbd {
	display: inline-block;
	font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
	font-size: 11px;
	line-height: 11px;
	padding: 3px 5px;
	margin: 0 2px;
	vertical-align: baseline;
}

label {
	cursor: pointer;
}

select {
	background: none;
	color: var(--color-foreground);
	cursor: pointer;
	padding: 2px 23px 2px 8px;
	min-width: 5em;
	appearance: none;
	-webkit-appearance: none;

	@include utils.light-theme($selectorPostfix: ' &') {
		border: 1px solid rgba(0, 0, 0, 0.3);
	}

	@include utils.dark-theme($selectorPostfix: ' &') {
		border: 1px solid rgba(255, 255, 255, 0.3);
	}

	&:focus {
		outline-color: var(--color-focus-border);
		@include utils.light-theme($selectorPostfix: ' &') {
			background-color: rgba(255, 255, 255, 0.4);
		}

		@include utils.dark-theme($selectorPostfix: ' &') {
			background-color: rgba(0, 0, 0, 0.2);
		}
	}

	&[disabled] {
		color: var(--color-foreground--75);
		cursor: default;
	}

	& option {
		@include utils.light-theme($selectorPostfix: ' &') {
			background-color: var(--color-background--darken-05);
		}

		@include utils.dark-theme($selectorPostfix: ' &') {
			background-color: var(--color-background--lighten-05);
		}

		&:focus {
			outline-color: var(--color-focus-border);

			@include utils.light-theme($selectorPostfix: ' &') {
				background-color: rgba(255, 255, 255, 0.4);
			}

			@include utils.dark-theme($selectorPostfix: ' &') {
				background-color: rgba(0, 0, 0, 0.2);
			}
		}
	}
}

.select-container {
	display: inline-block;
	position: relative;
	margin: 0 0.75em;

	&::after {
		content: '\eab4';
		font-family: codicon;
		font-size: 14px;
		width: 14px;
		height: 14px;
		line-height: 14px;
		position: absolute;
		top: 0;
		bottom: 0;
		right: 6px;
		margin: auto;
		pointer-events: none;
	}
}

ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

::-webkit-scrollbar-corner {
	background-color: transparent !important;
}

code {
	background: var(--vscode-textCodeBlock-background);
	color: var(--color-foreground--75);
	border-radius: 3px;
	padding: 0px 4px 2px 4px;
}
