:root {
  --menu-width: 200px;
  --content-padding: 20px;

  /* Buttons */
  --button-color-top: #4C4;
  --button-color-bottom: #070;
  --button-padding: 6px;
}

body {
  margin: 0;
  padding: 0;
  font: 14pt Arial;
}

.flex-col {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  min-height: 0;
}
.flex-item {
  flex: 1;
}

.flex-row {
  display: flex;
  flex-direction: row;
}

.topbar {
  background: linear-gradient(to bottom, #77f, #13a);
  text-align: left;
  color: white;
  font-size: 20px;
  font-weight: bold;
  padding: 5px;
  z-index: 100;
  height: 30px;
  max-height: 30px;
}
.topbar .vert-center > * {
  padding-right: 10px;
}

.vert-center {
  display: table;
  height: 100%;
}
.vert-center > * {
  vertical-align: middle;
  display: table-cell;
}

.main-container {
  height: calc(100vh - 40px);
  max-height: calc(100vh - 40px);
  max-width: 100vw;
}

/* Navigation menu */
.menu {
  overflow: scroll;
  width: var(--menu-width);
  min-width: var(--menu-width);
  background: white;
  border-right: solid 1px #ccc;
  height: 100%;
}

.menu a {
  color: black;
  padding: 8px 16px;
  /* Subtract horizontal padding, must match above value */
  width: calc(100% - 2*16px);
  text-decoration: none;
  font-size: 18px;
  font-weight: bold;
  display: block;
  text-align: left;
}

.menu a:hover {
  background-color: #ccc;
}

.menu a.active {
  background: linear-gradient(to bottom, #bbf, #79c);
}

.menu-holder {
  height: 100%;
  z-index: 50;
}

.menu-placeholder {
  flex: 0;
  z-index: -100;
  width: 0px;
}

#menu-display {
  display: none;
}
.backdrop {
  display: none;
}
#hamburger {
  display: none;
}

/* Child content */
.content {
  overflow: scroll;
  flex: 1;
  padding: var(--content-padding);
}

/* Main error display (generated from Flask/Jinja) */
.flashed-error {
  background: #b00; /* scary errors */
  color: white;
  margin: 5px;
  padding: 5px;
  width: 100%;
  border-radius: 5px;
}

/* Side error display (generated from JS) */

.error-text {
  color: red;
  font-weight: bold;
}

#side-errors {
  position: fixed;
  right: 10px;
  max-width: 300px;
  list-style: none;
}
#side-errors > li {
  background: #f31;
  color: white;
  margin: 5px;
  padding: 5px;
}

/* Buttons */

.button {
  background: linear-gradient(to bottom, var(--button-color-top),
    var(--button-color-bottom));
  color: #FFF;
  font-weight: bold;
  border: 6px transparent;
  border-radius: 4px;
  padding: var(--button-padding);
  box-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}

.button:active {
  background: linear-gradient(to top, var(--button-color-top),
    var(--button-color-bottom));
}

.button.disabled {
  --button-color-top: #ddd;
  --button-color-bottom: #ccc;
}

.blue-button {
  --button-color-top: #44F;
  --button-color-bottom: #00A;
}

.grey-button {
  --button-color-top: #666;
  --button-color-bottom: #444;
}

.delete {
  margin-right: 10px;
  --button-color-top: #F44;
  --button-color-bottom: #A00;
}

.right {
  float: right;
}

.small-button {
  --button-padding: 2px 8px 2px 8px;
}

/* Toggle switches */
.toggle {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 30px;
  height: 12.5px;
  display: inline-block;
  position: relative;
  border-radius: 30px;
  outline: none;
  border: none;
  cursor: pointer;
  background-color: #777;
  transition: background-color ease 0.3s;
}

.toggle:before {
  content: " ";
  display: block;
  position: absolute;
  z-index: 2;
  width: 18px;
  height: 18px;
  background: #fff;
  left: -3px;
  top: -3px;
  border-radius: 50%;
  color: #aaa;
  white-space: nowrap;
  box-shadow: 1px 3px 4px rgba(0,0,0,0.5);
  transition: all cubic-bezier(0.3, 1.5, 0.7, 1) 0.3s;
}

.toggle:checked {
  background-color: #5b5;
}

.toggle:checked:before {
  background: #5e5;
  left: 15px;
}

/* Slider */
input[type=range] {
  -webkit-appearance: none;
  border: 1px solid transparent;
  margin: 0px;
  width: 200px;
  background: transparent;
}


input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 12px;
  width: 12px;
  margin-top: -3px;
  cursor: grab;
  border-radius: 50%;
  border: 2px solid #adf;
  background-color: #fff;
}

input[type=range]::-moz-range-thumb {
  -webkit-appearance: none;
  height: 12px;
  width: 12px;
  margin-top: -3px;
  cursor: grab;
  border-radius: 50%;
  border: 2px solid #adf;
  background-color: #fff;
}

input[type=range]::-ms-thumb {
  -webkit-appearance: none;
  height: 12px;
  width: 12px;
  margin-top: -3px;
  cursor: grab;
  border-radius: 50%;
  border: 2px solid #adf;
  background-color: #fff;
}



input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 5px;
  background: #bbb;
  border: none;
  border-radius: 3px;
  color: transparent;
}
.color-temp-slider > input[type=range]::-webkit-slider-runnable-track {
  background: linear-gradient(to right, #F40, #58F);
}

input[type=range]::-moz-range-track {
  width: 100%;
  height: 5px;
  background: #bbb;
  border: none;
  border-radius: 3px;
  color: transparent;
}
.color-temp-slider > input[type=range]::-moz-range-track {
  background: linear-gradient(to right, #F40, #58F);
}

input[type=range]::-ms-track {
  width: 100%;
  height: 5px;
  background: #bbb;
  border: none;
  border-radius: 3px;
  color: transparent;
}
.color-temp-slider > input[type=range]::-ms-track {
  background: linear-gradient(to right, #F40, #58F);
}


input[type=range]:focus {
  outline: none;
}

input[type=range]:-moz-focusring {
  outline: 1px solid transparent;
  outline-offset: -1px;
}

input[type=text] {
  border: 1px solid #ccc;
  padding: 2px;
  border-radius: 3px;
}

.filter {
  border: 1px solid #ccc;
  padding: 4px;
  border-radius: 20px;
  width: 230px;
  float: right;
}
.filter > * {
  font-size: 16px;
}

/* Magnifying glass */
.filter::before {
  content: '\1F50D';
}

.filter > input {
  border: none;
  width: 200px;
}

#loading-status {
    position: fixed;
    width: 180px;
    height: 60px;
    left: 0;
    bottom: 0;
    background-color: #eee;
    z-index: 9999;
    display: none;
    border: 1px solid #999;
}
#loading-status > * {
    vertical-align: middle;
}

@-webkit-keyframes loading-spin {
	from { -webkit-transform: rotate(0deg); }
	to { -webkit-transform: rotate(360deg); }
}
@keyframes loading-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}
#loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    margin: 10px;
    border: 8px solid;
    border-color: #888 #888 #888 transparent;

    border-radius: 50%;
    animation: loading-spin 1s linear infinite;
    -webkit-animation: loading-spin 1s linear infinite;
}

.small-loader {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 5px solid #bbb;
    border-color: #666 #bbb #bbb #bbb;

    border-radius:50%;
    -webkit-animation: spin 1.4s linear infinite;
    animation: spin 1.4s linear infinite;
}

form {
  margin-bottom: 0;
}
.inline-form {
  display: inline;
}

.aside {
  font-size: 14px;
  background-color: #DDD;
  width: 400px;
  padding: 5px;
}
.aside > * {
  margin: 5px;
}

label.disabled {
  color: #CCC;
}

.notification {
  color: #888;
  font: 10pt Arial;
  font-style: italic;
}

.spacer {
  margin-left: 20px;
}

.vert-spacer {
  margin-bottom: 20px;
}

.columns {
  columns: 2;
  max-width: 900px;
}
.columns > * {
  break-inside: avoid;
  overflow: hidden;
  margin-right: 20px;
}

.header {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 5px;
}

h3 {
  background-color: #ddf;
  border-radius: 6px;
  padding: 4px;
}

.info-block {
  margin-bottom: 20px;
}

.fixed-width {
  margin: 0;
  font-size: 12px;
  font-family: monospace;
}

.info {
  margin: 0;
  font-size: 14px;
  font-style: italic;
  color: #555;
  max-width: 800px;
  display: inline-block;
}

.small-text {
  font-size: 14px;
}

/* Expand/collapse */
.detail {
  max-height: 0px;
  overflow: hidden;
}

.expander {
  display: none;
}

.expander:checked ~ .detail {
  max-height: unset;
}

.expanded {
  max-height: unset;
}

.expander:checked ~ .collapsed {
  display: none;
}
.expander:unchecked ~ .collapsed {
  display: block;
}

.expander ~ label .expander-arrow {
  display: inline-block;
  transition: transform 0.3s;
}
.expander:checked ~ label .expander-arrow {
  transform: rotate(90deg);
}

/* Device style */

.detail { padding-left: 50px; }
.detail * { font-size: 10pt; }
.detail h4 {
  margin: 0px;
}
.pre {
  font-family: monospace;
}

.device {
  display: block;
  margin: 5px;
  line-height: 30px;
}
.device > span {
  display: inline-block;
}
.device > * {
  vertical-align: middle;
}
.device > span > * {
  display: inline-block;
  vertical-align: middle;
}

.small-spacey * {
    margin-right: 3px;
}

#broadcast {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 20px;
}


.checkbox {
  display: none;
}
.checkbox + label {
  height: 24px;
  width: 24px;
  background: #ccc;
  border: 1px solid #444;
  display: inline-block;
  font-size: 12pt;
  margin: 1px;
  font-weight: bold;
  dominant-baseline: central;
  vertical-align: middle;
  text-align: center;
}
.checkbox:checked + label {
  background: #0d0;
}

/* Popup stuff */
.popup-holder {
  z-index: 100;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: row;
  align-items: center;
  align-content: center;
}
.popup-holder::before, .popup-holder::after {
  flex: 1;
  content: "";
}

.popup {
  flex: 1;
  font-size: 16px;
  max-height: 80vh;
  min-width: 300px;
  max-width: 80vw;
  background: #fff;
  border-radius: 6px;
  padding: 20px;
  overflow: scroll;
}

/* Make the popup smaller if the screen is small */
@media screen and (max-height: 800px) {
  .popup {
    font-size: 14px;
  }
}

.popup-backdrop {
  display: inline;
  height: 100vh;
  width: 100vw;
  position: fixed;
  background: rgba(0,0,0,.7);
  top: 0;
  left: 0;
  z-index: -100;
}

/* Style overrides for phones/small windows */
@media screen and (max-width: 1200px) {
  /* Menu hiding/hamburger stuff */
  #hamburger {
    display: inline;
  }
  .menu {
    transform: translate(calc(var(--menu-width) * -1));
    transition: transform 300ms;
  }
  #menu-display:checked ~ * > .menu {
    transform: translate(0px);
  }
  .menu-holder {
    max-width: 0px;
  }
  .menu-placeholder {
    display: none;
  }
  #menu-display:checked ~ * > .menu-backdrop {
    display: inline;
    height: 100vh;
    width: 100vw;
    position: fixed;
    background: rgba(0,0,0,.7);
    top: 0;
    z-index: -100;
  }

  .columns {
    columns: 1;
  }
  .columns > * {
    margin-right: 0px;
  }
  .detail {
    width: 100%;
    padding-left: 0px;
  }
  .filter {
    float: unset;
  }
}