/* globals, helpers */
@font-face {
	src: url("/static/fonts/DIN2014.woff2");
	font-style: normal;
	font-weight: normal;
	font-family: "DIN2014-Light";
}
body {
	background-color: #f5f5f5;
	margin: 0;
	font-family: DIN2014-Light;
	--primary-color: dodgerblue;
}
body:has(#terminal[data-target]) {
	background-color: black;
}
button {
	cursor: pointer;
}
.mono {
	font-family: monospace;
}
.flex-spacer {
	flex: 1;
}
.hidden {
	display: none;
}
a:not([href]) {
	cursor: pointer;
	user-select: none;
	color: blue;
	text-decoration: underline;
	/* js-driven link */
}
iframe {
	height: calc(100% - 3.04em);
	width: 100%;
	overflow: hidden;
	border: none;
	padding: 0;
	margin: 0;
}
iframe::-webkit-scrollbar {
	display: none;
}
iframe[data-readonly="1"] {
	filter: invert(1);
}
[readonly] {
	pointer-events: none;
}
select.single-choice {
	appearance: none;
	background-color: inherit;
	border: none;
	pointer-events: none;
}
/* loading */
.loading {
	position: relative;
}
.loading > *:not(.loader) {
	filter: blur(5px);
	opacity: .5;
	pointer-events: none;
}
:not(.loading) > .loader {
	display: none;
}
.loader {
	position: absolute;
	top: 50%;
	left: 50%;
	right: 0;
	bottom: 0;
	height: 1.5em;
	transform: translate(-50%, -50%);
}
.loader circle {
	fill: var(--primary-color);
}
/* modals */
#modals:empty {
	display: none;
}
.modal {
	position: absolute;
	top:0;
	left:0;
	right:0;
	bottom:0;
	background-color: rgba(34,34,34,0.8);
	z-index: 3;
}
.modal:not(:has(.fullscreen)) {
	padding: 10vh 20vw 10vh 20vw;	
}
.modal > .content {
	background-color: white;
	position: relative;
}
.modal .header {
	position: relative;
}
.modal form {
	max-height: calc(100% - 3em);
}
.modal > .content:not(.fullscreen) {
	max-height: 80vh;
	overflow: clip;
}
.modal > .content.fullscreen {
	height: 100%;
}
/* buttons */
#content .sessions-table [data-action] {
	font-weight: bold;
	padding: .5em;
	font-size: 1em;
	border-radius: .5em;
	background-color: white;
}
[data-action="open-menu"] {
	position: relative;
	padding: 0;
	cursor: unset;
}
[data-action="open-menu"]::before {
	content: "\2630";
	color: white;
	font-size: 1.5em;
	display: inline-block;
	width: 100%;
	height: 100%;
	padding-top: 0.6em;
	cursor: pointer;
}
[data-action="delete-session"] {
	padding: 0;
}
[data-action="delete-session"]:hover {
	filter: invert(1);
	border-color: #4ddddd!important; /* inverted firebrick */
	background-color: cyan!important; /* inverted red */
}
[data-action="edit-session"]::before {
	content: '\270E';
	text-align: center;
	padding: .15em;
}
[data-action="edit-session"]:hover {
	background-color: var(--primary-color)!important;
	color: white;
}
[data-readonly="1"] [data-action="open-terminal"]::before {
	content: '\1F440';
}

[data-readonly="0"] [data-action="open-terminal"]::before {
	content: "$>";
}
[data-action="open-terminal"]:hover {
	background-color: black!important;
	border-color: #00ff00!important;
	color: #00ff00!important;
}
#content .sessions-table [data-action="delete-session"] {
	background-image: url("/static/img/bin.svg");
	background-repeat: no-repeat;
	background-position: center;
	padding: 1.1em;
	background-size: 1.25em;
}
.btn-primary {
	line-height: 2em;
	border-radius: 0.25em;
	outline: none;
	border-width: 2px;
	border-color: #ccc;
	padding: 0.5em;
	color: var(--primary-color);
	background-color: white;
}
.btn-primary:hover {
	background-color: var(--primary-color);
	color: white;
	border-color: var(--primary-color);
}
.prepend-plus::before {
	content: '\002b\00a0';
}
.prepend-refresh::before {
	content: "\27F3\00a0";
}
#content:not([data-show-hidden="1"]) [data-action="toggle-hidden-sessions"]::before {
	content: "\203A\00a0";
}
#content[data-show-hidden="1"] [data-action="toggle-hidden-sessions"]::before{
	content: "\2039\00a0";
}
#content:not([data-show-hidden="1"]) tr[data-hidden="1"] {
	display: none;
}
[data-action="close"] {
	width: 0;
	line-height: 0;
	position: absolute;
	top: 50%;
	right: 2em;
	cursor: pointer;
	color: inherit;
	background-color: rgba(0,0,0,0);
	border: none;
	padding: 0;
	font-size: 1.2em;
}
[data-action="close"]::before {
	content: "\2716";
}
.button-row {
	display: flex;
}
.button-row button {
	flex: 1;
}
.button-row :not(:first-child) {
	margin-left: 1em;
}
.button-row :not(:last-child) {
	margin-right: 1em;
}

/* toggle-hidden */
.toggle-hidden:not(.open) > *:not(.toggle) {
	display: none;
}

/* headers, footers */
.header {
	position: sticky;
	height: 3em;
	width: 100%;
	top: 0;
	z-index: 3;
	display: flex;
	border-bottom: 1px solid rgba(0,0,0,.075);
	box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
	background-color: var(--primary-color);
	color: white;
}
.header .button-box:first-child button {
	margin-right: -3.5em;
	--left: 0;
	--right: unset;
}
.header .button-box:last-child button {
	margin-left: -3.5em;
	--left: unset;
	--right: 0;
}
.header button {
	height: 100%;
	min-width: 3.5em;
	background-color: inherit;
	outline:1px solid rgba(0,0,0,0.1);
	border: none;
}
.header button:hover,
.header button.open {
	background-color: #1b81e5;
}
.header > .title {
	flex: 1;
	line-height: 2.2em;
	font-size: 1.5em;
	font-weight: bold;
	text-align: center;
}
.header > .title[data-target]::after {
	content: ' | ' attr(data-target);
}
.header:not([data-target]) [data-action="close-terminal"] {
	display: none;
}
.header > * {
	flex: 0;
}
.footer {
	border-top: 1px solid #ddd;
	background-color: #f8f8f8;
	display: flex;
}
.footer button {
	border: none;
	outline: 1px solid #ddd;
	border-radius: 0;
	font-weight: bold;
}
.fullscreen .footer {
	padding: .4em;
	position: fixed;
	bottom: 0;
	position: sticky;
	bottom: 0;
	left: 0;
	right: 0;
}
.footer > * {
	flex: 1;
}
/* menu */
.menu {
	position: absolute;
	top: 100%;
	left: var(--left);
	right: var(--right);
	background-color: white;
	color: var(--primary-color);
	text-align: left;
	min-width: 20em;
	box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 4px 5px 0 rgba(0, 0, 0, 0.12);
}
.menu > .title {
	font-size: 1.5em;
	text-align: left;
	color: white;
	background-color: #1b81e5;
	cursor: unset!important;
	line-height: 2.5em;
	font-weight: bold;
	padding: 0 .5em 0 .5em;
}
.menu > .entry {
	padding: .5em 1em .5em 1em;
	white-space: nowrap;
	cursor: pointer;
	text-align: left;
}
.menu > .entry:hover {
	background-color: var(--primary-color);
	color: white;
}
/* content */
#content {
	display: flex;
	flex-direction: column;
	background-color: white;
	padding: 2em;
	position: absolute;
	top: 2em;
	bottom: 0;
	left: 10vw;
	right: 10vw;
}
#content thead, #content tbody {
    border: 1px solid #ddd;
}
#content table {
	width: 100%;
	text-align: center;
	border-collapse: collapse;
}
#content table thead th {
	padding: .5em;
}
#content table tbody tr:nth-child(odd) {
	background-color: #f8f8f8;
}
#content table tbody tr[data-protected="1"] [data-action="delete-session"] {
	display: none;
}

#content table tbody td:first-child,
#content table tbody td:last-child {
	padding: 0 1em 0 1em;
}

#content table tbody tr {
	height: 4em;
}
#content table tbody td:nth-child(4) {
	font-family: monospace;
}
/* form */
form {
	margin-bottom: -1em; /* not sure why but 1em margin added to forms? */
	overflow-y: auto;
	overflow-x: clip;
	background-color: inherit;
}
form .fields {
	padding: 5% 2% 5% 2%;
}
form .fields .row:not(:last-child) {
	margin-bottom: 2em;
}

form .fields .row label {
	font-weight: bold;
}
form .fields .row input:not([type="radio"]) {
	width: 100%;
	line-height: 2em;
}
form .fields .row input[type="radio"] {
	appearance: none;
	line-height: 1.5em;
	padding: .5em;
	border: 1px solid #888;
	text-align: center;
	margin: 0;
	flex: 1;
	cursor: pointer;
}
form .fields .row input[type="radio"]:not(:first-child) {
	border-left: none;
}
form .fields .row input[type="radio"]:checked {
	background-color: var(--background-color-checked);
	color: var(--color-checked);
	border: 1px solid #222;
	outline: none;
}
form .fields .row input[type="radio"]::after {
	content: attr(data-label);
}
form .fields .row select {
	width: 100%;
	height: 2.5em;
}
form .fields .row p {
	margin: 0;
	font-style: italic;
	font-size: .9em;
}

form [type="submit"].disabled {
	pointer-events: none;
	color: #aaa;
	background-color: #eee;
	border-color: rgba(0,0,0,0);
	cursor: not-allowed;
}

form .row.error input,
form .row.error select {
	background-color: mistyrose;
}
form .row.error p {
	color: red;
}
form .fields .row[data-error] > label {
	display: none;
}
form .fields .row[data-error]::after {
	content: attr(data-error);
	color: red;
	font-weight: bold;
	font-size: .8em;
}
/* notifications */
#notifications {
	position: absolute;
	bottom: 0;
	right: 1em;
	z-index: 4;
}
#notifications .notification {
	width: 40vw;
	margin-bottom: 1em;
	border-radius: .25em;
	overflow: hidden;
	border-width: 2px;
	border-style: solid;
	border-color: var(--border-color);
}
#notifications .notification > .heading {
	font-size: 1.2em;
	min-height: 1.2em;
	text-align: center;
	padding: 0.5em 1em 0.5em 1em;
	font-weight: bold;
	position: relative;
	background-color: var(--heading-background-color);
	color: var(--heading-color);
}
#notifications .notification > .body:not(:empty) {
	text-align: center;
	background-color: var(--body-background-color);
	color: var(--body-color);
}
#notifications .notification > .body:not(:empty):not(.compact) {
	padding: 1em;
}
#notifications .notification > .body > button {
    border: none;
	background-color: inherit;
	padding: 1em;
	width: 100%;
	color: var(--body-color);
	font-family: inherit;
	font-size: 1em;
}
#notifications .error {
	--border-color: firebrick;
	--heading-background-color: orangered;
	--heading-color: white;
	--body-background-color: white;
	--body-color: red;
}
#notifications .success {
	--border-color: green;
	--heading-background-color: limegreen;
	--heading-color: white;
	--body-background-color: white;
	--body-color: green;
}
#notifications .info {
	--border-color: blue;
	--heading-background-color: var(--primary-color);
	--heading-color: white;
	--body-background-color: white;
	--body-color: blue;
}
/* animation */
.fadeout {
	animation-name: fadeout;
	animation-duration: var(--animation-duration);
	animation-iteration-count: 1;
	transition-timing-function: ease-out;
}
.shrinkbox {
	border-color: inherit; /* pass through to shrinkbar */
	background-color: #aaa;
}
.shrinkbar {
	border-top: 0;
	border-left: 0;
	border-right: 0;
	border-color: inherit;
	border-bottom-width: 2px;
	border-style: solid;
	animation-name: shrinkwidth;
	animation-duration: var(--animation-duration);
	animation-iteration-count: 1;
	transition-timing-function: ease-out;
	width: 0;
}
.shrinkbar::after {
	content: "";
	background-color: red;
	width: 100%;
}
.shake {
	animation-name: shake;
	animation-iteration-count: 3;
	animation-duration: .1s;
	animation-timing-function: ease-out;
}
@keyframes fadeout {
	0% {
		opacity: 1;
	}
	90% {
		opacity: 1;
	}
	100% {
		opacity: 0;
	}
}

@keyframes shrinkwidth {
	from {
		width: 100%;
	}
	to {
		width: 0;
	}
}
@keyframes shake {
	0% {
		transform: translateX(0px);
	}
	33% {
		transform: translateX(3px);
	}
	66% {
		transform: translateX(-3px);
	}
}
