/*
 * 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;
}

/*
.toolbar {
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
*/
.fmgr-dialog .toolbar .btn {
  width: 50px;
  height: 50px;
  font-size: 1.2rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin-right: 8px;
}
.fmgr-dialog .toolbar .btn:hover {
  /*transform: translateY(-2px);*/ /* Slight lift on hover */
  /*box-shadow: 0 4px 8px rgba(0,0,0,0.3);*/
}
.fmgr-dialog .toolbar .btn:last-child {
  margin-right: 0;
}

.fmgr-dialog .toolbar .btn-clicked {
  transform: scale(0.90); /* Shrink the button slightly */
}

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

/* Transition screen */
#noVNC_transition {
  transition: 0.5s ease-in-out;

  display: flex;
  opacity: 0;
  visibility: hidden;

  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,
:root.noVNC_reconnecting #noVNC_transition {
    opacity: 1;
    visibility: visible;
}
:root:not(.noVNC_reconnecting) #noVNC_cancel_reconnect_button {
  display: none;
}
#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);
}



#noVNC_control_bar,
#noVNC_control_bar_handle,
#noVNC_status_bar,
#noVNC_status,
#noVNC_status_text,
.noVNC_panel,
#noVNC_transition,
#noVNC_connect_dlg,
#noVNC_connect_button,
#noVNC_logo,
.noVNC_spinner,
.noVNC_loading,
[class*="spinner"],
[class*="loading"],
[class*="dots"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
}

html, body,
#noVNC_container,
#noVNC_screen,
#noVNC_canvas,
canvas {
  margin: 0 !important;
  padding: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  overflow: hidden !important;
}

/* Hidden by default on desktop */
#mobile_desktop_notice {
  display: none;
}

/* Mobile and tablet security notice page - green theme */
@media screen and (max-width: 900px), screen and (pointer: coarse) and (max-width: 1100px) {
  #noVNC_container,
  #noVNC_screen,
  #noVNC_canvas,
  canvas,
  #noVNC_control_bar,
  #noVNC_control_bar_handle,
  #noVNC_status_bar,
  #noVNC_status,
  #noVNC_status_text {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    height: 100vh !important;
    min-height: 100vh !important;
    overflow: hidden !important;
    background: #031b16 !important;
  }

  #mobile_desktop_notice {
    display: flex !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483647 !important;
    align-items: center !important;
    justify-content: center !important;
    background:
      radial-gradient(circle at top left, rgba(37, 211, 102, 0.28), transparent 36%),
      radial-gradient(circle at bottom right, rgba(18, 140, 126, 0.24), transparent 36%),
      linear-gradient(135deg, #031b16 0%, #0b3b2e 55%, #052a20 100%) !important;
    color: #ffffff !important;
    font-family: Arial, Helvetica, sans-serif !important;
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)) !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  #mobile_desktop_notice .mobile-card {
    width: min(100%, 430px) !important;
    max-width: 430px !important;
    max-height: calc(100vh - 36px) !important;
    overflow-y: auto !important;
    background: rgba(7, 43, 33, 0.92) !important;
    border: 1px solid rgba(37, 211, 102, 0.30) !important;
    border-radius: 22px !important;
    padding: clamp(22px, 6vw, 34px) clamp(18px, 5vw, 26px) !important;
    text-align: center !important;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45) !important;
    backdrop-filter: blur(12px) !important;
    box-sizing: border-box !important;
  }

  #mobile_desktop_notice .mobile-icon {
    width: clamp(56px, 17vw, 74px) !important;
    height: clamp(56px, 17vw, 74px) !important;
    border-radius: 20px !important;
    margin: 0 auto clamp(16px, 5vw, 22px) auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(37, 211, 102, 0.16) !important;
    border: 1px solid rgba(37, 211, 102, 0.40) !important;
    font-size: clamp(28px, 9vw, 38px) !important;
    line-height: 1 !important;
  }

  #mobile_desktop_notice h1 {
    margin: 0 0 12px 0 !important;
    font-size: clamp(21px, 6vw, 26px) !important;
    line-height: 1.22 !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    color: #ffffff !important;
    word-break: normal !important;
  }

  #mobile_desktop_notice p {
    margin: 0 !important;
    font-size: clamp(14px, 4.2vw, 16px) !important;
    line-height: 1.55 !important;
    color: #d1fae5 !important;
  }

  #mobile_desktop_notice .divider {
    width: 52px !important;
    height: 4px !important;
    border-radius: 999px !important;
    background: #25d366 !important;
    margin: clamp(18px, 5vw, 22px) auto !important;
  }

  #mobile_desktop_notice .desktop-box {
    margin-top: clamp(18px, 5vw, 22px) !important;
    padding: 14px 15px !important;
    border-radius: 16px !important;
    background: rgba(9, 67, 52, 0.82) !important;
    border: 1px solid rgba(37, 211, 102, 0.24) !important;
    color: #ecfdf5 !important;
    font-size: clamp(13px, 3.8vw, 14px) !important;
    line-height: 1.48 !important;
    box-sizing: border-box !important;
  }

  #mobile_desktop_notice .footer-text {
    margin-top: 16px !important;
    font-size: clamp(11px, 3.4vw, 12px) !important;
    line-height: 1.45 !important;
    color: #86efac !important;
  }
}

/* Very small phones */
@media screen and (max-width: 360px) {
  #mobile_desktop_notice {
    padding: 14px !important;
  }

  #mobile_desktop_notice .mobile-card {
    border-radius: 18px !important;
    padding: 20px 16px !important;
  }

  #mobile_desktop_notice h1 {
    font-size: 20px !important;
  }

  #mobile_desktop_notice p {
    font-size: 13.5px !important;
  }
}

/* Landscape phones */
@media screen and (max-height: 480px) and (orientation: landscape) {
  #mobile_desktop_notice {
    align-items: flex-start !important;
    padding-top: 14px !important;
    padding-bottom: 14px !important;
  }

  #mobile_desktop_notice .mobile-card {
    max-height: calc(100vh - 28px) !important;
    padding-top: 18px !important;
    padding-bottom: 18px !important;
  }

  #mobile_desktop_notice .mobile-icon {
    width: 48px !important;
    height: 48px !important;
    font-size: 26px !important;
    margin-bottom: 12px !important;
  }

  #mobile_desktop_notice h1 {
    font-size: 21px !important;
    margin-bottom: 8px !important;
  }

  #mobile_desktop_notice .divider {
    margin: 14px auto !important;
  }

  #mobile_desktop_notice .desktop-box {
    margin-top: 14px !important;
  }

  #mobile_desktop_notice .footer-text {
    margin-top: 12px !important;
  }
}
