* {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-size: 1.5em;
    line-height: 1.6;
    font-weight: 400;
    font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: #222;
    height: 100%;
    background: url(bg.png);
}

main {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

main > h2 {
    position: fixed;
    z-index: 1;
    bottom: 5px;
    right: 5px;
    margin: 0;
    color: #DADADA;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    pointer-events: none;
}

main > nav {
    flex-shrink: 0;
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-bottom: 1px solid #eee;
    z-index: 11;
}

main > nav > div {
    padding-top: 1rem;
    padding-right: 5px;
    margin-right: 5px;
    border-right: 1px solid #eee;
}

main > nav > div:last-child {
    padding-right: 0;
    margin-right: 0;
    border-right: none;
}

main > article {
    flex-grow: 1;
    display: flex;
}

button i.fa {
    font-size: 20px;
    vertical-align: -3px;
}

button i.fa.sml {
    font-size: 14px;
    vertical-align: -2px;
}

#new-device {
    flex-grow: 1;
}

#new-device select {
    max-width: 200px;
}

#navigation {
    display: flex;
    flex-grow: 99;
}

#navigation > input {
    flex-grow: 99;
}

#navigation > button {
    margin-left: 5px;
}

#zoom {
    position: relative;
    flex-grow: 1;
}

#zoom .zoom-value {
    position: absolute;
    text-align: center;
    left: 0;
    right: 5px;
    bottom: 8px;
    /* it partially covers the buttons */
    pointer-events: none;
}

.dropdown-menu {
    transition: opacity 300ms;
    opacity: 0;
    pointer-events: none;

    position: absolute;
    right: 0;
    background: white;
    width: 200px;
    padding: 5px;
    border: solid #eee 1px;
    margin-top: 10px;
    border-bottom-left-radius: 4px;
    z-index: 10;
}

.dropdown-menu.visible {
    opacity: 1;
    pointer-events: auto;
}

.dropdown-menu > button {
    width: 100%;
}

.device-list {
    flex-grow: 1;
    position: relative;
    overflow: scroll;
    align-items: center;
    padding-top: 10px;
    z-index: 2;
}

.device-list-item {
    background: black;
    border: solid black 5px;
    border-radius: 5px;
    display: inline-block;
    transition: all 300ms;
    margin: 10px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    vertical-align: middle;
}

.device-list-item:focus {
    outline: 0;
    -webkit-filter: drop-shadow(black 0px 0px 5px);
}

.device-list-item header {
    position: relative;
}

.device-list-item header h2 {
    font-size: 9px;
    background: black;
    color: white;
    margin: 0;
    padding-bottom: 2px;
    text-align: center;
    font-weight: normal;
}

.device-list-item header .fa-cog {
    color: white;
    text-shadow: 0 0 2px black;
    position: absolute;
    right: 2px;
    top: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms;
}

.device-list-item.loading .fa-cog {
    opacity: 1;
}

.device-list-item video {
    transition: all 300ms;
}

.device-menu {
    position: absolute;
    right: 0;
    top: -4px;
    opacity: 0;
    transition: opacity 300ms;
    z-index: 10;
    line-height: 15px;
}

.device-menu > i {
    cursor: pointer;
    color: white;
}

.device-list-item:hover .device-menu, .device-menu.visible {
    opacity: 1;
}

.device-menu > nav {
    display: none;
    background: white;
    position: absolute;
    width: 130px;
    right: 0;
    padding: 5px;
    border: solid #eee 1px;
    border-bottom-left-radius: 4px;
}

.device-menu > nav > button {
    width: 100%;
    padding: 0 10px;
}

.device-menu.visible > nav {
    display: block;
}

.video-placeholder {
    display: inline-block;
    position: relative;
    transition: all 300ms;
}

.video-placeholder-help {
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -6px;
    margin-top: -6px;
}

.video-placeholder-help > i.fa {
    color: white;
}

.video-placeholder-help > .popup {
    transition: opacity 300ms;
    opacity: 0;
    pointer-events: none;

    position: absolute;
    left: 0;
    background: white;
    padding: 5px;
    border: solid #eee 1px;
    margin-top: 10px;
    border-radius: 4px;
    z-index: 10;
    width: 175px;
    font-size: 0.9em;
}

.video-placeholder-help:hover > .popup {
    opacity: 1;
    pointer-events: auto;
}

.artwork {
    background-color: transparent;
    background-repeat: no-repeat;
    background-size: contain;
    border: none;
}

.artwork header h2 {
    display: none;
}

.artwork header .fa-cog {
    right: 2px;
    top: 2px;
}

.artwork .device-menu {
    top: -17px;
    right: 0;
}

body > * {
    transition: -webkit-filter 300ms, filter 300ms;
}

body.modal-open > * {
    -webkit-filter: blur(3px);
    filter: blur(3px);
}
body.modal-open > .modal {
    -webkit-filter: none;
    filter: none;
}

.modal {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 1000;
}

.modal .fog-of-war {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    background: rgb(186, 186, 186);
    opacity: 0.5;
}

.modal .content-wrapper {
    width: 450px;
    height: 300px;

    transition: all 300ms;

    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -200px;
    margin-top: -150px;

    background: white;
    border: solid #888 1px;
    border-radius: 4px;

    overflow: scroll;
}

.modal article {
    width: 100%;
    height: 100%;
}

.welcome-modal .step {
    display: none;
    width: 100%;
    height: 100%;
    text-align: center;
}

.welcome-modal .video-container {
    position: relative;
    margin-top: 50px;
}

.welcome-modal .video-container button.play {
    opacity: 1;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -39px;
    margin-top: -18px;
    background-color: white;

    transition: opacity 300ms;
}

.welcome-modal .video-container.playing button.play {
    opacity: 0;
    pointer-events: none;
}

.welcome-modal .step .video-container video {
    -webkit-filter: grayscale(1);
    filter: grayscale(1);
    opacity: 0.5;
    transition: opacity 100ms, -webkit-filter 100ms, filter 100ms;

    background: #222;
    border-radius: 4px;
    border: solid #bbb 1px;
    height: 300px;
}

.welcome-modal .step .video-container.playing video {
    -webkit-filter: none;
    filter: none;
    opacity: 1;
}

.welcome-modal .step .video-container button {
    padding: 0 30px;
}

.welcome-modal .step.visible {
    display: block;
}

.welcome-modal button.next-step {
    position: absolute;
    right: 5px;
    bottom: 5px;
    margin: 0;
}

.welcome-modal span.count {
    position: absolute;
    left: 6px;
    bottom: 0;
    color: #eee;
}

.welcome-modal .step0 {
  padding: 15px;
}

.welcome-modal .step0 h3{
    text-align: center;
}

.device-manager-modal article {
    display: flex;
    flex-direction: row;
    padding: 10px;
    justify-content: space-between;
}

.device-manager-modal .custom-devices {
    width: 250px;
    border-left: solid #eee 1px;
    border-bottom: solid #eee 1px;
    overflow: scroll;
    list-style: none;
    padding-left: 10px;
}

.device-manager-modal .custom-devices > li {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    overflow: hidden;
}

.device-manager-modal .custom-devices > li > * {
    align-self: center;
}

.device-manager-modal .custom-devices > li > span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-manager-modal .custom-devices button {
    margin-bottom: 0;
}

.device-manager-modal .custom-devices button.delete:hover {
    color: darkred;
    border-color: darkred;
}

.device-manager-modal i.info {
    color: #888;
}

@media (max-width: 1015px) {
    button {
        padding: 0 10px;
    }

    button i.fa {
        font-size: 14px;
        vertical-align: 0;
    }

    #new-device select {
        max-width: 140px;
    }

    #zoom input {
        width: 70px;
    }
}

@media (max-width: 640px) {
    #new-device select {
        width: 70px;
    }

    #zoom input {
        display: none;
    }

    #zoom .zoom-value {
        bottom: -5px;
    }
}
