body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  height: 100vh;
  /* background: linear-gradient(to right, #fdf6e3, #f0f8ff); */
  background: #f0f8ff;
  color: #333;
}

#sidebar {
  position: fixed;
  flex-shrink: 0;
  top: 0;
  left: 0;
  width: 200px;
  height: 100vh; /* Full viewport height */
  background-color: #6a5acd;
  color: white;
  padding: 1rem;
  overflow-y: auto; /* Optional: make sidebar scrollable if content overflows */
  z-index: 1000; /* Stay on top */
}

#sidebar h2 {
  margin-top: 0.5rem;
  color: #fff;
}

#sidebar button {
  display: block;
  width: 100%;
  margin: 1rem 0;
  padding: 0.5rem;
  font-size: 1rem;
  background-color: #dcd6f7;
  color: #4b0082;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s;
}

#sidebar button:hover {
  background-color: #b3aee0;
}

#sidebar button.active {
  background-color: #ffeb3b;
  color: #000;
}

#sidebar.collapsed {
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

/* Make sidebar slide in/out */
#sidebar {
  transition: transform 0.3s ease;
}

/* Toggle button */
#sidebar-toggle {
  position: fixed;
  top: 10px;
  left: 180px; /* Move it to the right of the expanded sidebar */
  z-index: 1100;
  background-color: #6a5acd;
  color: white;
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 1.5rem;
  cursor: pointer;
  border-radius: 5px;
  transition: left 0.3s ease;
}

/* When sidebar is collapsed, move button to edge */
#sidebar.collapsed + #sidebar-toggle {
  left: 10px;
}

/* Shift main container when sidebar is collapsed */
#main-container.sidebar-collapsed {
  margin-left: 0;
  transition: margin-left 0.3s ease;
}

/* Optional: adjust responsiveness */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
  }

  #sidebar-toggle {
    left: 10px !important;
  }

  #main-container {
    margin-left: 0;
  }
}

#main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 100vh;
  margin-left: 200px;
}

#content {
  flex-grow: 1;
  padding: 0.5rem;

  /* Center content vertically and horizontally */
  display: flex;
  flex-direction: column;
  align-items: center;
  /*justify-content: center;*/
  text-align: center;
}

h1 {
  color: #4a148c;
  margin-bottom: 0.5rem;
}

.subtitle {
  margin-top: 0;
  font-size: 1rem;
  color: #555;
  margin-bottom: 1.5rem;
}

#visualization {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

#p5-container {
  border: 3px solid #008080; /* changed border to teal */
  border-radius: 2px;
  width: 200px;
  height: 200px;
}

#diagram-container {
  border: 3px solid #008080; /* changed border to teal */
  border-radius: 2px;
  width: 200px;
  height: 200px;
}

#unit-select-container {
  margin-bottom: 1rem;
}

form label {
  display: block;
  margin: 0.5rem 0 0.2rem;
  font-weight: bold;
}

form input {
  width: 120px;
  padding: 0.3rem;
  margin-bottom: 1rem;
  font-size: 1rem;
  border-radius: 4px;
  border: 1px solid #ccc;
}

#type-selector-container label,
#unit-select-container label {
  font-weight: bold;
  margin-right: 0.5rem;
}

#type-selector-container select,
#unit-select-container select {
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  border-radius: 4px;
  border: 1px solid #ccc;
}

#results {
  margin-top: 1rem;
  font-size: 1.1rem;
  color: #004d40;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  width: 300px;
}

#results label {
  font-weight: 600;
}

#results input[readonly] {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 1rem;
  border: 2px solid #008080;
  border-radius: 5px;
  background-color: #e0f2f1;
  color: #004d40;
}
