/**
 * Copyright 2018 Google LLC. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * =============================================================================
 */

html, body {
  background: #2a2a2a;
  font-family: 'Roboto', sans-serif;
  margin: 0;
  padding: 0;
}
body {
  display: flex;
  flex-direction: column;
}
button:focus {
  outline: 0;
}

/** Page header. **/
header {
  background-color: #ef6c00;
  border-bottom: solid 1px rgba(0,0,0,0.4);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  color: rgba(255, 255, 255, 0.7);
  font-size: 30px;
  font-weight: 300;
  line-height: 1.45em;
  overflow: hidden;
  padding: 20px 0;
  position: relative;
  text-align: center;
  -webkit-font-smoothing: antialiased;
}
header b {
  color: rgba(255, 255, 255, 1);
  font-weight: 400;
}

/** Loading message. */
#status {
  color: #f8f8f8;
  font-weight: 300;
  margin: 12px 0;
  text-align: center;
}

/* Rules for the pacman game. */
#pacman-container {
  background: black;
  padding: 25px 0 40px;
}
/** Controls. **/
.controller-panels {
  display: flex;
  flex-direction: column;
  margin: 9px auto 0;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  background: rgba(255, 255, 255, 0.4);
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #00748d;
}
.panel {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  flex-shrink: 0;
}
.panel:first-child {
  border-bottom: 1px dashed #565656;
  padding: 0 22px 0 13px;
  width: 100%;
}
.panel:last-child {
  padding: 0 9px 0 22px;
  width: 100%;
  max-width: 90%;
}
.panel-row {
  display: flex;
  flex-direction: row;
}
.panel-cell {
  align-items: center;
  display: flex;
  flex-direction: column;
  flex-grow: 0;
  justify-content: center;
  position: relative;
}
.panel-cell-fill {
  flex-grow: 1;
}
.panel-cell p {
  color: #171717;
  font-size: 10px;
  margin: 0;
  padding: 0;
  text-align: center;
}
.controller-panels button {
  background: none;
  border: none;
  box-sizing: border-box;
  cursor: pointer;
  margin: 0;
  padding: 0;
}
#train-status {
  width: 124px;
}

/** Training panel. **/
.big-buttons {
  justify-content: space-between;
}
.big-buttons button, .mdl-button{
  min-width: 150px;
  background: #00748D;
  color: #FFF;
}
.params-webcam-row {
  align-items: flex-start;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  margin-top: 35px;
}
.webcam-box-outer {
  background: black;
  border: 1px solid #585858;
  border-radius: 4px;
  box-sizing: border-box;
  display: inline-block;
  padding: 9px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}
.webcam-box-inner {
  border: 1px solid #585858;
  border-radius: 4px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}
#webcam{
  transform: scaleX(-1);
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
}
.hyper-params {
  display: flex;
  flex-direction: column;
  margin-left: 12px;
}
.dropdown {
  flex-direction: column;
  width: 110px;
  margin-bottom: 10px;
}
.dropdown label {
  color: #777;
  font-size: 11px;
  display: block;
  font-weight: 300;
  line-height: 1;
}
.dropdown .select {
  position: relative;
}
.dropdown .select select {
  -webkit-appearance: none;
  -moz-appearance: none;
  background: none;
  border: none;
  border-bottom: solid 1px #313131;
  border-radius: 0;
  color: #c9c9c9;
  display: block;
  font-size: 12px;
  outline: none;
  padding: 6px 0;
  width: 100%;
}
.dropdown .select::after {
  content: "arrow_drop_down";
  color: #999;
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  position: absolute;
  right: 0;
  top: 6px;
  pointer-events: none;
}

/** Joystick panel. **/
.joystick-panel {
  margin-top: 13px;
}
.panel-cell .help-text {
  font-size: 17px;
  font-style: italic;
  left: 0;
  line-height: 1.1;
  margin: 0;
  padding: 0;
  text-align: center;
}

.panel-row-middle .panel-cell {
  height: 132px;
}
.thumb-box {
  display: inline-block;
}
.panel-row-middle .thumb-box {
  margin-top: 18px;
}
.thumb-box-outer {
  background: #00748D;
  border: 1px solid #FFF;
  border-radius: 4px;
  box-sizing: border-box;
  display: inline-block;
  padding: 9px;
  position: relative;
  transition: box-shadow 0.3s;
}
[data-active="up"] .panel-row-top .thumb-box-outer,
[data-active="down"] .panel-row-bottom .thumb-box-outer,
[data-active="left"] .panel-cell-left .thumb-box-outer,
[data-active="right"] .panel-cell-right .thumb-box-outer {
  box-shadow: 0 0 4px 4px #ffaa00;
}
.thumb-box-inner {
  border: 1px solid #FFF;
  border-radius: 4px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  overflow: hidden;
  width: 66px;
}
.thumb {
  height: 66px;
  transform: scaleX(-1);
}
.thumb-box-outer .record-button {
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
}
.thumb-box-outer .record-button span {
  background: #FFF;
  border: 1px solid #EEE;
  border-radius: 3px;
  bottom: 9px;
  color: #00748D;
  display: block;
  font-size: 8px;
  left: 9px;
  position: absolute;
  right: 9px;
  opacity: 0.5;
}

/** Footer. **/
#copyright {
  color: #f8f8f8;
  font-weight: 300;
  margin: 12px 0;
  text-align: center;
}

#no-webcam {
  display: none;
  text-align: center;
  font-size: 80px;
  color: #f90000;
  padding: 30px;
  line-height: 80px;
  z-index: 999999;
}

*:not(.webcam-box-outer){
  z-index: 99;
}

.controller-panels:not(.examples-ready) .joystick-panel{
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  transform-origin: top left;
  background: rgba(255, 255, 255, 0.4);
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #00748d;
}

.controller-panels:not(.examples-ready) .training-panel{
  display: none;
}
.controller-panels:not(.training-ready) .training-panel, .controller-panels.training-ready:not(.playing) .training-panel{
  width: 100vw;
  position: fixed;
  top: 0;
  left: 0;
}

.controller-panels:not(.training-ready) .training-panel .panel-row, .controller-panels.training-ready:not(.playing) .training-panel .panel-row{
  width: 100%;
}

.controller-panels:not(.training-ready) #train{
  width: 50%;
  margin: 0 auto;
  transform: translateY(25vh);
}

.controller-panels:not(.training-ready) #predict{
  display: none;
}

.controller-panels.training-ready:not(.playing) #predict{
  width: 50%;
  margin: 0 auto;
  transform: translateY(25vh);
}

.controller-panels.training-ready:not(.playing) #train{
  display: none;
}

.controller-panels.playing {
  background: rgba(255, 255, 255, 0.4);
  padding-top: 16px;
}

#ctx{
  pointer-events: none;
  width: calc(100vw - 5px);
  max-height: calc(100vh - 300px);
  margin: 0 auto;
  box-sizing: border-box;
  background-size: 100% auto !important;
  background-position: center center !important;
}

.controller-panels.playing ~ #ctx{
  border-radius: 5px;
  border: 1px solid #00748d;
  margin-top: 8px;
}

.full-width{
  width: 100%;
}

.panel-cell .help-text.text-warning{
  margin: 0 auto;
  background-color: #FFF9C4;
  padding: 16px;
  margin: 6px;
  border-radius: 2px;
  color: #212121;
}
.panel-cell .help-text.playing-text{
  margin: 0 auto;
  background-color: teal;
  padding: 4px;
  border-radius: 2px;
  color: #FFF;
}

.controller-panels.playing .text-warning, .controller-panels.playing .prep-text{
  display: none;
}
.controller-panels.playing .playing-text{
  display: block !important;
}

.cards {
  display: flex;
  flex-flow: wrap;
}

.demo-card-image.mdl-card {
  width: 256px;
  height: 256px;
  margin: 4px;
  flex-grow: 1;
}
.demo-card-image > .mdl-card__actions {
  height: 52px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
}
.demo-card-image__filename {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.margin-bottom {
  margin-bottom: 16px;
}

@media only screen and (min-width: 720px) {
  .controller-panels:not(.examples-ready) .joystick-panel:before {
    content: '';
    background: url(images/pointer.svg) no-repeat;
    position: absolute;
    width: 20%;
    height: 100px;
    bottom: 100px;
    right: 100px;
  }
  
  .controller-panels:not(.examples-ready) .joystick-panel:after {
    content: '';
    background: url(images/pointer.svg) no-repeat;
    position: absolute;
    width: 20%;
    height: 100px;
    bottom: 100px;
    left: 100px;
    transform: scaleX(-1);
  }
}