@font-face {
  font-family: 'Bodoni Moda';
  src: url('fonts/BodoniModa.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-optical-sizing: auto; /* Enable optical sizing */
}

:root {
  --clock-font: 'Bodoni Moda', cursive;
  --date-font-size: min(2.5vw, 50px);
  --time-font-size: min(1.25*7vw, 1.25*150px);
  --date-font-weight: normal;
  --time-font-weight: bold;
  --clock-filter: blur(8px) saturate(150%) contrast(140%) brightness(150%);
  --clock-color: rgba(255, 255, 255, 0.65);
  --ui-box-color: rgba(255, 255, 255, 0.4);
  --ui-box-shadow: 0 8px 32px 0 rgba(38, 38, 40, 0.37);
  --ui-box-filter: blur(32px) saturate(120%);
  --password-box-color: rgba(255, 255, 255, 0.2);
  --password-box-border: 1px solid rgba(255, 255, 255, 0.4);
  --password-placeholder-font-color: rgba(255, 255, 255, 0.7);
  --settings-header-separation-line: 1px solid rgba(255, 255, 255, 0.3);
  --session-selector-box-color: rgba(255, 255, 255, 0.2);
  --session-selector-box-border: 1px solid rgba(255, 255, 255, 0.4);
}

::selection {
  background-color: #444;
  color: white;
}

body {
  margin: 0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #000;
  /* Default black background */
  font-family: 'Arial', sans-serif;
  overflow: hidden;
}

.background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

.container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
  max-height: calc(65vh - 20px);
  overflow: visible;
}

.glass-text-container {
  top: 10vh;
  position: fixed;
  width: 1200px;
  height: 300px;
  margin: 0 auto;
}

.glass-effect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  -webkit-mask-image: url("#clock-mask");
  mask-image: url("#clock-mask");
  backdrop-filter: var(--clock-filter);
  -webkit-backdrop-filter: var(--clock-filter);
  background-color: var(--clock-color);
}

/* Fallback clock styles */
.fallback-clock {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: white;
  font-family: var(--clock-font);
  text-align: center;
}

.fallback-date {
  position: absolute;
  top: 100px;
  left: 0;
  width: 100%;
  font-size: var(--date-font-size);
  font-weight: var(--date-font-weight);
}

.fallback-time {
  position: absolute;
  top: 130px;
  left: 0;
  width: 100%;
  font-size: var(--time-font-size);
  font-weight: var(--time-font-weight);
}

#login-container {
  position: fixed;
  top: 50%;
  bottom: auto;
  left: 50%;
  transform: translate(-50%, -10%);
  width: clamp(320px, 50vw, 800px);
  height: clamp(320px, 40vh, 400px);
  display: grid;
  grid-template-columns: 1fr 2fr; /* 1/3 for logo, 2/3 for content */
  z-index: 5;
  background: var(--ui-box-color);
  box-shadow: var(--ui-box-shadow);
  backdrop-filter: var(--ui-box-filter);
  -webkit-backdrop-filter: var(--ui-box-filter);
  border-radius: 10px;
  overflow: hidden;
  margin-top: auto;
}

.login-logo {
  grid-column: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.5);
  padding: 20px;
  position: relative;
  box-sizing: border-box;
}

.login-logo img {
  width: 180px;
  height: 180px;
  object-fit: contain;
}

#login-form {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: min(20px, 3vw);
  box-sizing: border-box;
}

.username {
  color: white;
  font-size: 24px;
  margin-bottom: 20px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.unselectable {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#password-input {
  width: 80%;
  padding: 12px;
  background: var(--password-box-color);
  border: var(--password-box-border);
  border-radius: 5px;
  color: white;
  font-size: 16px;
  outline: none;
}

#password-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

#settings-enter {
  position: absolute;
  background: none;
  border: none;
  padding: 0;
  margin: 10px;
  bottom: 0;
  left: 0;
  font-size: 3vw;
  width: 2em;
  height: 2em;
  cursor: pointer;
}

#settings-enter:hover span::before,
#settings-enter:focus span::before {
  transform: rotate(180deg);
}

#settings-enter span::before {
  transition: 300ms;
}

#main-screen {
  position: relative;
  width: 100%;
  height: 100%;
  transition: opacity 0.9s ease;
}

#main-screen.invisible {
  opacity: 0;
}

.hide {
  opacity: 0;
  visibility: hidden;
}

.hidden {
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
}

/* Animation for login form <-> user selection panel transition */
#login-form {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: translateX(0);
  opacity: 1;
}

#login-form.hidden {
  transform: translateX(-100%);
  opacity: 0;
  visibility: hidden;
}

.settings-cog {
  color: white;
}

.settings-menu {
  position: absolute;
  bottom: 10vh;
  left: 15px;
  width: 300px;
  background: var(--ui-box-color);
  box-shadow: var(--ui-box-shadow);
  backdrop-filter: var(--ui-box-filter);
  -webkit-backdrop-filter: var(--ui-box-filter);
  border-radius: 10px;
  padding: 20px;
  z-index: 10;
  transition: opacity 0.3s, visibility 0.3s;
}

.settings-menu-header {
  color: white;
  font-size: 18px;
  margin-bottom: 15px;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  border-bottom: var(--settings-header-separation-line);
  padding-bottom: 10px;
}

.settings-menu-item {
  display: flex;
  align-items: center;
  color: white;
  padding: 10px 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.nice-button:hover {
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  padding: 10px;
  margin: 0 -10px;
}

.settings-menu-item span {
  margin-right: 10px;
}

.settings-menu-separator {
  height: 6px;
}

#session-selector {
  width: 100%;
  background: var(--session-selector-box-color);
  border: var(--session-selector-box-border);
  border-radius: 5px;
  padding: 8px;
  color: white;
  margin-top: 5px;
  outline: none;
}

#session-selector option {
  background: #444;
}

/* Profile picture hover styles */
#selected-user-pfp-container {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 15px;
  cursor: pointer;
}

.profile-pic {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-pic-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  /* black tint */
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#selected-user-pfp-container:hover .profile-pic-overlay {
  opacity: 1;
}

.change-user-text {
  color: white;
  font-size: 16px;
  text-align: center;
  line-height: 1.3;
  font-weight: bold;
}

/* User Selection Panel Styles */
#user-selection-panel {
  grid-column: 2;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 20px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: translateX(0);
  opacity: 1;
  box-sizing: border-box;
}

.user-selection-header {
  color: white;
  font-size: 22px;
  margin-bottom: 20px;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  text-align: center;
  padding-bottom: 10px;
}

.users-table-container {
  flex: 1;
  overflow-y: auto;
  margin-right: -10px;
  padding-right: 10px;
}

/* Custom scrollbar for the user selection container */
.users-table-container::-webkit-scrollbar {
  width: 6px;
}

.users-table-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.users-table-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.users-table-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* On-screen console styles */
#on-screen-console {
  position: fixed;
  bottom: 10px;
  right: 10px;
  width: 400px;
  max-height: 200px;
  background: rgba(0, 0, 0, 0.7);
  color: #33ff33;
  font-family: monospace;
  font-size: 12px;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow-y: auto;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

#on-screen-console.hidden {
  opacity: 0;
  visibility: hidden;
}

#console-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding-bottom: 5px;
  margin-bottom: 5px;
}

#console-header .title {
  font-weight: bold;
}

#console-header .controls span {
  cursor: pointer;
  margin-left: 10px;
}

#console-content {
  max-height: 150px;
  overflow-y: auto;
}

#console-content::-webkit-scrollbar {
  width: 6px;
}

#console-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

#console-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

#console-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

#console-content .log-entry {
  margin-bottom: 3px;
  word-wrap: break-word;
}

#console-content .log-entry.error {
  color: #ff5555;
}

#console-content .log-entry.warn {
  color: #ffff55;
}

#users-table {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  justify-items: center;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.user-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 90%; /* Reduced width to prevent overlap */
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  transition: background-color 0.2s;
  box-sizing: border-box;
  margin: 0 auto; /* Center each item in its grid cell */
}

.user-item:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.user-item-pfp-container {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 10px;
}

.user-item-pfp {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-item-name {
  color: white;
  font-size: 16px;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}