html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* 🌿 Base Styles */
body {
  font-family: sans-serif;
  background-color: lightgreen;
  display: flex;
  flex-direction: column;
}

/* Chat Messages */
#messages, .message-area {
  flex: 1;
  height: calc(100vh - 150px);
  overflow-y: auto;
  padding: 1rem;
  box-sizing: border-box;
  margin-bottom: 160px; /* Leave space for preview/footer */
}

.msg {
  background: #fff;
  border-radius: 8px;
  margin-bottom: 1rem;
  padding: 0.75rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  max-width: 80%;
  word-wrap: break-word;
}
.msg.me {
  background: #e0f7fa;
  align-self: flex-end;
  margin-left: auto;
}
.msg.they {
  background: #fff8e1;
  align-self: flex-start;
  margin-right: auto;
}

.timestamp, .lang-label {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 4px;
}

.label {
  font-weight: bold;
  margin-bottom: 4px;
}

.original {
  font-style: italic;
  margin-bottom: 4px;
}

.translated {
  font-weight: 500;
  color: #333;
}

/* 🎤 Mic & Chat Buttons */
#mic-btn {
  padding: 0.5rem;
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 9999;
}

#mic-btn {
  background: #28a745;
  font-size: 1.2rem;
  top: 1rem;
}
#mic-btn:hover {
  background: #218838;
}

.settings-panel {
  display: none;
  position: fixed;
  top: 50px;
  left: 10px;
  background: white;
  border: 1px solid #ccc;
  padding: 10px;
  max-width: 400px;
  z-index: 9998;
}

/* 🧪 Debug Panel + Advanced Settings */
#debug-toggle, #adv-settings-toggle {
  position: fixed;
  left: 20px;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: #007bff;
  color: white;
  cursor: pointer;
  z-index: 1000;
}

#debug-toggle {
  bottom: 180px;
}
#adv-settings-toggle {
  bottom: 120px;
}

#debug-panel {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: white;
  border: 2px solid #333;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 999;
  max-width: 280px;
}

.lang-warning {
  color: orange;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* 📢 Translated Output Panel */
.top-my-output {
  margin-top: 6px;
  font-style: italic;
  font-size: 0.95rem;
  color: #007b8a;
  background-color: #e6f7fa;
  padding: 6px 10px;
  border-left: 3px solid #00a6b6;
  border-radius: 4px;
  max-width: 90%;
  word-wrap: break-word;
}

/* 🧑‍⚖️ Moderator Messages */
.moderator-suggestion {
  margin-top: 8px;
  font-style: italic;
  color: #333;
  background: #ffffe0;
  padding: 6px;
  border-left: 4px solid #ffcc00;
}

.moderator-ok {
  margin-top: 6px;
  padding: 6px;
  background-color: #e9fbe9;
  border-left: 3px solid green;
  font-style: italic;
}

/* 🪟 Preview Panel */
#preview {
  border-top: 1px solid #ccc;
  background: #f9f9f9;
  padding: 1rem;
  display: none;
  position: fixed;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
}
#text-preview {
  margin-bottom: 1rem;
}

#textInput {
  width: 92%;
  height: 3rem;
  margin-bottom: 3px;
}

/* 🧭 Settings Panels */
#moderation-settings-wrapper {
  position: relative;
}

#translated-output-toggle {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 1;
}

#settings-container {
  padding: 1rem;
  max-height: 90vh;
  overflow-y: auto;
}

/* ⚙️ Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  background: #fff;
  border-bottom: 1px solid #ccc;
  position: sticky;
  top: 0;
  z-index: 9999;
}

/*
#logout-btn, #login-btn {
  float: right;
}
*/

/* Panel Wrapper Blocks */
.panel-wrapper {
  background-color: #f9f9f9;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}
.panel-wrapper h3 {
  margin-top: 0;
  font-size: 1.1rem;
  color: #333;
}
.panel-wrapper label {
  display: block;
  margin: 0.5rem 0;
  font-size: 0.95rem;
}
.panel-wrapper select,
.panel-wrapper input[type="text"],
.panel-wrapper input[type="checkbox"] {
  margin-left: 0.5rem;
}
.panel-wrapper button {
  margin-top: 0.75rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.95rem;
  border-radius: 4px;
  border: none;
  background-color: #007bff;
  color: white;
  cursor: pointer;
}
.panel-wrapper button:disabled {
  background-color: #5cb85c;
  cursor: default;
}

/* Footer Input Bar */
#footer {
  display: flex;
  flex-direction: column;
  padding: 10px;
  border-top: 1px solid #ccc;
  background: white;
}
.footer-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 10px;
}
.footer-input {
  display: flex;
  gap: 10px;
}
.footer-input input {
  flex: 1;
  padding: 0.5rem;
  font-size: 1rem;
}

.preview-controls {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* 🧑‍💻 Global Buttons */
button {
  background: #007bff;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 0.5rem;
}
button:hover {
  background: #0056b3;
}

.hidden {
  display: none;
}

/* 📱 Mobile Tweaks */
@media (max-width: 600px) {
  .panel-wrapper {
    font-size: 0.9rem;
  }

  .panel-wrapper button {
    font-size: 0.85rem;
    padding: 0.35rem 0.6rem;
  }
}

@media (max-width: 360px) {
  .preview-controls {
    gap: 5px;
  }

  .input-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .input-bar input[type="text"] {
    font-size: 0.9rem;
    padding: 6px;
  }

  .input-bar button {
    font-size: 1.1rem;
    padding: 6px 10px;
    margin-left: 0;
  }

  #mic-btn {
    align-self: flex-end;
    margin-top: -6px;
  }
}

@media (max-width: 344px) {
  .preview-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    padding-top: 8px;
  }
}
