/* === Chat Room Layout === */
#page-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: 1200px;
  padding: 0 8px;
  margin-top: 5px;
  flex-wrap: nowrap;
  gap: 10px;
  height: 100%;
  flex: 1;
  height: calc(100vh - 100px);
}

#chat-center {
  flex: 1 1 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  max-height: 100%;
}

/* === Messages === */
#messages {
  background-color: #2e2e2e;
  border: 1px solid #444;
  padding: 8px;
  border-radius: 8px;
  width: 100%;
  height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  height: auto;
  max-height: calc(100vh - 205px);
}

#messages .message {
  line-height: 1.5em;
  padding: 4px 10px;
  word-wrap: break-word;
  background-color: #399fff8a;
  color: #f0f0f0;
  border-radius: 10px;
  margin-bottom: 4px;
  max-width: 90%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  align-self: flex-start;
  text-align: left

}

#messages .my-message {
  align-self: flex-end;
  background-color: #18794e;
  text-align: right;
  color: #fff;
}

/* === Chat Input Form === */
#chat-form {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
}

#message-input.inputfield {
  height: 42px;
  padding: 0 12px;
  /* horizontal padding only */
  line-height: 1;
}

/* === User List Sidebar === */
#user-list-container {
  flex: 0 1 230px;
  min-width: 180px;
  background-color: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 8px;
  height: fit-content;
  transition: max-height 0.3s ease-in-out;
}

#user-list-container h3 {
  margin-top: 0;
  font-size: 16px;
}

#user-list div {
  padding: 5px 0;
  color: #ccc;
  border-bottom: 1px solid #333;
}

#user-list-container > button {
  display: block; /* Forces buttons to stack vertically */
  width: fit-content; /* Only as wide as the text, not "full screen" */
  margin-bottom: 4px;
}

#user-list-container #user-list-toggle {
  display: none;
}

@media (max-width: 750px) {
  #page-container {
    flex-direction: column;
    height: auto;
    align-items: stretch;
  }

  #user-list-container {
    display: block;
    order: -1;
    width: 100%;
    flex: none;
    max-height: 38px;
    overflow: hidden;
    margin-bottom: 10px;
    padding: 0;
    cursor: default;
    transition: max-height 0.3s ease-in-out;
  }

  #user-list-container.expanded {
    max-height: 1200px;
    padding-bottom: 10px;
  }

  #user-list-container #user-list-toggle {
    display: block;
    width: 100%; /* The toggle bar should be full width on mobile */
    margin-bottom: 0;
    border-radius: 7px 7px 0 0;
  }

  #user-list-container.expanded #user-list-toggle {
    margin-bottom: 10px;
    border-bottom: 1px solid #444;
  }

  #user-list-container > *:not(#user-list-toggle) {
    margin-left: 10px;
    margin-right: 10px;
  }

  #user-list-container h3 {
    display: block;
    margin-top: 10px;
    text-align: left;
  }
}

/* === Chat Components === */
.mic-button {
  margin: 0 0.5em;
}

.mic-button.recording {
  background-color: #ff4d4d !important;
}

.toggle-off {
  background-color: #808080 !important;
}

.audio-container {
  margin-top: 0.25em;
}

.voice-message-audio {
  height: 30px;
  max-width: 100%;
}

.kick-button {
  margin-left: 0.5em;
}