body {
    font-family: helvetica, arial, sans-serif;
    width: 100%;
    height: 100%;
    margin: 0;
    display: flex;
    flex-flow: column wrap;
    box-sizing: border-box;
}

#loading {
    display: inherit;
    position: absolute;
    z-index: 1000;
    width: 100%;
    height: 100%;
    display: grid;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
}

#loading span {
    padding: 20px;
    font-weight: bold;
    background: white;
    border-radius: 5px;
}

header {
    margin: 0 auto;
}

#logo {
    width: 224px;
    padding: 11px 16px;
    text-align: center;
}

h1 {
    flex-grow: 1;
    margin: 0;
    padding-left: 16px;
    padding-bottom: 4px;
}

#links ul {
    padding-left: 7px;
    list-style: none;
    margin: 3px 0;
}

#links li {
    font-size: .9em;
}

#links a,
#links a:visited {
    color: black;
    text-decoration: none;
    line-height: 20px;
}

#links a:hover {
    text-decoration: underline;
}

#links a img {
    height: 20px;
    vertical-align: middle;
    padding-right: 6px;
}

section {
    width: 100%;
    display: flex;
    flex-flow: row nowrap;
}

fieldset {
    border: none;
    margin: 5px;
    line-height: 1.6em;
}
 
fieldset#video-params {
    background-color: #3DC0C2;
}
fieldset legend {
    font-size: 0.9em;
    background-color: gainsboro;
    text-transform: uppercase;
    padding: 0px 10px;
}

#input-error {
    padding-top: 5px;
    display: block;
    color: red;
    font-size: small;
    line-height: 1.2em;
}

.hide {
    display: none;
}

input[type=number] {
    text-align: right;
    width: 60px;
}

#model-params,
#video-params,
#controls fieldset {
    flex-grow: 2;
}

#capture-params {
    display: flex;
    align-items: center;
}

#capture-params input {
    margin-left: 5px;
    margin-right: 20px;
}

#demo-params {
    position: relative;
    width: 200px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Start the shake animation and make the animation last for 0.5 seconds */
    animation: glowing 1s, shake 0.25s;
    animation-delay: 5s, 5.25s;
  
    /* When the animation is finished, start again */
    animation-iteration-count: 1, 2;
}
  
@keyframes shake {
      0% { transform: rotate( 0deg); }
     25% { transform: rotate(-2deg); }
     75% { transform: rotate( 2deg); }
    100% { transform: rotate( 0deg); }
}

@keyframes glowing {
      0% { box-shadow: 0 0 0px darkgray; bottom: 0px; left: 0px; }
     25% { box-shadow: -3px 3px 3px darkgray; bottom: 3px; left: 3px; background-color: #237E8B; }
     75% { box-shadow: -3px 3px 3px darkgray; bottom: 3px; left: 3px; background-color: #237E8B; }
    100% { box-shadow: 0 0 0px darkgray; bottom: 0px; left: 0px;}
}

#processing {
    display: flex;
    flex-flow: row nowrap;
}

.pre-post-params {
    display: flex;
    flex-flow: column nowrap;
}

.pre-post-params fieldset {
    display: flex;
    flex-direction: column;
    width: 200px;
}

.pre-post-params label {
    display: inline-flex;
    justify-content: space-between;
    align-items: center;
}

.pre-post-params input[type=checkbox] {
    margin: auto 0;
    width: 65px;
}

#roi-coords {
    display: flex;
    justify-content: space-between;
}

#roi-coords label {
    width: 48%;
}

#net-input {
    width: 100%;
}

#triggers-params {
    flex-wrap: wrap;
    flex-direction: row !important;
    justify-content: space-between;
}

.control-trigger {
    width: 48%;
    margin: 2px;
}

#control-thr,
#control-contrast,
#control-brightness,
#control-gamma {
    width: 100%;
}

#control-preproc-reset {
    margin-top: 5px;
}

#video-params legend {
    display: flex;
    align-items: center;
}

#video-params legend label {
    margin-left: 15px;
}

#backend-preview {
    font-size: .75em;
    text-transform: none;
}

.accelerated {
    color: green;
}

.non-accelerated {
    color: red;
}

#preview {
    padding: 0;
    border: 0;
    margin: 0;
    position: relative;
    display: inline-block;
}

#roi {
    overflow: auto;
    position: absolute;
    border: 1px dashed red;
    margin: 0;
    padding: 0;
    background-color: red;
    opacity: 0.5;
    z-index: 7;
    box-sizing: content-box;
    overflow: hidden;
    pointer-events: none;
}

#roi-dragger,
#roi-resizer {
    pointer-events: auto;
    position: absolute;
    height: 20%;
    width: 20%;
    min-width: 24px;
    min-height: 24px;
    max-width: 32px;
    max-height: 32px;
    display: block;
    z-index: 9;
    background-size: 80%;
    background-repeat: no-repeat;
    background-position: center center;
    border: 0;
    padding: 0;
    margin: 0;
}

#roi-dragger {
    top: 0;
    left: 0;
    background-image: url("../img/baseline_open_with_white_18dp.png");
}

#roi-dragger:hover {
    cursor: move;
}

#roi-resizer {
    bottom: 0;
    right: 0;
    background-image: url("../img/baseline_open_in_full_white_18dp.png");
    -webkit-transform: scaleX(-1);
    -moz-transform: scaleX(-1);
    -o-transform: scaleX(-1);
    transform: scaleX(-1);
    filter: FlipH;
    -ms-filter: "FlipH";
}

#roi-resizer:hover {
    cursor: se-resize;
}

#roi canvas {
    resize: both;
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    border: 0;
    box-sizing: border-box;
    z-index: 8;
}

[draggable=true] {
    -khtml-user-drag: element;
}

#pupil-x,
#pupil-y {
    z-index: 10;
    display: none;
    position: absolute;
    box-sizing: border-box;
}

#pupil-x {
    top: 0;
    width: 1px;
    border-right: 1px dashed rgba(255, 0, 0, 0.7);
}

#pupil-y {
    left: 0;
    height: 1px;
    border-bottom: 1px dashed rgba(255, 0, 0, 0.7);
}

#pupil-x span,
#pupil-y span {
    position: absolute;
    font-size: small;
    font-family: monospace;
    padding: 0;
}

#pupil-x span {
    width: 100px;
    top: calc(100% + 5px);
    left: -50px;
    line-height: 10px;
    text-align: center;
}

#pupil-y span {
    line-height: 32px;
    top: -16px;
    left: calc(100% + 5px);
}

video {
    display: inline-block;
    z-index: 5;
}

#controls fieldset > *:not(legend) {
    margin: 0 16px;
}

#outputs {
    height: 256px;
    width: 100%;
    padding-bottom: 30px;
    justify-content: space-around;
}

.out {
    padding: 0;
    height: 100%;
    background-color: transparent;
}

.out legend {
    box-sizing: border-box;
    width: 100%;
    text-align: left;
    padding-left: 22px;
    display: inline-flex;
    justify-content: space-between;
    flex-flow: row nowrap;
}

.out .flex-legend {
    width: 100%;
    display: inline-flex;
    justify-content: space-between;
    flex-flow: row nowrap;
}

.out legend label {
    margin-left: 30px;
    text-transform: none;
    vertical-align: middle;
}

.out legend span {
    font-size: 0.8em;
    flex-grow: 1;
    text-align: right;
}

.out legend input[type="checkbox"] {
    margin-top: 0;
    margin-bottom: 3px;
    vertical-align: middle;
}

#out-graph {
    flex-grow: 1;
}

#sample-count:before {
    content: '(';
}

#sample-count:after {
    content: ')';
}

#sample-count {
    margin-left: 5px;
    font-size: 0.8em;
    vertical-align: baseline;
}


#trace {
    font-family: monospace;
    font-size: small;
    width: 100%;
    border-collapse: collapse;
}

#sticky-header {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    overflow-y: scroll;
}

#trace th {
    position: sticky;
    top: 0;
    background-color: gainsboro;
    padding-top: 5px;
    padding-bottom: 5px;
}

#trace th,
#trace td {
    text-align: right;
    line-height: 1em;
    white-space: nowrap;
    min-width: 20px;
    padding-right: 5px;
    padding-left: 5px;
}

#trace-data tr:nth-child(even) {
    background-color: #eee;
}

footer {
    padding: 11px;
    background-color: #237E8B;
    color: white;
    margin: 0;
    font-size: .8em;
    text-align: center;
}

footer p { margin: 5px 0; }
footer span { margin: 0 10px; }
footer a,
footer a:visited { color: white; }
footer a:hover { text-decoration: none; }
