html,
body {
  height: 100%;
  width: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background-color: #9EAEB2; /* Fallback color matching loading screen */
  background-image: url('../images/background.png'); /* Added from new-loading.css */
  background-size: auto; /* Added from new-loading.css */
  background-repeat: repeat; /* Added from new-loading.css */
  background-position: center;
  background-attachment: fixed; /* Added from new-loading.css */
  font-family: var(--menu-font-family);
  position: relative; /* For pseudo-elements */
}

/* Grid overlay for body */
body::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.15) 1.2px, transparent 1.2px),
        linear-gradient(0deg, transparent 13px, rgba(255, 255, 255, 0.2) 14px, transparent 14px),
        linear-gradient(90deg, transparent 13px, rgba(255, 255, 255, 0.2) 14px, transparent 14px);
    background-size: 48px 48px;
    background-position: 0 0;
    z-index: 1;
    pointer-events: none;
}

/* Dark mode for body */
body.dark-mode::before,
:root[data-color-scheme="dark"] body::before { /* Darkening layer */
    content: '';
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.78);
    z-index: 1;
    pointer-events: none;
}

body.dark-mode::after,
:root[data-color-scheme="dark"] body::after { /* Adjusted grid for dark mode on body */
    background-image:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.05) 1.2px, transparent 1.2px),
        linear-gradient(0deg, transparent 13px, rgba(255, 255, 255, 0.1) 14px, transparent 14px),
        linear-gradient(90deg, transparent 13px, rgba(255, 255, 255, 0.1) 14px, transparent 14px);
    z-index: 2;
}


div.window canvas {
  touch-action: none;
  border-radius: 0 0 3px 3px;
}

div.window canvas.gpu-trigger {
  transform: translate3d(0, 0, 0);
  /* Refer to client.js */
}

/* body.desktop {
  background-color: #555;
} */ /* Commented out to ensure official background applies */

div#top_bar {
  background-color: #444;
  width: 100%;
  height: 48px;
}

div#top_bar img {
  width: 48px;
  height: 48px;
}

div#connect_form {
  display: none;
}

div#disconnect_form {
  display: none;
}

.overlay {
  background-color: transparent;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  opacity: 0.5;
  z-index: 10;
  text-align: center;
  padding-top: 3em;
}

body:not(.dark-mode) #progress-label,
:root:not([data-color-scheme="dark"]) #progress-label {
  color: #333333; /* Dark color for white mode */
}

body:not(.dark-mode) #progress-details,
:root:not([data-color-scheme="dark"]) #progress-details {
  color: #555555; /* Dark color for white mode */
}
#progress-label {
  font-size: 1.4em;
  color: white;
  line-height: 2em;
  height: 2em;
}

#progress-details {
  font-size: 1.2em;
  color: white;
  line-height: 1.5em;
  height: 1.5em;
}

#progress-bar {
  height: 2em;
}

canvas {
  border: none;
  padding: 0;
  margin: 0;
}

#pasteboard {
  position: fixed;
  top: -40px;
  width: 100px;
  height: 30px;
  left: 1px;
}

.undecorated {
  position: absolute;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.window {
  border: 1px;
  position: absolute;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  /* required for radius clip */
}

.window.override-redirect {}

.window.tray {
  position: relative;
  float: left;
}

.window.desktop {
  box-shadow: none;
}

.window-NORMAL {}

.window.border {
  border-color: grey;
  border-width: 1px;
  border-style: solid;
  border-radius: 6px 6px 3px 3px;
}

.windowicon {
  display: inline-block;
  position: absolute;
  width: 24px;
  height: 24px;
  margin-left: 1px;
  margin-top: 1px;
  left: 0px;
  top: 0px;
  overflow: hidden;
  cursor: default;
  background-color: transparent;
}

.windowtitle {
  font-family: "Ubuntu", sans-serif;
  font-size: 15px;
  display: inline-block;
  float: left;
  position: absolute;
  top: 0px;
  left: 0px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 5px;
  padding-right: 48px;
  padding-left: 2px;
  white-space: nowrap;
  cursor: default;
  max-width: calc(100% - 120px); /* Reserve space for icon (30px) + buttons (~90px) */
}

.windowbuttons {
  display: inline-block;
  position: absolute;
  z-index: 1;
  top: 0px;
  right: 0px;
  padding-right: 5px;
  cursor: pointer;
  padding-top: 7px;
  background-color: transparent;
}
.windowbuttons > span > img {
  padding: 2px; /* Add some padding to make hover target slightly larger if icons are small */
  border-radius: 3px; /* Optional: slightly rounded hover effect */
  transition: background-color 0.2s ease-in-out, filter 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

.windowbuttons > span > img:hover {
  background-color: rgba(0, 0, 0, 0.1); /* Subtle background on hover */
  filter: brightness(1.1); /* Slightly brighten icon on hover */
  opacity: 0.85;
}

.above {
  z-index: 10000;
}

.below {
  z-index: 0;
}

div.windowinfocus {
  z-index: 5000;
}

.windowhead {
  height: 30px;
  color: #000000;
  background-color: #a0a0a0;
  border-bottom: 1px solid #c0c0c0;
  box-sizing: border-box;
}

div.windowinfocus div.windowhead {
  background-color: #ffffff;
}

.modal {
  z-index: 20000;
}

.spinneroverlay {
  width: 100%;
  height: 100%;
  display: none;
  background-color: black;
  opacity: 0.5;
  position: absolute;
}

.spinnermiddle {
  display: table-cell;
  vertical-align: middle;
}

.ui-resizable-helper {
  border: 2px dotted #00f;
  z-index: 30000 !important;
}

.ui-resizable-handle {
  position: absolute;
  font-size: 0.1px;
  display: block;
  background-color: transparent;
  transition: background-color 0.2s ease-in-out;
}

.ui-resizable-handle:hover {
  background-color: rgba(0, 123, 255, 0.3);
}

.ui-resizable-disabled .ui-resizable-handle,
.ui-resizable-autohide .ui-resizable-handle {
  display: none;
}

.ui-resizable-n {
  cursor: n-resize !important;
  height: 7px;
  width: 100%;
  top: -5px;
  left: 0;
}

.ui-resizable-s {
  cursor: s-resize !important;
  height: 7px;
  width: 100%;
  bottom: -5px;
  left: 0;
}

.ui-resizable-e {
  cursor: e-resize !important;
  width: 7px;
  right: -5px;
  top: 0;
  height: 100%;
}

.ui-resizable-w {
  cursor: w-resize !important;
  width: 7px;
  left: -5px;
  top: 0;
  height: 100%;
}

.ui-resizable-se {
  cursor: se-resize !important;
  width: 12px;
  height: 12px;
  right: 1px;
  bottom: 1px;
}

.ui-resizable-sw {
  cursor: sw-resize !important;
  width: 9px;
  height: 9px;
  left: -5px;
  bottom: -5px;
}

.ui-resizable-nw {
  cursor: nw-resize !important;
  width: 9px;
  height: 9px;
  left: -5px;
  top: -5px;
}

.ui-resizable-ne {
  cursor: ne-resize !important;
  width: 9px;
  height: 9px;
  right: -5px;
  top: -5px;
}

.notifications {
  position: absolute;
  left: auto;
  right: 0;
  top: 96px;
  bottom: auto;
  width: 600px;
  height: auto;
  z-index: 10001;
  transition: height 0.5s, opacity 0.5s, top 0.5s, box-shadow 0.5s, bottom 0.5s;
  overflow: hidden;
  padding: 40px;
  visibility: hidden;
}

.notifications .alert {
  visibility: visible;
}

.notification_icon {
  max-width: 128px;
  max-height: 128px;
  float: left;
  padding: 0.4rem;
  padding-left: 1rem;
}

.notification_buttons {
  clear: both;
  margin: 10px 0px 0px auto;
  font-weight: 500;
  font-size: 1.2rem;
  height: 2em;
}

.notification_button {
  cursor: pointer;
  float: right;
  margin: 5px;
  padding: 5px;
  border: 1px solid black;
  border-radius: 5px;
  background-color: #f8f8f8;
  color: #000;
}

.notification_button:hover {
  background-color: #000;
  color: #ffffff;
}

@media screen and (max-width: 600px) {
  .notifications {
    bottom: 0;
    box-shadow: none;
    padding-top: 5rem;
  }
}

@media screen {
  .notifications .alert {
    box-shadow: 0 1rem 2rem rgba(21, 36, 48, 0.75);
    background-color: white;
    overflow: visible;
    border-radius: 8px;
    text-align: center;
    padding: 0.5rem;
    opacity: 40;
    margin-top: -10rem;
    position: relative;
    transform: translateY(10rem);
    transition: left 0.5s, margin 0.5s, opacity 0.5s, transform 0.5s;
  }
}

@media screen and (max-width: 600px) {
  .notifications .alert {
    opacity: 0;
    margin-top: 0;
    transform: translateY(0);
  }
}

.notifications .alert span {
  display: block;
  padding: 0;
  margin: 0 3rem;
  font-weight: 300;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  line-height: 1rem;
  max-height: 5rem;
}

.notifications .alert span.title {
  margin: 1rem;
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.3rem;
}

.notifications .alert span.message {
  text-align: left;
}

.notifications .alert span a {
  text-decoration: none;
}

.notifications .alert .dismiss {
  width: 2rem;
  position: absolute;
  right: 1rem;
  top: 1em;
  transform: scale(1, 1) translateY(-50%);
  font-size: 2rem;
  transition: margin 0.5s, opacity 0.5s, transform 0.5s;
  text-align: center;
  cursor: pointer;
  color: inherit;
  font-weight: 300;
  transform-origin: center center;
}

#about,
#sessioninfo,
#bugreport {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background-color: #eee;
  border: 2px solid #ddd;
  display: none;
  z-index: 1000000;
  margin: auto;
  text-align: center;
  padding: 20px;
}

#about,
#sessioninfo,
#bugreport {
  position: fixed;
  margin: auto;
  width: 640px;
  height: fit-content;
  top: 50%;
  left: 50%;
  margin-left: -320px;
  margin-top: -140px;
}

#bugreport {
  text-align: left;
}

#shadow_pointer {
  width: 32px;
  height: 32px;
  position: absolute;
  top: 0;
  left: 0;
  border: 1px;
  z-index: 100000;
  display: none;
  pointer-events: none;
}

table#sessiondata {
  width: 90%;
  margin: auto;
}

table#sessiondata th {
  text-align: left;
}

table#sessiondata td {
  text-align: right;
}

#upload {
  display: none;
}

.action-icons {
  position: relative;
  float: left;
}

.action-events {
  position: relative;
  float: left;
}

#action-link {
  display: none;
  color: #99f;
}

.clock_block {
  position: relative;
  float: left;
  padding-left: 100px;
}

#clock_text {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #fff;
}

.audio {
  float: right;
  padding-right: 10px;
}

.simple-keyboard {
  z-index: 100000;
}

#login-overlay {
  position: fixed;
  display: none;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 20;
  cursor: pointer;
  display: none !important; /* Force hide if no password auth is expected */
}

#login-box {
  height: fit-content;
  width: 480px;
  margin: auto;
  margin-top: 20px;
  position: relative;
  z-index: 3;
  background: #d8d8d8;
  border-radius: 20px;
  padding: 20px;
}

#login-innerbox {
  margin: auto;
  height: 100%;
  z-index: 3;
  background: #e8e8e8;
  border-radius: 20px;
  text-align: center;
}

#login-header {
  font-size: 2em;
  clear: both;
  display: inline-block;
  margin: 0.5em;
}

#login-innerbox input {
  font-size: 1.5em;
  clear: both;
  display: inline-block;
  margin: 0.5em;
  padding: 2px;
  border: 2px solid #101010;
  border-radius: 4px;
}

#password-box {
  background: url("../icons/authentication.png") no-repeat;
  margin-left: 2em;
  margin-right: 2em;
}

#login-buttons {
  margin: 2em;
  margin-bottom: 0px;
}

.login-button {
  margin: 1em;
  padding: 10px 32px;
  font-size: 18px;
  line-height: 1.3333333;
  border-radius: 6px;
  color: #fff;
  background-color: #5cb85c;
  border-color: #4cae4c;
  display: inline-block;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  touch-action: manipulation;
  cursor: pointer;
  user-select: none;
  background-image: none;
  border: 1px solid transparent;
  border-radius: 4px;
}

.login-button:focus,
.login-button:hover {
  background-color: #449d44;
}

@media screen {
  .notifications .alert.visible {
    margin-top: 0;
    opacity: 1;
    color:black;
    transform: translateY(0);
  }

  .notifications .alert.hidden {
    overflow: hidden;
    margin-top: -2.125rem;
    z-index: -1;
  }
}

@media screen and (max-width: 600px) {
  .notifications .alert.hidden {
    transform: translateY(0) translateX(-10rem);
  }
}

/* Hoody Slide Menu Styles */
#hoody_menu_trigger {
  position: fixed; /* Position is set inline in HTML, but good to have here too */
  top: 10px; /* Default, can be overridden by draggable */
  left: 10px; /* Default, can be overridden by draggable */
  width: 32px; /* Desired width of the trigger */
  height: 32px; /* Desired height of the trigger */
  z-index: 100002;
  cursor: grab;
  background-image: url(../favicon.png); /* Path relative to client.css */
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain; /* Or 'cover' or specific px values */
  border-radius: 4px; /* Optional: slightly rounded corners for the trigger */
  transition: filter 0.2s ease-in-out, transform 0.2s ease-in-out; /* Smooth transition for hover effects */
  /* box-shadow: 0px 0px 5px rgba(0,0,0,0.3); */ /* Optional: slight shadow for the trigger */
}

#hoody_menu_trigger:hover {
  cursor:pointer;
}

#float_menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px; /* Compact width for icon + label menu */
  min-width: 200px; /* Minimum width */
  max-width: 400px; /* Maximum width */
  height: 100vh;
  background-color: rgba(248, 248, 248, 0.95); /* Light background color with 95% opacity */
  box-shadow: 2px 0 5px rgba(0,0,0,0.2); /* Shadow for depth */
  z-index: 100001; /* High z-index to be on top */
  transform: translateX(-100%); /* Initially hidden off-screen to the left */
  transition: transform 0.3s ease-in-out; /* Smooth slide animation */
  overflow-y: auto; /* Allow scrolling if content exceeds height */
  padding-top: 60px; /* Adjusted space for the trigger icon or a top bar within the menu */
  padding-bottom: 60px; /* Space to prevent content from being hidden behind the footer */
  resize: horizontal; /* Enable horizontal resizing */
  overflow-x: hidden; /* Hide horizontal scrollbar */
}

/* Resize handle for the menu - entire right edge */
#float_menu::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 8px; /* Wider resize area */
  height: 100%;
  background-color: rgba(0, 0, 0, 0.1);
  cursor: ew-resize;
  z-index: 1;
}

/* Additional resize area for easier grabbing */
#float_menu::before {
  content: '';
  position: absolute;
  top: 0;
  right: -4px; /* Extend beyond menu edge */
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  z-index: 1;
}

#float_menu:hover::after {
  background-color: rgba(0, 0, 0, 0.2);
}

/* Dark mode resize handle */
body.dark-mode #float_menu::after,
:root[data-color-scheme="dark"] #float_menu::after {
  background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode #float_menu:hover::after,
:root[data-color-scheme="dark"] #float_menu:hover::after {
  background-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode #float_menu::before,
:root[data-color-scheme="dark"] #float_menu::before {
  background-color: transparent; /* Invisible but functional */
}

#float_menu.-open {
  transform: translateX(0); /* Slide in when -open class is present */
}

/* Adjustments for the Menu.js ul inside our slide-in panel */
#float_menu ul.Menu.-vertical {
  width: 100%;
  display: flex !important; /* Use flexbox for proper footer positioning */
  flex-direction: column;
  height: calc(100vh - 120px); /* Full height minus top and bottom padding */
  background-color: inherit; /* Explicitly inherit the background color */
  box-shadow: none; /* Remove shadow if Menu.js adds one */
  padding: 0;
  margin: 0;
}

#float_menu ul.Menu.-vertical > li {
  display: block; /* Ensure li take full width */
  float: none; /* Override from horizontal styles */
  width: 100%;
  border-bottom: 1px solid #eee; /* Separator for items */
}
#float_menu ul.Menu.-vertical > li:last-child {
  border-bottom: none;
}

#float_menu ul.Menu.-vertical > li > a {
  display: block;
  padding: 10px 15px; /* Original padding for main menu items */
  text-decoration: none;
  color: #333; /* Darker text color */
  white-space: normal; /* Allow text to wrap if needed */
}

#float_menu ul.Menu.-vertical > li > a:hover {
  background-color: #e7e7e7; /* Hover effect */
}

/* Hide icons if we want a purely text-based menu, or adjust padding */
#float_menu ul.Menu.-vertical *[data-icon]:before {
  /* display: none; */ /* Uncomment to hide icons completely */
  /* If keeping icons, adjust their styling and padding-left of the 'a' tag */
  position: relative;
  margin-right: 8px; /* Space between icon and text */
  float: left; /* Align icon to the left of the text */
}

#float_menu ul.Menu.-vertical li.-hasSubmenu > a:after {
  /* Adjust chevron for vertical submenus if kept */
  right: 15px; /* Position to the right */
}

/* Ensure submenus within the slide panel also look good */
#float_menu ul.Menu.-vertical ul {
  position: static; /* Submenus should flow naturally, not absolutely positioned */
  width: 100%;
  box-shadow: none;
  border-top: 1px solid #ddd;
  background-color: #f0f0f0; /* Slightly different background for submenus */
}

/* Submenu items styling (Settings, Server, Information submenus) */
#float_menu ul.Menu.-vertical ul li a {
  padding: 2px 16px 2px 30px; /* Match window list padding but indent submenu items */
  font-size: 15px; /* Match window list font size */
}

/* Hoody Menu Footer Link - Positioned at bottom using flexbox */
#hoody_menu_footer_link {
  margin-top: auto; /* Push to bottom of flex container */
  width: 100%; /* Takes full width */
  background-color: rgba(248, 248, 248, 0.95); /* Match light menu background, or use inherit */
  box-sizing: border-box; /* Include padding and border in the element's total width and height */
  flex-shrink: 0; /* Prevent shrinking */
}

#hoody_menu_footer_link a {
  display: block; /* Ensure the anchor takes full width for centering text */
  /* Inline styles for text-align, padding, font-size, color, text-decoration are kept in HTML for now,
     but could be moved here for better separation of concerns. */
}

/* Dark Mode Styles */
body.dark-mode,
html.dark-mode,
:root[data-color-scheme="dark"] body,
:root[data-color-scheme="dark"] {
  background-color: #333 !important; /* Darker overall background for the page */
  color: #f1f1f1; /* Lighter default text color */
}

body.dark-mode,
:root[data-color-scheme="dark"] body {
  background-color: #333; /* Darker overall background for the page */
  color: #f1f1f1; /* Lighter default text color */
}

/* Window head in dark mode */
body.dark-mode .windowhead,
:root[data-color-scheme="dark"] .windowhead {
  background-color: #232829; /* User-specified dark color for window head */
  color: #f1f1f1; /* Light text for title */
  border-bottom: 1px solid #4a4a4a; /* Darker border */
}

/* Focused window head in dark mode - can be same or slightly different */
body.dark-mode div.windowinfocus div.windowhead,
:root[data-color-scheme="dark"] div.windowinfocus div.windowhead {
  background-color: #2a2f30; /* Slightly lighter or different shade for focus */
  /* Or keep it same as #232829 if preferred */
}

/* Window control buttons (minimize, maximize, close icons) in dark mode */
body.dark-mode .windowbuttons > span > img,
:root[data-color-scheme="dark"] .windowbuttons > span > img {
  filter: invert(1) brightness(0.9) contrast(1.2); /* Invert colors and adjust brightness/contrast for visibility */
  opacity: 0.8;
}

body.dark-mode .windowbuttons > span > img:hover,
:root[data-color-scheme="dark"] .windowbuttons > span > img:hover {
  background-color: rgba(255, 255, 255, 0.15); /* Lighten background on hover in dark mode */
  filter: invert(1) brightness(1.1) contrast(1.2); /* Slightly brighter on hover */
  opacity: 1;
}

/* Adjust slide-in menu for dark mode */
body.dark-mode #float_menu,
:root[data-color-scheme="dark"] #float_menu {
  background-color: rgba(40, 40, 40, 0.97); /* Darker menu background */
  box-shadow: 2px 0 5px rgba(0,0,0,0.5); /* Shadow might need adjustment or can stay */
}

body.dark-mode #float_menu ul.Menu.-vertical > li,
:root[data-color-scheme="dark"] #float_menu ul.Menu.-vertical > li {
  border-bottom-color: #4a4a4a; /* Darker separator */
}

body.dark-mode #float_menu ul.Menu.-vertical > li > a,
:root[data-color-scheme="dark"] #float_menu ul.Menu.-vertical > li > a {
  color: #f1f1f1; /* Light text for menu items */
}

body.dark-mode #float_menu ul.Menu.-vertical > li > a:hover,
:root[data-color-scheme="dark"] #float_menu ul.Menu.-vertical > li > a:hover {
  background-color: #3a3a3a; /* Darker hover for menu items */
}

/* Powered by Hoody.com link in dark mode */
body.dark-mode #hoody_menu_footer_link,
:root[data-color-scheme="dark"] #hoody_menu_footer_link { /* Target by ID */
    background-color: rgba(40, 40, 40, 0.97); /* Match dark menu background */
    /* border-top-color is already in inline style, but can be overridden if needed:
    border-top-color: #4a4a4a !important; */
}

body.dark-mode #hoody_menu_footer_link a,
:root[data-color-scheme="dark"] #hoody_menu_footer_link a { /* Target by ID */
    /* color: #aaa; /* This is already handled by inline style or can be added if needed */
}

/* Submenus in dark mode */
body.dark-mode #float_menu ul.Menu.-vertical ul,
:root[data-color-scheme="dark"] #float_menu ul.Menu.-vertical ul {
  background-color: #303030; /* Darker submenu background */
  border-top-color: #4a4a4a;
}

/* Ensure icons in menu are visible in dark mode if they are font icons or SVGs affected by color */
body.dark-mode #float_menu ul.Menu.-vertical *[data-icon]:before,
:root[data-color-scheme="dark"] #float_menu ul.Menu.-vertical *[data-icon]:before {
  color: #f1f1f1; /* Assuming icons inherit color, make them light */
  /* If icons are images, they might need their own filter: invert(1) rule if they are dark */
}

/* Dark mode for bottom left menu icons (latency, display, etc.) */
body.dark-mode #float_menu *[data-icon]:before,
:root[data-color-scheme="dark"] #float_menu *[data-icon]:before {
  color: #f1f1f1 !important; /* Make all icons white in dark mode */
}

/* Window List Submenu Specific Styles */
#float_menu #open_windows_list {
  min-width: 350px; /* Wider submenu for window titles */
  width: 100%; /* Use full menu width */
}

/* Window list item styling */
#float_menu #open_windows_list .windowlist-li {
  display: block;
  width: 100%;
  border-bottom: 1px solid #ddd;
}

#float_menu #open_windows_list .windowlist-li a {
  display: flex;
  align-items: center;
  padding: 2px 16px;
  padding-right: 4px; /* Minimal right padding to ensure controls fit */
  text-decoration: none;
  color: #333;
  min-height: 40px;
  position: relative;
  font-size: 15px;
}

#float_menu #open_windows_list .windowlist-li a:hover {
  background-color: #e7e7e7;
}

/* Show controls more prominently on hover */
#float_menu #open_windows_list .windowlist-li:hover .menu-divright {
  background-color: rgba(0, 0, 0, 0.1);
}

/* Window list left section (icon + title) */
#float_menu #open_windows_list .menu-divleft {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0; /* Allow text to truncate */
}

/* Override menu-skin.css width: 0px for window list items */
#float_menu #open_windows_list .windowlist-li .menu-content-left {
  width: auto !important; /* Override the 0px width from menu-skin.css */
  display: flex !important; /* Override display: inline */
  align-items: center;
  flex: 1;
  min-width: 0;
  float: none !important; /* Override float: left */
}

/* Window list icon styling */
#float_menu #open_windows_list .menu-content-left img {
  width: 24px !important; /* Force 24px width for icons */
  height: 24px !important; /* Force 24px height for icons */
  margin-right: 8px;
  flex-shrink: 0; /* Prevent icon from shrinking */
}

/* Window list title styling */
#float_menu #open_windows_list .menu-content-left div {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: inherit;
}

/* Window list right section (control buttons) - always visible */
#float_menu #open_windows_list .menu-divright {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0; /* Never shrink the controls */
  background-color: inherit;
  padding: 2px;
  border-radius: 3px;
  min-width: 54px; /* Minimum width for 3 buttons */
  justify-content: flex-end;
  overflow: visible;
  position: relative; /* Use relative positioning instead of absolute */
}

#float_menu #open_windows_list .menu-content-right {
  width: 16px;
  height: 16px;
  min-width: 16px; /* Prevent shrinking */
  opacity: 0.7;
  cursor: pointer;
  flex-shrink: 0; /* Prevent buttons from shrinking */
}

#float_menu #open_windows_list .menu-content-right:hover {
  opacity: 1;
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

/* Dark mode styles for window list */
body.dark-mode #float_menu #open_windows_list .windowlist-li,
:root[data-color-scheme="dark"] #float_menu #open_windows_list .windowlist-li {
  border-bottom-color: #4a4a4a;
}

body.dark-mode #float_menu #open_windows_list .windowlist-li a,
:root[data-color-scheme="dark"] #float_menu #open_windows_list .windowlist-li a {
  color: #f1f1f1; /* Light text in dark mode */
}

body.dark-mode #float_menu #open_windows_list .windowlist-li a:hover,
:root[data-color-scheme="dark"] #float_menu #open_windows_list .windowlist-li a:hover {
  background-color: #3a3a3a;
}

body.dark-mode #float_menu #open_windows_list .menu-content-left div,
:root[data-color-scheme="dark"] #float_menu #open_windows_list .menu-content-left div {
  color: #f1f1f1; /* Ensure window titles are light in dark mode */
}

body.dark-mode #float_menu #open_windows_list .menu-content-right,
:root[data-color-scheme="dark"] #float_menu #open_windows_list .menu-content-right {
  filter: invert(1) brightness(0.9); /* Make controls white in dark mode */
}

body.dark-mode #float_menu #open_windows_list .menu-content-right:hover,
:root[data-color-scheme="dark"] #float_menu #open_windows_list .menu-content-right:hover {
  background-color: rgba(255, 255, 255, 0.15);
  filter: invert(1) brightness(1.1); /* Brighter on hover */
}

/* Dark mode styles for controls row */
body.dark-mode #float_menu #open_windows_list .menu-divright,
:root[data-color-scheme="dark"] #float_menu #open_windows_list .menu-divright {
  background-color: rgba(255, 255, 255, 0.05); /* Subtle background for dark mode */
}

body.dark-mode #float_menu #open_windows_list .windowlist-li:hover .menu-divright,
:root[data-color-scheme="dark"] #float_menu #open_windows_list .windowlist-li:hover .menu-divright {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Responsive behavior for narrow menu widths */
@media (max-width: 300px) {
  #float_menu #open_windows_list .windowlist-li a {
    padding: 2px 4px; /* Reduce padding for small screens */
    font-size: 13px;
  }
  
  #float_menu #open_windows_list .menu-divright {
    gap: 1px; /* Minimal gap between buttons */
    padding: 1px;
    min-width: 42px; /* Smaller minimum width */
  }
  
  #float_menu #open_windows_list .menu-content-right {
    width: 12px; /* Much smaller buttons */
    height: 12px;
    min-width: 12px;
  }
}

/* For extremely narrow widths - make everything as compact as possible */
#float_menu[style*="width: 2"] #open_windows_list .windowlist-li a,
#float_menu[style*="width: 1"] #open_windows_list .windowlist-li a {
  padding: 1px 2px !important; /* Absolute minimal padding */
  font-size: 11px !important; /* Smaller font */
}

#float_menu[style*="width: 2"] #open_windows_list .menu-divleft,
#float_menu[style*="width: 1"] #open_windows_list .menu-divleft {
  min-width: 0 !important;
  overflow: hidden;
}

#float_menu[style*="width: 2"] #open_windows_list .menu-content-left div,
#float_menu[style*="width: 1"] #open_windows_list .menu-content-left div {
  font-size: 10px !important; /* Very small text */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#float_menu[style*="width: 2"] #open_windows_list .menu-divright,
#float_menu[style*="width: 1"] #open_windows_list .menu-divright {
  gap: 0px !important; /* No gap at all */
  padding: 0px !important;
  min-width: 36px !important; /* Very compact */
}

#float_menu[style*="width: 2"] #open_windows_list .menu-content-right,
#float_menu[style*="width: 1"] #open_windows_list .menu-content-right {
  width: 10px !important; /* Tiny buttons */
  height: 10px !important;
  min-width: 10px !important;
}

/* Removed fragile width-based overrides - flexbox wrapping handles small widths better */

/* Dark mode styles for resize handles */
body.dark-mode .ui-resizable-handle:hover,
:root[data-color-scheme="dark"] .ui-resizable-handle:hover {
  background-color: rgba(129, 199, 132, 0.4); /* Green accent color for dark mode */
}

/* SweetAlert2 Dark Mode Support */
body.dark-mode .swal2-popup,
:root[data-color-scheme="dark"] .swal2-popup {
  background: #19191a !important;
  color: #e1e1e1 !important;
}

body.dark-mode .swal2-title,
:root[data-color-scheme="dark"] .swal2-title {
  color: #e1e1e1 !important;
}

body.dark-mode .swal2-html-container,
:root[data-color-scheme="dark"] .swal2-html-container {
  color: #e1e1e1 !important;
}

body.dark-mode .swal2-input,
body.dark-mode .swal2-textarea,
body.dark-mode .swal2-select,
:root[data-color-scheme="dark"] .swal2-input,
:root[data-color-scheme="dark"] .swal2-textarea,
:root[data-color-scheme="dark"] .swal2-select {
  background: #2a2a2a !important;
  color: #e1e1e1 !important;
  border: 1px solid #555 !important;
}

body.dark-mode .swal2-input::placeholder,
body.dark-mode .swal2-textarea::placeholder,
:root[data-color-scheme="dark"] .swal2-input::placeholder,
:root[data-color-scheme="dark"] .swal2-textarea::placeholder {
  color: #aaa !important;
}

body.dark-mode .swal2-footer,
:root[data-color-scheme="dark"] .swal2-footer {
  border-top-color: #555 !important;
  color: #e1e1e1 !important;
}

body.dark-mode .swal2-validation-message,
:root[data-color-scheme="dark"] .swal2-validation-message {
  background: #2a2a2a !important;
  color: #e1e1e1 !important;
}

body.dark-mode .swal2-close,
:root[data-color-scheme="dark"] .swal2-close {
  color: #ccc !important;
}

body.dark-mode .swal2-close:hover,
:root[data-color-scheme="dark"] .swal2-close:hover {
  color: #f27474 !important;
}

/* Active Apps count badge styling */
#active_apps_count {
  margin-left: auto;
  background-color: rgba(0, 0, 0, 0.2);
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: bold;
  min-width: 16px;
  text-align: center;
  transition: background-color 0.3s ease;
}

/* Dark mode styling for the count badge */
body.dark-mode #active_apps_count,
:root[data-color-scheme="dark"] #active_apps_count {
  background-color: rgba(255, 255, 255, 0.2);
  color: #f1f1f1;
}

/* Ensure the Active Apps menu item uses flexbox for proper alignment */
#open_windows > a {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}

/* Connection Settings Modal Styles */
#connection_settings_modal {
  display: none; /* Initially hidden, shown by JS */
}

#connection_settings_modal.show {
  display: flex; /* Only show when .show class is added */
}

/* Eye-icon toggle for masked ID inputs */
.input-mask-toggle {
  background: none;
  border: none;
  color: var(--icon-base);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  margin: 0;
  flex-shrink: 0;
  align-self: stretch;
  border-radius: var(--radius-md);
}
.input-mask-toggle:hover {
  color: var(--icon-strong-base);
}
.input-mask-toggle:focus-visible {
  outline: 2px solid var(--border-selected);
  outline-offset: -2px;
}

/* Connection Offline (pre-)Modal Styles */
#connection_offline_modal {
  display: none;
}
#connection_offline_modal.show {
  display: flex;
}
#connection_offline_modal [data-slot="dialog-container"] {
  width: min(100vw - 32px, 460px);
  height: auto;
}
#connection_offline_modal [data-slot="dialog-content"] {
  min-height: 0;
  padding: 28px 28px 24px;
}
.connection-offline-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  width: 100%;
}
.connection-offline-card .offline-icon {
  font-family: 'materialicons';
  font-size: 44px;
  color: var(--icon-base);
  line-height: 1;
}
.connection-offline-card h2 {
  margin: 0;
  font-family: var(--font-family-sans);
  font-size: 18px;
  font-weight: var(--font-weight-medium);
  color: var(--text-strong);
}
.connection-offline-card p {
  margin: 0;
  font-family: var(--font-family-sans);
  font-size: 14px;
  line-height: var(--line-height-large);
  color: var(--text-base);
}
.connection-offline-card .offline-reason {
  font-size: 12px;
  color: var(--text-weak);
  margin-top: -4px;
}
.connection-offline-card .offline-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
  flex-wrap: wrap;
}
.connection-offline-card .offline-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-weak-base);
  border-top-color: var(--icon-strong-base);
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  animation: connection-offline-spin 0.9s linear infinite;
}
@keyframes connection-offline-spin {
  to { transform: rotate(360deg); }
}

/* Legacy modal classes removed — design system components.css handles dialog/form styling */

#keyboard-restore-icon {
  background: none !important;
  border: none !important;
  color: var(--keyboard-restore-icon-color);
}

body:not(.dark-mode) #keyboard-restore-icon,
:root:not([data-color-scheme="dark"]) #keyboard-restore-icon {
  --keyboard-restore-icon-color: black;
}

body.dark-mode #keyboard-restore-icon,
:root[data-color-scheme="dark"] #keyboard-restore-icon {
  --keyboard-restore-icon-color: white;
}

/* Recording indicator */
#record_indicator {
  position: fixed; top: 12px; right: 12px; z-index: 100003;
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.8); color: #fff;
  padding: 6px 14px; border-radius: 20px;
  font-size: 13px; font-family: monospace;
  cursor: pointer; user-select: none;
  transition: background 0.15s;
}
#record_indicator:hover {
  background: rgba(40,40,40,0.95);
}
.record-dot {
  width: 10px; height: 10px; background: #ff3b30;
  border-radius: 50%; animation: record-pulse 1s ease-in-out infinite;
  flex-shrink: 0;
}
.record-stop-hint {
  font-weight: 600; letter-spacing: 0.03em;
  opacity: 0.5; transition: opacity 0.15s;
}
#record_indicator:hover .record-stop-hint { opacity: 1; }
.record-shortcut {
  font-size: 10px; padding: 1px 5px;
  background: rgba(255,255,255,0.15); border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.2);
  opacity: 0.6;
}
#record_indicator:hover .record-shortcut { opacity: 1; }
@keyframes record-pulse { 0%,100% { opacity:1 } 50% { opacity:0.3 } }

/* Post-recording toast notification */
#record_toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100004;
  display: none; align-items: center; gap: 10px;
  background: rgba(0,0,0,0.85); color: #fff;
  padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: record-toast-in 0.3s ease-out;
}
#record_toast.dismissing {
  animation: record-toast-out 0.3s ease-in forwards;
}
.record-toast-icon { font-size: 18px; flex-shrink: 0; }
.record-toast-text { line-height: 1.4; }
.record-toast-dismiss {
  background: none; border: none; color: rgba(255,255,255,0.5);
  cursor: pointer; font-size: 16px; padding: 0 0 0 8px; line-height: 1;
}
.record-toast-dismiss:hover { color: #fff; }
@keyframes record-toast-in { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }
@keyframes record-toast-out { from { opacity:1; transform: translateY(0); } to { opacity:0; transform: translateY(10px); } }
