/*
 * noVNC base CSS
 * Copyright (C) 2019 The noVNC Authors
 * noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
 * This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
 */

/*
 * Z index layers:
 *
 * 0: Main screen
 * 10: Control bar
 * 50: Transition blocker
 * 60: Connection popups
 * 100: Status bar
 * ...
 * 1000: Javascript crash
 * ...
 * 10000: Max (used for polyfills)
 */

html {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  background-color: #313131;
  height: 100%;
  touch-action: none;
}

.noVNC_only_touch.noVNC_hidden {
  display: none;
}

/* ----------------------------------------
 * Spinner
 * ----------------------------------------
 */

.noVNC_spinner {
  position: relative;
}
.noVNC_spinner, .noVNC_spinner::before, .noVNC_spinner::after {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  box-shadow: -60px 10px 0 rgba(255, 255, 255, 0);
  animation: noVNC_spinner 1.0s linear infinite;
}
.noVNC_spinner::before {
  content: "";
  position: absolute;
  left: 0px;
  top: 0px;
  animation-delay: -0.1s;
}
.noVNC_spinner::after {
  content: "";
  position: absolute;
  top: 0px;
  left: 0px;
  animation-delay: 0.1s;
}
@keyframes noVNC_spinner {
  0% { box-shadow: -60px 10px 0 rgba(255, 255, 255, 0); width: 20px; }
  25% { box-shadow: 20px 10px 0 rgba(255, 255, 255, 1); width: 10px; }
  50% { box-shadow: 60px 10px 0 rgba(255, 255, 255, 0); width: 10px; }
}

/* ----------------------------------------
 * WebKit centering hacks
 * ----------------------------------------
 */

.noVNC_center {
  /*
   * This is a workaround because webkit misrenders transforms and
   * uses non-integer coordinates, resulting in blurry content.
   * Ideally we'd use "top: 50%; transform: translateY(-50%);" on
   * the objects instead.
   */
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.noVNC_center > * {
  pointer-events: auto;
}
.noVNC_vcenter {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  pointer-events: none;
}
.noVNC_vcenter > * {
  pointer-events: auto;
}

/* ----------------------------------------
 * Layering
 * ----------------------------------------
 */

.noVNC_connect_layer {
  z-index: 60;
}

/* ----------------------------------------
 * Fallback error
 * ----------------------------------------
 */

#noVNC_fallback_error {
  z-index: 1000;
  visibility: hidden;
  /* Put a dark background in front of everything but the error,
     and don't let mouse events pass through */
  background: rgba(0, 0, 0, 0.8);
  pointer-events: all;
}
#noVNC_fallback_error.noVNC_open {
  visibility: visible;
}

#noVNC_fallback_error > div {
  max-width: calc(100vw - 30px - 30px);
  max-height: calc(100vh - 30px - 30px);
  overflow: auto;

  padding: 15px;

  transition: 0.5s ease-in-out;

  transform: translateY(-50px);
  opacity: 0;

  text-align: center;
  font-weight: bold;
  color: #fff;

  border-radius: 10px;
  box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.5);
  background: rgba(200,55,55,0.8);
}
#noVNC_fallback_error.noVNC_open > div {
  transform: translateY(0);
  opacity: 1;
}

#noVNC_fallback_errormsg {
  font-weight: normal;
}

#noVNC_fallback_errormsg .noVNC_message {
  display: inline-block;
  text-align: left;
  font-family: monospace;
  white-space: pre-wrap;
}

#noVNC_fallback_error .noVNC_location {
  font-style: italic;
  font-size: 0.8em;
  color: rgba(255, 255, 255, 0.8);
}

#noVNC_fallback_error .noVNC_stack {
  padding: 10px;
  margin: 10px;
  font-size: 0.8em;
  text-align: left;
  font-family: monospace;
  white-space: pre;
  border: 1px solid rgba(0, 0, 0, 0.5);
  background: rgba(0, 0, 0, 0.2);
  overflow: auto;
}

/* ----------------------------------------
 * Control Bar
 * ----------------------------------------
 */

#noVNC_control_bar_anchor {
  /* The anchor is needed to get z-stacking to work */
  position: fixed;
  z-index: 10;

  transition: 0.5s ease-in-out;

  /* Edge misrenders animations without this */
  transform: translateX(0);
}
#noVNC_control_bar_anchor.noVNC_right {
  left: auto;
  right: 0;
}
:root.noVNC_connected #noVNC_control_bar_anchor.noVNC_idle {
  /* reduce opacity of the control bar when idle */
  opacity: 0.8;
}

#noVNC_control_bar {
  position: relative;
  left: calc(-100% + 15px);
  right: auto;

  transition: 0.5s ease-in-out;
}
#noVNC_control_bar.noVNC_open {
  left: 0;
  right: auto;
}

.noVNC_right #noVNC_control_bar {
  left: auto;
  right: calc(-100% + 15px);
}

.noVNC_right #noVNC_control_bar.noVNC_open {
  left: auto;
  right: 0;
}

#noVNC_control_bar .noVNC_scroll {
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Control bar content */

/* noVNC Touch Device only buttons */
:root:not(.noVNC_touch) #noVNC_keyboard_button {
  display: none;
}

/* Control bar hint */
#noVNC_control_bar_hint {
  position: fixed;
  left: calc(100vw - 50px);
  right: auto;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 100px;
  height: 50%;
  max-height: 600px;

  visibility: hidden;
  opacity: 0;
  transition: 0.2s ease-in-out;
  background: transparent;
  box-shadow: 0 0 10px black, inset 0 0 10px 10px rgba(110, 132, 163, 0.8);
  border-radius: 10px;
  transition-delay: 0s;
}
#noVNC_control_bar_anchor.noVNC_right #noVNC_control_bar_hint{
  left: auto;
  right: calc(100vw - 50px);
}
#noVNC_control_bar_hint.noVNC_active {
  visibility: visible;
  opacity: 1;
  transition-delay: 0.2s;
  transform: translateY(-50%) scale(1);
}

/* ----------------------------------------
 * Status Dialog
 * ----------------------------------------
 */

#noVNC_status {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  transform: translateY(-100%);

  cursor: pointer;

  transition: 0.5s ease-in-out;

  visibility: hidden;
  opacity: 0;

  padding: 5px;

  display: flex;
  flex-direction: row;
  justify-content: center;
  align-content: center;

  line-height: 1.6;
  word-wrap: break-word;
  color: #fff;

  border-bottom: 1px solid rgba(0, 0, 0, 0.9);
}
#noVNC_status.noVNC_open {
  transform: translateY(0);
  visibility: visible;
  opacity: 1;
}

#noVNC_status::before {
  content: "";
  display: inline-block;
  width: 25px;
  height: 25px;
  margin-right: 5px;
}

#noVNC_status.noVNC_status_normal {
  background: rgba(128,128,128,0.9);
}
#noVNC_status.noVNC_status_normal::before {
  content: url("../images/info.svg") " ";
}
#noVNC_status.noVNC_status_error {
  background: rgba(200,55,55,0.9);
}
#noVNC_status.noVNC_status_error::before {
  content: url("../images/error.svg") " ";
}
#noVNC_status.noVNC_status_warn {
  /*background: rgba(180,180,30,0.9);*/
  background: rgba(255,193,7,0.9);
}
#noVNC_status.noVNC_status_warn::before {
  content: url("../images/warning.svg") " ";
}

/* ----------------------------------------
 * Password Dialog
 * ----------------------------------------
 */

#noVNC_credentials_dlg {
  position: relative;

  transform: translateY(-50px);

  visibility: hidden;
  opacity: 0;

  transition: 0.5s ease-in-out;
}
#noVNC_credentials_dlg.noVNC_open {
  transform: translateY(0);
  visibility: visible;
  opacity: 1;
}
.noVNC_hidden {
  display: none;
}

/* ----------------------------------------
 * Main Area
 * ----------------------------------------
 */

/* Transition screen */
#noVNC_transition {
  display: none;

  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;

  color: white;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;

  /*display: flex;*/
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
:root.noVNC_loading #noVNC_transition,
:root.noVNC_connecting #noVNC_transition,
:root.noVNC_disconnecting #noVNC_transition,
#noVNC_transition_text {
  font-size: 1.5em;
}

/* Main container */
#noVNC_container {
  width: 100%;
  height: 100%;
}

#noVNC_keyboardinput {
  width: 1px;
  height: 1px;
  background-color: #fff;
  color: #fff;
  border: 0;
  position: absolute;
  left: -40px;
  z-index: -1;
  ime-mode: disabled;
}

/* ----------------------------------------
 * Action Button
 * ----------------------------------------
 */

.btn.noVNC_selected {
  background: #E9ECEF;
  border: 1px solid;
  border-color: #CED4DA;
}

html[data-bs-theme="dark"] .btn.noVNC_selected {
  background: #3B3B3B;
  border: 1px solid;
  border-color: #525151;
}

/* ----------------------------------------
 * Accordion Button
 * ----------------------------------------
 */

.custom-accordion-button {
  display: flex;
  cursor: pointer;
}
.custom-accordion-button::after {
  content: "\276F";
  margin-left: 0.5rem;
  transition: transform 0.2s ease-in-out;
}
.custom-accordion-button:not(.collapsed)::after {
  content: "\276F";
  transform: rotate(90deg);
}

/* ----------------------------------------
 * Control Bar Handle
 * ----------------------------------------
 */

:root {
  --control-bar-handle-color: #E9ECEF;
  --control-bar-handle-border-color: #CED4DA;
  --control-bar-handle-height: 50px;
  --control-bar-handle-width: 15px;
  --control-bar-handle-dot-size: 4px;
  --control-bar-handle-dot-color: #6C757D;
}

.handle {
  display: block;
  position: relative;
  width: var(--control-bar-handle-width);
  height: var(--control-bar-handle-height);
  background: var(--control-bar-handle-color);
  border: 1px solid;
  border-left: 0px none;
  border-color: var(--control-bar-handle-border-color);
  border-radius: 0px 5px 5px 0px;
  cursor: pointer;

  transform: translateY(35px); /* position the handle 35px from the top of the control bar */
  /*width: calc(100% + 15px);*/
/*  left: 100%;*/


  /*box-shadow: 5px 5px 8px 0px rgba(0,0,0,0.15);*/
  /*outline: 1px solid;*/
  /* uncomment this when moving the whole handle:
  transition: all 0.1s ease-in-out;*/
}

.noVNC_right .handle {
  border: 1px solid;
  border-right: 0px none;
  border-color: var(--control-bar-handle-border-color);
  border-radius: 5px 0px 0px 5px;
}

.handle:hover {
  filter: brightness(0.95);
}

/* This create the main/middle dot */
.handle .dots {
  position: absolute;
  top: calc(50% - calc(var(--control-bar-handle-dot-size) / 2));
  left: calc(50% - calc(var(--control-bar-handle-dot-size) / 2));
  display: block;
  width: var(--control-bar-handle-dot-size);
  height: var(--control-bar-handle-dot-size);
  border-radius: calc(var(--control-bar-handle-dot-size) / 2);
  background-color: var(--control-bar-handle-dot-color);
  /* not needed since the middle dot doesn't move
  transition: all 0.1s ease-in-out;*/
}

/* This creates 2 additional dots: top and bottom. */
.handle .dots::before, .handle .dots::after {
  content: "";
  position: absolute;
  width: var(--control-bar-handle-dot-size);
  height: var(--control-bar-handle-dot-size);
  border-radius: calc(var(--control-bar-handle-dot-size) / 2);
  background-color: var(--control-bar-handle-dot-color);
  transition: all 0.1s ease-in-out;
}

/* Move the bottom dot to its place */
.handle .dots::before {
  transform: translateY(calc(var(--control-bar-handle-dot-size) * 2));
}

/* Move the top dot to its place*/
.handle .dots::after {
  transform: translateY(calc(var(--control-bar-handle-dot-size) * -2));
}

/* Transform the bottom dot to a line and rotate it to form one side of an 'X' */
#noVNC_control_bar.noVNC_open .handle .dots::before {
  width: var(--control-bar-handle-width);
  /* Previous transform is cancelled so we are starting with a dot in the middle. */
  transform: translateX(calc(var(--control-bar-handle-width) / -2 + calc(var(--control-bar-handle-dot-size) / 2))) rotate(-45deg);
}

/* Transform the top dot to a line and rotate it to form the other side of an 'X' */
#noVNC_control_bar.noVNC_open .handle .dots::after {
  width: var(--control-bar-handle-width);
  /* Previous transform is cancelled so we are starting with a dot in the middle. */
  transform: translateX(calc(var(--control-bar-handle-width) / -2 + calc(var(--control-bar-handle-dot-size) / 2))) rotate(45deg);
}


