/* General */

html, body {
	height: 100%;
	margin: 0;
}

.main {
	display: flex;
	height: 100%;
	flex-direction: column;
	align-items: center;
}

.top-edge-spacer {
	flex-grow: 1;
}

.bottom-edge-spacer {
	flex-grow: 2;
}

.background {
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
	background-image: url("/img/login-background.jpg");
}



/* Login box */

.loginbox {
	box-sizing: border-box;
	background: hsla(0deg 0% 100% / 90%);
	backdrop-filter: blur(10px) saturate(200%);
	border-radius: 18px;
	padding: 18px;
	width: 224px;
}

.logo {
	height: 24px;
	margin-bottom: 36px;
	flex-shrink: 0;
	background-position: center;
	background-repeat: no-repeat;
	background-size: contain;
	background-image: url("/img/logo-smartpolice-light-bg.svg");
}

label, input, button {
	font-family: OpenSans, sans-serif;
	display: block;
	box-sizing: border-box;
	min-width: 188px;
}

label {
	font-size: 11px;
	line-height: 16px;
	font-weight: 600;
	color: hsl(197deg 8% 38%);
	text-transform: uppercase;
	margin-bottom: 4px;
}

input, button {
	font-size: 13px;
	line-height: 20px;
	border: none;
	outline: none;
	transition: background-color 150ms;
}

input::-ms-clear {
	display: none;
}

input::-ms-reveal {
	display: none;
}

input[type=text], input[type=password] {
	padding: 3px 6px;
	margin-bottom: 18px;
	border-radius: 6px;
	background-color: rgba(41, 101, 122, 0.08);
}

input[type=text]:hover, input[type=password]:hover,
input[type=text]:focus, input[type=password]:focus {
	background-color: rgba(41, 101, 122, 0.125);
}

button[type=submit] {
	color: white;
	font-weight: 600;
	padding: 6px 9px;
	margin-top: 36px;
	border-radius: 9px;
	background-color: hsl(195deg 90% 41%);
	height: 32px;
	position: relative;
}

button[type=submit] span {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	line-height: 32px;
	transition: opacity 150ms;
	opacity: 1;
	display: flex;
	align-items: center;
	justify-content: center;
}
button[type=submit] span.success {
	opacity: 1;
}
button[type=submit] span.error {
	opacity: 0;
}
button[type=submit].error span.success {
	opacity: 0;
}
button[type=submit].error span.error {
	opacity: 1;
}

button[type=submit]:hover, input[type=submit]:focus {
	background-color: rgb(9, 133, 174);
	cursor: pointer;
}

button[type=submit].loading {
	cursor: not-allowed;
}

button[type=submit].loading span.success::before {
	content: "";
	margin-right: 6px;
	width: 16px;
	height: 16px;
	border-radius: 4px;
	background-color: #FFFFFF;
	animation: sk-rotateplane 2.75s infinite ease-in-out;
}

@keyframes sk-rotateplane {
	0% {
		transform: perspective(120px) rotateX(0deg) rotateY(0deg);
	}

	50% {
		transform: perspective(120px) rotateX(-180deg) rotateY(0deg);
	}

	100% {
		transform: perspective(120px) rotateX(-180deg) rotateY(-180deg);
	}
}

button[type=submit].error {
	background-color: hsl(350deg 76% 51%);
}


/* Fonts */

@font-face {
	font-family: OpenSans;
	src: url(fonts/OpenSans-Regular.woff) format("woff");
	font-weight: 400;
	font-style: normal
}

@font-face {
	font-family: OpenSans;
	src: url(fonts/OpenSans-Italic.woff) format("woff");
	font-weight: 400;
	font-style: italic
}

@font-face {
	font-family: OpenSans;
	src: url(fonts/OpenSans-Semibold.woff) format("woff");
	font-weight: 600;
	font-style: normal
}



/* Dark mode */

@media (prefers-color-scheme: dark) {
	.loginbox {
		background: hsla(197deg 12% 23% / 90%);
	}

	.logo {
		background-image: url("/img/logo-smartpolice-dark-bg.svg");
	}

	label {
		color: hsl(197deg 8% 63%);
	}

	input[type=text], input[type=password] {
		background-color: rgba(55, 94, 109, 0.2);
	}

	input[type=text]:hover, input[type=password]:hover,
	input[type=text]:focus, input[type=password]:focus {
		background-color: rgba(55, 94, 109, 0.33)
	}

	button[type=submit] {
		background-color: hsl(196deg 100% 32%);
	}

	button[type=submit]:hover, input[type=submit]:focus {
		background-color: rgb(0, 101, 138);
	}

	button[type=submit].error {
		background-color: hsl(350deg 73% 46%);
	}
}
