body {
    background-color: rgb(48, 48, 48);
    font-size: 1.2rem;
    font-family: sans-serif;
}

/* Prevent pull down refresh when Streaming */
html.stream,
body.stream {
    overscroll-behavior: none !important;
}

h2,
h3 {
    margin-top: 12px;
    margin-bottom: 8px;
}

/** Input Div */
.input-div {
    display: flex;
    flex-direction: row;
    align-items: center;
}

/** Hide the file input */
input[type="file"] {
    display: none;
}

/** Label */
.file-label,
label {
    cursor: default;
    margin-right: 5px;
}

/** Button */
.file-button,
button {
    background-color: rgba(63, 81, 181, 1.0);
    border: none;
    border-radius: 5px;
    padding: 5px;
    margin: 8px;
    font-size: 1.2rem;
    cursor: pointer;
}

.file-button:hover,
button:hover {
    transition: box-shadow 0.2s;
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.2);
}

/** Checkbox */
input[type="checkbox"] {
    /* remove native box */
    appearance: none;
    vertical-align: middle;
    width: 24px;
    height: 24px;
    border: 2px solid #555;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    display: inline-block;
}

input[type="checkbox"]::after {
    content: "✓";
    color: white;
    font-size: 18px;
    position: absolute;
    top: 50%;
    left: 50%;
    /* start hidden */
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

input[type="checkbox"]:checked {
    /* box fill */
    background: rgb(206, 147, 216);
    border-color: rgb(206, 147, 216);
}

input[type="checkbox"]:checked::after {
    /* scale in */
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/** Text Field likes  */
.textlike,
textarea,
select,
input[type=text],
input[type=password],
input[type=number] {
    color: white;
    font-size: 1.2rem;
    margin: 5px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    /* multiline */
    overflow-x: auto;
    overflow-y: auto;
    white-space: pre-wrap;

    max-height: max-content;
}

.textlike:hover,
textarea:hover:enabled,
select:hover:enabled,
input[type=text]:hover:enabled,
input[type=password]:hover:enabled,
input[type="number"]:hover:enabled {
    transition: all 0.2s;
    background-color: rgba(0, 0, 0, 0);
    border-color: rgb(255, 255, 255, 0.7);
}

textarea:disabled,
select:disabled,
input[type=text]:disabled,
input[type=password]:disabled,
input[type=number]:disabled {
    color: gray;
}

select option {
    background-color: rgb(66, 66, 66);
}

/** Hide the number up down thingy on number inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    /* display: none; <- Crashes Chrome on hover */
    -webkit-appearance: none;
    /* <-- Apparently some margin are still there even though it's hidden */
    margin: 0;
}

input[type=number] {
    appearance: textfield;
    /* Firefox */
    -moz-appearance: textfield;
}

/** Modal */
.modal-background {
    display: block;
    position: fixed;
    z-index: 2;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    /** animation */
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, background 0.1s linear, opacity 0.1s linear;
}

.modal-content {
    background-color: rgb(86, 92, 100);

    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 5px;

    width: 80%;
}

.modal-disabled {
    /** animation */
    visibility: hidden;
    background-color: rgba(0, 0, 0, 0);
    opacity: 0;
    transition: all 0.1s linear;
}

/** Context Menu */
.context-menu-background {
    display: block;
    position: fixed;
    z-index: 1;
    border-radius: 5px;
    background-color: rgb(86, 92, 100);
    /** animation */
    scale: 1;
    opacity: 1;
    translate: 0 0;
    transition: visibility 0s, opacity 0.05s linear, scale 0.05s linear, translate 0.05s linear;
}

.context-menu-list {
    list-style-type: none;
}

.context-menu-element {
    margin: 0;
    padding: 10px;
    min-width: 110px;
    cursor: pointer;
    border-radius: 5px;
    /** animation */
    transition: all 0.15s;
    background-color: rgba(255, 255, 255, 0);
}

.context-menu-element:hover {
    /** animation */
    transition: all 0.2s;
    background-color: rgba(255, 255, 255, 0.2);
}

.context-menu-disabled {
    visibility: hidden;
    /** animation */
    opacity: 0;
    scale: 0.7;
    translate: -30% -30%;
    transition: all 0.1s linear, opacity 0.1s ease-out;
}

/** Sidebar */
.sidebar-overlay {
    position: fixed;
    z-index: 1;
    pointer-events: none;
}

.sidebar-background {
    display: flex;
    align-items: center;
    gap: 5px;
    /** animation */
    transition: all 0.2s 0s linear;
}

.sidebar-background * {
    pointer-events: all;
}

.sidebar-overlay.sidebar-edge-left {
    top: 50%;
    left: 0;
}

.sidebar-edge-left .sidebar-background {
    flex-direction: row-reverse;
    transform: translate(calc(-100% + 40px), -50%);
}

.sidebar-overlay.sidebar-edge-right {
    top: 50%;
    right: 0;
}

.sidebar-edge-right .sidebar-background {
    flex-direction: row;
    transform: translate(calc(100% - 40px), -50%);
}

.sidebar-edge-left.sidebar-show .sidebar-background,
.sidebar-edge-right.sidebar-show .sidebar-background {
    transform: translate(0, -50%);
}

.sidebar-overlay.sidebar-edge-up {
    top: 0;
    left: 50%;
}

.sidebar-edge-up .sidebar-background {
    flex-direction: column-reverse;
    transform: translate(-50%, calc(-100% + 40px));
}

.sidebar-overlay.sidebar-edge-down {
    bottom: 0;
    left: 50%;
}

.sidebar-edge-down .sidebar-background {
    flex-direction: column;
    transform: translate(-50%, calc(100% - 40px));
}

.sidebar-edge-down.sidebar-show .sidebar-background,
.sidebar-edge-up.sidebar-show .sidebar-background {
    transform: translate(-50%, 0);
}

.sidebar-button {
    /** Note: Button full size: 30px(width / height) + 5px(padding as in button selector) + 5px(.sidebar-background gap) = 40px */
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-button-image {
    transition: all 0.3s linear;
}

.sidebar-edge-left .sidebar-button-image {
    rotate: 180deg;
}

.sidebar-edge-right .sidebar-button-image {
    rotate: 0deg;
}

.sidebar-edge-up .sidebar-button-image {
    rotate: 270deg;
}

.sidebar-edge-down .sidebar-button-image {
    rotate: 90deg;
}

.sidebar-show .sidebar-button-image {
    transform: rotate(180deg);
}


.sidebar-content {
    background-color: rgb(86, 92, 100);
    border-radius: 5px;
    padding: 10px 10px 10px 10px;
    display: flex;
    flex-direction: column;
}

/** TODO: reorder stream sidebar */

/** Errors */
.error-list {
    visibility: hidden;
    position: fixed;
    z-index: 1;

    right: 0;
    bottom: 0;

    display: flex;
    flex-direction: column;
    margin-right: 1cm;
}

.error-element {
    visibility: visible;
    display: flex;
    flex-direction: row;

    padding-left: 0.4cm;
    padding-right: 0.4cm;
    padding-top: 0.2cm;
    padding-bottom: 0.2cm;
    margin-bottom: 0.5cm;

    background-color: rgb(86, 92, 100);
}

.error-image {
    margin-right: 0.3cm;
}

/** Animated Lists */
.animated-list-element {
    /** animation */
    opacity: 0;
}

.animated-list-element.list-show {
    /** animation */
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/** Actions */
.actions-list {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

/** Settings */
.open-settings {
    background-image: url("resources/settings.svg");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 60px;
    width: 70px;
    height: 70px;
}

.settings {
    color: white;
}

/** Hosts */
.host-add {
    background-image: url("resources/ic_add_to_queue_white_48px.svg");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 60px;
    width: 70px;
    height: 70px;
}

.host-list {
    list-style-type: none;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}

.host-element {
    cursor: pointer;
    margin: 0.2cm;
    padding-top: 0.1cm;
    padding-bottom: 0.5cm;
    padding-left: 0.4cm;
    padding-right: 0.4cm;
}

.host-element:hover {
    transition: all 0.2s;
    background-color: rgba(255, 255, 255, 0.2);
}

.host-image {
    width: 6cm;
    height: auto;
}

.host-name {
    margin: 0;
    color: white;
    font-size: 3rem;
    text-align: center;
}

/** Apps */
.app-list {
    list-style-type: none;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
}

.app-element>div {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 10px;
}

.app-element:hover {
    transition: all 0.2s;
    background-color: rgba(255, 255, 255, 0.2);
}

.app-image {
    /** Ratio: w:h 200:266 */
    width: 200px;
    height: 266px;
    /** animation */
    transition: all 0.4s linear;
    opacity: 0;
}

.app-image-loaded {
    /** animation */
    opacity: 1;
    transition: opacity 0.1s ease-in;
}

.app {
    transition: all 0.4s linear;
}

.app-active .app-image {
    border-style: solid;
    /** TODO: gold doesn't fit this theme */
    border-color: gold;
    border-width: 4px;
    border-radius: 4px;

    transition: all 0.4s ease-in;
}

.app-inactive {
    filter: brightness(30%);

    transition: all 0.2s ease-in;
}

/** Stream Connect Modal */
.modal-video-connect {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;

    max-width: 100%;
    max-height: 100%;
}

.modal-video-connect .modal-video-connect-debug {
    max-width: 75vw;
    max-height: 40vh;
}

/** Stream */
.video-stream {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100vw;
    max-height: 100vh;
    min-width: 100vmin;
    min-height: 100vmin;
    width: auto;
    height: auto;
    outline: none;
}

.sidebar-stream {
    display: flex;
    flex-direction: column;
}

.sidebar-stream-buttons {
    display: grid;
    grid-template-columns: 50% 50%;
}

.hiddeninput {
    position: absolute;
    z-index: -1000;
    resize: none;
    translate: 200vw 200vh;
}

/* Prevent starting animation for elements */
.prevent-start-transition {
    transition: none;
}