/*
 *	common definitions
 */

:root {
	/* colors from https://developer.apple.com/design/human-interface-guidelines/foundations/color/ */
	--tintcolor: #ff9500;

	--orangecolor: #ff9500;
	--lighterorangecolor: #ffca81;

	--graycolor: gray;

	--greencolor: #34c759;
	--lightergreen: #8bc79c;
	--evenlightergreen: #c2ffd2;

	--redcolor: #ff3b30;

	--bluecolor: #2898ff;
    --lighterbluecolor: #b2daff;

	--yellowcolor: #ffcc00;
	--disabledgraycolor: #808080;
	--helpgraycolor: #c0c0c0;
	--devicegraycolor: #ababab;

	--brightbackgroundcolor: #34485d;
	--backgroundcolor: #253343;
	--darkbackgroundcolor: #1f2a37;

	--levelplaceholder-color: var(--redcolor);
	--level1-color: var(--greencolor);
	--level2-color: var(--bluecolor);
	--level3-color: var(--tintcolor);
	--level4-color: var(--yellowcolor);
	--formula-height: 32px;
	--formula-narrowing: -6px;
	--dialogbackground-color: var(--bluecolor);

	--standard-font-size: 16pt;
	--headline-font-size: 24pt;
	--title-font-size: 56pt;
}

body {
	margin: 0;
	padding: 0; }

body, input, select, dialog, textarea {
	font-family: Arial, Helvetica, Sans-Serif;
	font-size: var(--standard-font-size);
	background-color: var(--backgroundcolor);
	color: #ffffff; }

input:invalid {
	border: 2px dashed red; }

input, textarea {
	border: 1px solid lightgray; }

button {
	border: none;
	color: white;
	background-color: var(--graycolor);
	padding: 5px 8px;
	vertical-align: baseline;
	text-align: center;
	text-decoration: none;
	display: inline-block;
	border-radius: 6px;
	font-size: var(--standard-font-size); }

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

.minibutton {
	background: var(--tintcolor);
	font-weight: bold;
	padding-left: 4px;
	padding-right: 4px;
	padding-top: 0px;
	padding-bottom: 0px;
	border-radius: 6px;
	display: inline-block;
	text-align: center;
	width: 20px;
}

.offline {
	background: var(--redcolor);
	font-weight: bold;
	text-align: center;
	margin-top: 20px;
	margin-bottom: 20px;
}

ol {
	margin-left: 20pt; }

sup {
	line-height: 0; }

h2 {
	font-size: var(--headline-font-size);
	font-weight: bold;

	padding-bottom: 10px; }

.error {
	color: var(--redcolor); }

.disabled {
	color: var(--disabledgraycolor); }

.help {
	color: var(--helpgraycolor);
	font-style: italic; }

td.help {
	color: var(--helpgraycolor);
	font-style: italic; }

.timerange {
	color: var(--helpgraycolor);
	font-size: var(--standard-font-size);
	font-style: italic; }

/*
 *	switch layout
 */

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--tintcolor);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--tintcolor);
}

input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/*
 *	select layouts
 */

select {
 	background: transparent;
 	color: var(--tintcolor);
 	border: none;
 	appearance: none;
 	border-radius: 0px;
 	padding-left: 0px;
}

select:invalid {
	border: 2px dashed red;
}

/*
 *	classes to format tabled uniformly
 */

th {
	font-size: var(--standard-font-size);
	font-weight: bold;
	padding-left: 0px;
	padding-right: 20px;
	padding-top: 0px;
	padding-bottom: 10px;
	text-align: left;
}

td {
	font-size: var(--standard-font-size);
	padding-left: 0px;
	padding-right: 20px;
	padding-top: 0px;
	padding-bottom: 10px;
	text-align: left;
}

table.stats {
	width: 100%;
}

table.stats td:first-child {
	width: 100%;
}

table.stats td:last-child {
	padding-right: 0px;
}

table.settings {
}

table.settings td:first-child {
	width: 300pt;
}

table.details {
}

table.details td:last-child {
	width: 100%;
}

table td, table td * {
    vertical-align: baseline;
}

/*
 *	format links
 */

a:link {
  color: var(--tintcolor);
  text-decoration: none;
}

/* visited link */
a:visited {
  color: var(--tintcolor);
  text-decoration: none;
}

/* mouse over link */
a:hover {
  color: var(--tintcolor);
  text-decoration: none;
}

/* selected link */
a:active {
  color: var(--tintcolor);
  text-decoration: none;
}

/*
 *	waiting icon
 */
.waiting-icon {
	position: absolute;
	right: 0;
	top: 0;
	width: 32px;
	height: 32px;
}

/*
 * 	dialogs
 */

dialog {
  background-color: var(--brightbackgroundcolor);
  border: none;
  border-radius: 20px;
}

.dialogtitle {
	font-size: var(--standard-font-size);
	font-weight: bold;
	color: white;
}

/*
 *	display formulas
 */

.formula {
	display: inline-block;
	height: var(--formula-height);
	vertical-align: middle;
	float:left;
	clear:none;
	margin-top: 2px; /* for multiline display */
	margin-bottom: 2px; /* for multiline display */
}

.levelplaceholder {
	fill: var(--levelplaceholder-color);
}

.level1 {
	fill: var(--level1-color);
}

.textlevel1 {
	background: var(--level1-color);
	color: white;
	line-height: var(--formula-height);
}

.level2 {
	fill: var(--level2-color);
}

.textlevel2 {
	background:var(--level2-color);
	color:white;
	line-height: var(--formula-height);
}

.level3 {
	fill: var(--level3-color);
}

.textlevel3 {
	background: var(--level3-color);
	color:white;
	line-height: var(--formula-height);
}

.level4 {
	fill: var(--level4-color);
}

.textlevel4 {
	background: var(--level4-color);
	color:white;
	line-height: var(--formula-height);
}

.narrowleft {
	margin-left: var(--formula-narrowing);
}

.narrowright {
	margin-right: var(--formula-narrowing);
}

.planSVG {
	width: 100%;
	height: auto;
	background-color: var(--darkbackgroundcolor);
}

/*
 *	Input fields in conditions
 */

.condition {
  background-color: transparent;
  border: 0;
  margin-top: 2px;
}

/*
 *	Popup support - used for help
 */

/* Popup container - can be anything you want */
.popup {
	position: relative;
	display: inline-block;
	cursor: pointer;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

/* The actual popup */
.popup .popuptext {
	visibility: hidden;
  	min-width: 240px;
	background-color: var(--brightbackgroundcolor);
	color: #ffffff;
	text-align: center;
	border-radius: 6px;
	padding: 8px 0;
	position: absolute;
	z-index: 1;
	bottom: 125%;
	left: 50%;
	margin-left: -80px;
}

/* Popup arrow */
.popup .popuptext::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	margin-left: -5px;
	border-width: 5px;
	border-style: solid;
	border-color: #555 transparent transparent transparent;
}

/* Toggle this class - hide and show the popup */

.popup .show {
	visibility: visible;
  	-webkit-animation: fadeIn 1s;
  	animation: fadeIn 1s;
}

/* Add animation (fade in the popup) */
@-webkit-keyframes fadeIn {
	from {opacity: 0;}
	to {opacity: 1;}
}

@keyframes fadeIn {
	from {opacity: 0;}
	to {opacity:1 ;}
}

/* pull to refresh support */

body {
	overscroll-behavior-y: auto;
}

.pull-to-refresh {
	position: fixed;
	top: -50px;
	width: 100%;
	height: 60px;
	display: flex;
	justify-content: center;
	align-items: center;
	transition: top 0.7s ease-in-out;
}

.pull-to-refresh.visible {
	top: 0;
}

/* slider support */

.range-slider {
	-webkit-appearance: none;
	width: 100%;
	height: 15px;
	border-radius: 5px;
	border-color: var(--graycolor);
	background: var(--graycolor);
	outline: none;
	-webkit-transition: .2s;
	transition: opacity .2s;
}

.range-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 25px;
	height: 25px;
	border-radius: 50%;
	background: var(--tintcolor);
	cursor: pointer;
}

.range-slider::-moz-range-thumb {
	width: 25px;
	height: 25px;
	border-radius: 50%;
	background: var(--tintcolor);
	cursor: pointer;
}


