body,
html {
  font-family: "Inter", sans-serif;
  text-shadow: 2px 2px 2px rgba(0, 0, 0, 1), 2px 2px 2px rgba(0, 0, 0, 0.9);
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: black;
  display: flex;
  height: 100vh;
  width: 100vw;
  color: white;
}
#canvas-container {
  flex-grow: 1;
  position: relative;
  min-width: 0; /* This is important to allow shrinking */
  min-height: 0; /* This is important to allow shrinking */
}
canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}
#control-panel {
  width: 15%;
  min-width: 390px;
  height: 100vh;
  background: rgba(30, 30, 30, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 10px;
  box-sizing: border-box;
}

/* New button row */
#view-toggle {
  display: flex;
  gap: 10px;
}
#view-toggle button {
  background: #222;
  border-radius: 8px;
  padding: 8px; /* some padding so background shows nicely */
  border: none;
  cursor: pointer;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#view-toggle button img {
  width: 32px;
  height: 32px;
  pointer-events: none;
  user-select: none;
  display: block;
}

#view-toggle button.active,
#view-toggle button[aria-pressed="true"] {
  background: #444; /* darker bg when active */
}
#view-toggle button:hover:not(.active):not(:disabled) {
  background: #333;
}
#view-toggle button svg {
  fill: white;
  width: 20px;
  height: 20px;
}
#view-toggle button:disabled {
  color: rgb(116, 116, 116);
  background: #2b2b2b;
  transition: none; /* Disable animation for disabled buttons */
}
#view-toggle button:disabled img {
  opacity: 0.5;
}

button {
  font-family: "Inter", sans-serif;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
  width: 100%;
  background: #444;
  color: white;
  padding: 12px 0;
  border: none;
  cursor: pointer;
  font-size: 16px;
  border-radius: 8px;
  user-select: none;
  transition: background 0.3s ease;
}
select {
  font-family: "Inter", sans-serif;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
  width: 100%;
  padding: 8px 8px 8px 8px; /* Reduce right padding for more text space */
  border-radius: 6px;
  border: none;
  font-size: 14px;
  box-sizing: border-box;
  background-color: #444;
  color: white;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  background-image: url("data:image/svg+xml;utf8,<svg fill='gray' height='16' viewBox='0 0 24 24' width='16' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 12px; /* Smaller icon */
}

button:hover,
select:hover {
  background: #666;
}
button:disabled {
  color: rgb(116, 116, 116);
  background: #2b2b2b;
}
select:disabled {
  color: rgb(116, 116, 116);
  background: #2b2b2b;
}
input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder {
  font-family: "Inter", sans-serif;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
  font-size: 14px;
  color: #999999;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  font-family: "Inter", sans-serif;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.65);
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  box-sizing: border-box;
  background: #444;
  color: white;
}

input[type="text"]:disabled,
input[type="password"]:disabled,
input[type="number"]:disabled {
  color: rgb(116, 116, 116);
  background: #2b2b2b;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  margin: 0;
  border: 2px solid #ccc;
  border-radius: 4px;
  background: #444;
  color: white;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

input[type="checkbox"]:checked {
  background-color: #4caf50;
  border-color: #4caf50;
}

input[type="checkbox"]::after {
  content: "";
  position: absolute;
  display: none;
  top: 2px;
  left: 10px;
  width: 6px;
  height: 18px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="checkbox"]:checked::after {
  display: block;
}
label {
  padding-top: 10px;
  align-self: flex-start;
  font-size: 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
#status {
  margin-top: 10px;
  font-size: 14px;
  min-height: 20px;
  text-align: center;
  color: #ccc;
}

/* Chat UI */

#chat-section {
  flex-direction: column;
  width: 100%;
}

#chat-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: #161616; /* Unified with padded-div */
  border-radius: 8px;
  padding: 10px;
  box-sizing: border-box;
}

#chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  margin-bottom: 8px;
  font-size: 14px;
  border: 1px solid #333;
  padding: 6px;
  background: #111;
  border-radius: 6px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Alternating message backgrounds for clarity */
.chat-message {
  padding: 2px 2px;
  border-radius: 4px;
  transition: background-color 0.3s ease;
  margin-bottom: 2px;
  background-color: #1e1e1e; /* default fallback */
}

.chat-message:nth-child(even) {
  background-color: #2a2a2a;
}

.chat-message:nth-child(odd) {
  background-color: #1f1f1f;
}

#chat-input-container {
  display: flex;
  gap: 6px;
}

/* text chat formatting */
.chat-bold {
  font-weight: bold;
}
.chat-italic {
  font-style: italic;
}
.chat-color-blue {
  color: #00aaff;
}
.chat-color-red {
  color: #ff4444;
}
.chat-color-green {
  color: #44dd44;
}
.chat-color-yellow {
  color: #ffcc00;
}
.chat-color-orange {
  color: #ff8800;
}
.chat-color-purple {
  color: #aa66cc;
}
.chat-color-pink {
  color: #ff66aa;
}
.chat-color-cyan {
  color: #00dddd;
}
.chat-color-white {
  color: #ffffff;
}
.chat-color-gray {
  color: #aaaaaa;
}
.chat-color-black {
  color: #000000;
}
.chat-color-brown {
  color: #a0522d;
}
.chat-color-gold {
  color: #ffd700;
}
.chat-color-lime {
  color: #99ff33;
}

#overlay-div {
  position: absolute;
  top: 10px;
  right: 10px;
  border-radius: 10px;
  width: 10%;
  min-width: 300px;
  background: #1b1b1b;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 15px;
  padding-bottom: 20px;
  padding-top: 5px;
  box-sizing: border-box;

  /* Make scrollable if too tall */
  max-height: calc(100vh - 20px); /* account for top+bottom spacing */
  overflow-y: auto;
}

.section {
  width: 100%; /* Reserve space for scrollbar */
  display: none;
  flex-direction: column;
  flex-grow: 1;
  overflow-y: auto; /* All sections can scroll vertically */
  overflow-x: hidden;
  max-height: 100%;
  box-sizing: content-box; /* Padding is not part of width */
  position: relative;
}

/* Active section should be visible */
.section.active {
  display: flex;
}

/* Dark-themed scrollbar for all sections (Webkit - Chrome, Safari, Edge) */
.section::-webkit-scrollbar {
  width: 8px;
}

.section::-webkit-scrollbar-track {
  background: #2b2b2b;
}

.section::-webkit-scrollbar-thumb {
  background-color: #444;
  border-radius: 4px;
  border: 1px solid #333;
}

/* Scrollbar for Firefox */
.section {
  scrollbar-width: thin;
  scrollbar-color: #444 #2b2b2b;
}

.button-row-div {
  display: flex;
  gap: 10px;
  align-items: center;
}

.overlay-inline-field {
  display: flex;
  gap: 20px;
  width: 100%;
}

.overlay-input-group {
  display: flex;
  flex-direction: column;
  flex: 1; /* Evenly distribute space across all inputs */
  min-width: 0; /* Prevent overflow in shrinking containers */
  gap: 4px;
}

.img-with-text {
  display: flex;
  align-items: center; /* Vertically center the text with the image */
  gap: 8px; /* Space between the image and the text */
}

.img-with-text img {
  width: 32px;
  height: 32px;
  object-fit: contain; /* Ensures the image scales correctly without distortion */
}

.padded-div {
  background: #161616;
  border-radius: 8px;
  padding: 10px;
}

.parent-list {
  list-style-type: none; /* Remove default list bullets */
  padding: 0;
  margin: 0;
}

.list-item {
  padding-left: 24px; /* Increased indentation for main items */
  margin-bottom: 12px;
  font-weight: bold;
}

/* Sub-list styling */
.sub-list {
  list-style-type: none;
  padding-left: 40px; /* Increased indentation for sub-items */
  margin-top: 8px;
}

.sub-list li {
  margin-bottom: 8px;
}

/* Clickable Item Styling */
.clickable-item {
  text-decoration: none;
  color: #fff; /* Text color for dark theme */
  background-color: transparent;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  transition: background 0.3s, color 0.3s;
}

.clickable-item:hover {
  background-color: #444; /* Darker background on hover */
  color: #fff;
}

.clickable-item:active {
  background-color: #666; /* Even darker for active state */
}

.hidden {
  display: none !important;
}
