:root {
	--euterm-blue: #163f84;

	--button-background: var(--euterm-blue);
	--button-disabled: #555;
	--button-clicked: #aaa;

	--font: 'Roboto';
	--font-size: 14pt;

	--pin-button-color: #fff;
	--pin-button-background: #555;
	--pin-button-pressed: var(--euterm-blue);

	--action-requested: #b7d297;

	--layout-subpage: 64px;
	--layout-footer: 24px;

	--page-shadow-offset: 0px;
	--page-header: 0px;

	--page-barcode: 0px;
	--page-barcode-display: none;
}

@font-face {
	font-family: "Roboto";
	src:
		local("Roboto"),
		url("/fonts/v0/roboto.ttf");
}

@font-face {
	font-family: "Roboto Mono";
	src:
		local("Roboto Mono"),
		url("/fonts/v0/roboto_mono.ttf");
}


@font-face {
	font-family: "Roboto Condensed";
	src:
		local("Roboto Condensed"),
		url("/fonts/v0/roboto_condensed.ttf");
}

* {
	font-family: var(--font);
	font-size: var(--font-size);
}

html {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0px;
	background-color: #fff;
	height: 100dvh;
}

#app {
	padding: 0px 32px 32px 32px;
}

*,
*:before,
*:after {
	box-sizing: inherit;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}

[onClick] {
	cursor: pointer;
}

#header-subpage {
	background-color: var(--euterm-blue);
	color: #fff;
	font-weight: bold;
	padding: 24px;
	margin-bottom: 32px;
}

#header-shadow {
	position: absolute;
	top: 6px;
	z-index: 16384;
	height: 64px;
	width: 100dvw;
	box-shadow: 0px 15px 24px -20px rgba(0, 0, 0, 1);
}

button {
	color: #fff;
	background-color: var(--button-background);
	padding: 8px 16px;
	border-radius: 6px;
	border: none;
	font-size: 1em;
	white-space: nowrap;

	&:disabled {
		background-color: var(--button-disabled);
	}

	&:active {
		background-color: var(--button-clicked);
	}
}

.labels {
	display: flex;
	gap: 16px;

	.label {
		user-select: none;
		font-weight: bold;
		margin-bottom: 16px;
		color: #fff;
		padding: 8px 16px;
		border-radius: 8px;
		background-color: #444;

		&.selected {
			background-color: var(--euterm-blue);
		}
	}
}

.widgets {
	.details {
		border: 1px solid #aaa;
		border-radius: 8px;
		padding: 32px;

		.fields {
			display: grid;
			grid-template-columns: min-content 1fr;
			white-space: nowrap;
			grid-gap: 8px 16px;
			justify-items: start;

			.required:after {
				content: "*";
				margin-left: 4px;
				color: #a00;
				font-weight: bold
			}

			.extra-fields {
				font-weight: bold;
				margin-top: 16px;
				grid-column: 1 / -1;
			}

			button {
				grid-column: 1 / -1;
				justify-self: start;
			}

			input {
				width: 100%;
			}

			input[type="checkbox"] {
				width: unset;
			}

			textarea {
				width: 100%;
				field-sizing: content;
			}
		}
	}

	button {
		margin-top: 16px;
	}
}

dialog.generated-code {
	&:modal {
		display: grid;
		justify-items: center;
	}

	padding: 32px;

	.generated-string {
		text-align: center;
		font-size: 1.25em;
		font-family: monospace;
		margin-top: 16px;
	}

	#generated-code {
		&.copy {
			filter: sepia(54%) saturate(2000%) hue-rotate(20deg);
		}
	}

	button {
		margin-top: 16px;
	}
}

dialog.alert.error {
	&:modal {
		display: grid;
		justify-items: center;
	}

	background-color: #c83737;
	color: #fff;
	border: 0px;
	border-radius: 8px;

	button {
		margin-top: 16px;
	}
}

textarea[name="raw-json"] {
	min-width: 600px;
	min-height: 400px;
	field-sizing: content;
}

textarea[name="raw-multiple"] {
	min-width: 600px;
	min-height: 400px;
}

.print-settings {
	margin-top: 16px;
	display: grid;
	grid-template-columns: min-content 1fr;
	grid-gap: 8px 16px;
	white-space: nowrap;
	justify-items: start;

	input[type="number"] {
		width: 100px;
	}
}

@media print {
	@page {
		margin: 0;
	}

	body {
		margin: 0cm;
	}

	html {
		height: unset;
	}

	body {
		height: unset;
	}

	#header-subpage,
	#header-shadow,
	#footer {
		display: none;
	}

	#app {
		padding: unset;

		* {
			display: none;
		}

		#print {
			display: grid;
			margin-top: 0;

			* {
				display: inherit
			}
		}
	}
}

#print {
	--margin: 5mm;

	display: grid;
	width: min-content;
	/* Set in javascript
	grid-template-columns: repeat(5, 42mm);
	*/
	justify-items: center;
	align-items: center;
	margin-top: 32px;

	div.code-group {
		display: grid;
		grid-template-rows: 1fr auto;

		&.code-prio {
			grid-template-rows: 1fr auto;

			.canvas-wrapper {
				position: relative;
				min-height: 0;
			}

			canvas {
				position: absolute;
				top: 0px;
				left: 0px;
				display: block;
				margin: var(--margin);
			}

			.codestring {
				height: 5mm;
				font-size: 14pt;
				overflow: hidden;
				word-break: break-all;
				margin-left: var(--margin);
				margin-right: var(--margin);
				margin-bottom: var(--margin);
			}
		}

		&.label-prio {
			.canvas-wrapper {
				position: relative;
				min-height: 0;
			}

			canvas {
				position: absolute;
				display: block;
				margin: var(--margin);
				max-width: calc(100% - var(--margin) * 2);
				max-height: calc(100% - var(--margin));
			}

			.codestring {
				margin-left: var(--margin);
				margin-right: var(--margin);
				margin-bottom: var(--margin);
			}
		}
	}

	.page-break {
		grid-column: 1 / -1;
		width:100%;
		page-break-after: always
	}
}
