@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ===== BASE ===== */
body {
  background: radial-gradient(circle at top, #161b22 0%, #0e1116 60%);
  color: #e6e9ee;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  height: 100vh;
  overflow: hidden;
}

:root {
  --app-footer-height: 36px;
}

#toggle-sidebar-btn {
  display: none;
}

.chat-image {
  max-width: 80%;
  max-height: 400px;
  border-radius: 12px;
  object-fit: contain;
  cursor: pointer;           /* → öffnet Viewer? */
}
#voice-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.voice-box {
  background: #111;
  padding: 24px;
  border-radius: 12px;
  color: #fff;
  text-align: center;
}

.voice-overlay-content {
  background: #0f1625;
  padding: 24px;
  border-radius: 12px;
  min-width: 280px;
  text-align: center;
}

#voice-timer {
  font-size: 32px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 20px;
}

.voice-actions {
  display: flex;
  justify-content: space-between;
}


#upload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#upload-overlay.hidden {
  display: none;
}

.upload-overlay-content {
  max-width: 80vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#upload-overlay-img {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

.upload-progress {
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: #8bb3ff;
  transition: width 0.2s ease;
}

.upload-overlay-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#upload-cancel-btn {
  background: transparent;
  color: #bbb;
  border: none;
  cursor: pointer;
}


.image-viewer-overlay { z-index: 600; }
.image-viewer-content {
  position: relative; width: 90%; max-width: 800px; max-height: 90vh;
  background: rgba(21,26,33,0.98); border-radius: 20px; padding: 40px 20px;
  display: flex; align-items: center; justify-content: center;
}
.viewer-image {
  max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 50px; height: 50px; background: rgba(139,179,255,0.3);
  border: none; border-radius: 50%; font-size: 24px; color: #e6e9ee;
  cursor: pointer; transition: all 0.2s;
}
.nav-btn:hover { background: rgba(139,179,255,0.5); }
#prev-img { left: 20px; }
#next-img { right: 20px; }
.viewer-counter {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.7); color: #e6e9ee; padding: 8px 16px;
  border-radius: 20px; font-size: 0.9em;
}

.image-viewer-content .close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  
  /* Rest übernimmt dein bestehendes .close-btn Styling */
}

.image-viewer-content .close-btn {
  position: absolute;
  top: 14px;
  right: 14px;

  width: 32px;
  height: 32px;

  background: rgba(255,255,255,0.06);
  color: #e6e9ee;

  border: none;
  border-radius: 50%;

  font-size: 16px;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: background 0.15s ease, transform 0.1s ease;
}

.image-viewer-content .close-btn:hover {
  background: rgba(255,255,255,0.12);
}

.image-viewer-content .close-btn:active {
  transform: scale(0.92);
}

/* BETRACHTER ÜBER ALLES! */
#image-viewer-overlay { z-index: 1000 !important; }
#profile-overlay { z-index: 500; }
#other-profile-overlay { z-index: 500; }

#other-profile-overlay .close-btn {
  position: absolute;
  top: 14px;
  right: 14px;

  width: 32px;
  height: 32px;

  background: rgba(255,255,255,0.06);
  color: #e6e9ee;

  border: none;
  border-radius: 50%;

  font-size: 16px;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: background 0.15s ease, transform 0.1s ease;
}

#other-profile-overlay .close-btn:hover {
  background: rgba(255,255,255,0.12);
}

#other-profile-overlay .close-btn:active {
  transform: scale(0.92);
}


/* ===== PROFIL OVERLAY ===== */
#profile-overlay .overlay-content {
  background: #151a21;
  border-radius: 16px;
  padding: 24px;
  max-width: 460px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

#profile-overlay h2 {
  font-size: 1.4em;
  font-weight: 600;
  color: #e6e9ee;
  margin: 0 0 20px;
  text-align: center;
}

/* Close Button */
#profile-overlay .close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.06);
  color: #e6e9ee;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}

#profile-overlay .close-btn:hover {
  background: rgba(255,255,255,0.12);
}

#profile-overlay .close-btn:active {
  transform: scale(0.92);
}

/* Avatar-Sektion */
.profile-avatar-section {
  text-align: center;
  margin: 0 0 24px;
}

#profile-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #0e1116;
  border: 3px solid #8bb3ff;
  margin: 0 auto 12px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 4px 12px rgba(139,179,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa4b2;
  font-size: 0.9em;
  font-weight: 500;
}

.profile-avatar-section button {
  background: #8bb3ff;
  color: #0e1116;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.profile-avatar-section button:hover {
  background: #a3c3ff;
}


.profile-gallery { margin-top: 20px; }
.avatars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.avatar-thumb {
  width: 80px; height: 80px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
}
.avatar-thumb.selected { border-color: #8bb3ff; }
.avatar-thumb:hover { transform: scale(1.05); }
.delete-avatar {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px;
  background: #ef4444; color: white;
  border: none; border-radius: 50%;
  font-size: 12px; cursor: pointer;
}


/* Form-Felder */
.profile-field {
  margin-bottom: 20px;
}

.profile-field label {
  display: block;
  font-size: 0.85em;
  color: #9aa4b2;
  margin-bottom: 6px;
  font-weight: 500;
}

.profile-field input,
.profile-field textarea {
  width: 100%;
  background: #0e1116;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px 14px;
  color: #e6e9ee;
  font-family: 'Inter', sans-serif;
  font-size: 0.95em;
  transition: border-color 0.15s;
}

.profile-field input:focus,
.profile-field textarea:focus {
  outline: none;
  border-color: #8bb3ff;
}

.profile-field textarea {
  min-height: 100px;
  resize: vertical;
}

/* Gaming-Links */
.profile-links {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.profile-links h3 {
  font-size: 1.1em;
  color: #e6e9ee;
  margin-bottom: 12px;
}

.profile-links input {
  margin-bottom: 12px;
}

/* Speichern-Button */
#save-profile-btn {
  background: #8bb3ff;
  color: #0e1116;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 16px;
  transition: background 0.15s;
}

#save-profile-btn:hover {
  background: #a3c3ff;
}

.other-profile-value {
  background: #0e1116;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 20px;
  color: #e6e9ee;
  white-space: pre-wrap;
  word-break: break-word;
}

.other-profile-header {
  text-align: center;
  margin-bottom: 20px;
}

.other-displayname {
  font-size: 1.4em;
  font-weight: 600;
  color: #e6e9ee;
  line-height: 1.2;
}

.other-username {
  font-size: 0.85em;
  color: #9aa4b2;
  margin-top: 2px;
}


#other-profile-overlay .profile-links h3 {
  margin-bottom: 8px;
}



/* Status-Message */
#profile-status-msg {
  text-align: center;
  margin-top: 12px;
  font-size: 0.9em;
}

#myUsername:hover {
  color: #a3c3ff !important;
  text-decoration: underline;
}

#private-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(21,26,33,0.6);
}

.msg-status {
  font-size: 0.7em;
  margin-left: 6px;
  user-select: none;
  opacity: 0.6;
}

.msg-status.read {
  color: #3b82f6;
  opacity: 1;
}


.msg-status.sent {
  color: #9aa4b2;
}

/* ===== REACTIONS ===== */
.reactions-container {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
    margin-left: 4px;          /* etwas Abstand links */
  flex-wrap: wrap;           /* falls viele Reaktionen */
  font-size: 0.8em;
  color: #9aa4b2;
}

.reaction-item {
  background: rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 2px 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.reaction-item:hover {
  background: rgba(255,255,255,0.12);
}

.reaction-count {
  font-size: 0.75em;
  font-weight: 500;
}

.add-reaction-btn {
  cursor: pointer;
  opacity: 0.6;
  font-size: 1.1em;
  margin-left: 8px;
}

.add-reaction-btn:hover {
  opacity: 1;
}

/* Emoji-Picker (einfach, erweiterbar) */
.emoji-picker {
  display: none;
  position: absolute;
  background: #151a21;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px;
  z-index: 10;
}

.emoji-picker span {
  cursor: pointer;
  font-size: 1.2em;
  margin: 4px;
}

.reaction-item.my-reaction {
  background: rgba(139,179,255,0.3);
  border: 1px solid #8bb3ff;
}

.pch-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #2a2a2a; /* Fallback */
  overflow: hidden;
  flex-shrink: 0;
}

#pch-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none; /* default: versteckt */
}





.pch-meta {
  display: flex;
  flex-direction: column;
}

.pch-name {
  font-size: 0.95em;
  font-weight: 500;
  color: #e6e9ee;
}

.pch-status {
  font-size: 0.75em;
  color: #9aa4b2;
}

.pch-status.online {
  color: #4ade80;
}

#pch-status.typing {
  color: #8bb3ff;
  font-style: italic;
  opacity: 0.9;
}
#pch-status.typing::after {
  content: ' …';
  animation: dots 1.2s infinite;
}

@keyframes dots {
  0% { content: ' .'; }
  33% { content: ' ..'; }
  66% { content: ' ...'; }
}


.sidebar-read {
  color: #4f8cff; /* WhatsApp-ähnliches Blau */
  font-weight: 500;
}


.sidebar-delivered {
  color: #9aa4b2;
  font-weight: 500;
}

#install-prompt {
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: rgba(14,17,22,0.85);
  z-index: 600;
}

#install-prompt .overlay-content {
  background: #151a21;
  border-radius: 14px;
  padding: 22px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  text-align: center;
}

.message.bugreport {
  border-left: 4px solid #f87171;
  background: linear-gradient(
    135deg,
    rgba(248,113,113,0.18),
    rgba(248,113,113,0.05)
  );
}

.message.bugreport .username::before {
  content: "🐞 BUG ";
  font-weight: 600;
  color: #f87171;
}

.user-status {
  display: block;
  font-size: 0.7em;
  margin-left: 22px;
  opacity: 0.8;
}

.user-status.online {
  color: #4ade80;
}

.user-status.offline {
  color: #9aa4b2;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 8px;
}




/* =========================================================
   🔐 FORGOT / RECOVERY OVERLAY
   ========================================================= */

#forgot-overlay {
  z-index: 500;
}

/* Container */
#forgot-content {
  position: relative;
  width: 92%;
  max-width: 420px;

  background: #151a21;
  border-radius: 18px;
  padding: 24px 20px 20px;

  display: flex;
  flex-direction: column;
  gap: 16px;

  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
}

/* Titel */
#forgot-content h2 {
  font-size: 1.1em;
  font-weight: 500;
  color: #e6e9ee;
  margin-bottom: 4px;
}

/* Close Button – IDENTISCH */
#forgot-overlay .close-btn {
  position: absolute;
  top: 14px;
  right: 14px;

  width: 32px;
  height: 32px;

  background: rgba(255,255,255,0.06);
  color: #e6e9ee;

  border: none;
  border-radius: 50%;

  font-size: 16px;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: background 0.15s ease, transform 0.1s ease;
}

#forgot-overlay .close-btn:hover {
  background: rgba(255,255,255,0.12);
}

#forgot-overlay .close-btn:active {
  transform: scale(0.92);
}
ul.messages,
#messages {
  list-style: none;
}

/* =========================================================
   🔑 FORM SECTIONS
   ========================================================= */

.forgot-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.forgot-section label {
  font-size: 0.7em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9aa4b2;
}

.forgot-section input {
  background: #0e1116;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px 12px;
  color: #e6e9ee;
}

.forgot-section input:focus {
  outline: none;
  border-color: #8bb3ff;
}

/* =========================================================
   🔘 BUTTON + STATUS
   ========================================================= */

.primary-btn {
  margin-top: 6px;
  align-self: flex-end;
}

.status-text {
  font-size: 0.8em;
  color: #9aa4b2;
  min-height: 16px;
}


/* ===== LOGIN ===== */
#login {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
}

#login input {
  background: #151a21;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 12px;
  color: #e6e9ee;
  width: 240px;
}

#login input:focus {
  outline: none;
  border-color: #8bb3ff;
}

/* ===== BUTTONS ===== */
button {
  background: #8bb3ff;
  color: #0e1116;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

button:hover {
  background: #a3c3ff;
}

button:active {
  transform: scale(0.97);
}

#logout-btn {
  background: #ff6b6b;
  color: #0e1116;
}

.user-item-clickable {
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.user-item-clickable:hover {
  background: rgba(139,179,255,0.08);
}


/* ===== CHAT LAYOUT ===== */
#chat {
  display: none;
  height: 100%;
  display: flex;
  flex-direction: column;
}

header {
  background: rgba(21, 26, 33, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9em;
  color: #9aa4b2;
}

#myUsername {
  color: #e6e9ee;
  font-weight: 500;
}

.main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
#sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding-bottom: var(--app-footer-height);
  color: #6b7280;
  padding-left: 16px;
  padding-right: 10px;
  width: 350px;
  min-width: 350px;
  max-width: 350px;
}


#sidebar h3 {
  margin-top: 18px;
  margin-bottom: 6px;
  font-size: 0.7em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* dezente Trennlinie + mehr Abstand vorm zweiten Block */
.sidebar h3:not(:first-child) {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 14px;
  margin-top: 20px;
}

/* Allgemeine Sidebar-Items */
.sidebar-item {
  padding: 10px 14px;
  margin: 6px 0;
  border-radius: 10px;
  color: #9aa4b2;
  cursor: pointer;
  position: relative;

  /* moderner Card-Look */
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);

  /* etwas mehr „Luft“ zwischen den Items */
  display: flex;
  flex-direction: column;
  gap: 2px;

  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    transform 0.08s ease;
}

.sidebar-item:hover {
  background: rgba(139, 179, 255, 0.12);
  border-color: rgba(139, 179, 255, 0.35);
  color: #e6e9ee;
  transform: translateY(-1px);
}

.sidebar-item.active {
  background: rgba(139, 179, 255, 0.20);
  border-color: #8bb3ff;
  color: #e6e9ee;
  box-shadow: 0 0 0 1px rgba(139, 179, 255, 0.4);
}


#private-chats-list {
  flex: 1;                 /* nimmt den restlichen Platz ein */
  overflow-y: auto;        /* wird zur Scrollbox wenn nötig */
  padding-right: 4px;      /* Platz für Scrollbar */
}
#private-chats-list::-webkit-scrollbar {
  width: 6px;
}

#private-chats-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 6px;
}


/* ===== UNREAD BADGE ===== */
.unread-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: #8bb3ff;
  color: #0e1116;
  border-radius: 10px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  font-size: 0.7em;
  text-align: center;
  padding: 0 4px;
  font-weight: 600;
}

/* ===== CHAT AREA ===== */
#chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

#messages-container {
  flex: 1;
  padding: 18px 22px;
  overflow-y: auto;
}

/* ===== MESSAGES ===== */
.message {
  padding: 10px 14px;
  margin: 6px 0;
  border-radius: 12px;
  line-height: 1.45;
  background: #151a21;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  animation: fadeIn 0.15s ease-out;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 60%;
  min-width: 48px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: fit-content;
}

.message.self {
  margin-left: auto;
  background: linear-gradient(
    135deg,
    rgba(139,179,255,0.25),
    rgba(139,179,255,0.1)
  );
  text-align: right;
  align-self: flex-end;
}



.message.other {
  margin-right: auto;
    align-self: flex-start;
}

/* ===== MESSAGE META ===== */
.message .username {
  display: block;
  font-size: 0.75em;
  color: #8bb3ff;
  margin-bottom: 2px;
}

.message.self .username {
  display: none;
}

.timestamp {
  font-size: 0.7em;
  color: #6b7280;
  margin-left: 6px;
  gap: 4px;
  align-items: center;
  align-self: flex-end;
}

/* Reihenfolge festlegen */
.message .username {
  order: 1;
}

.message .content {
  order: 2;
}

.message .timestamp {
  order: 3;
}

.message .msg-status {
  order: 3; /* gleich wie Timestamp → gleiche Zeile möglich */
}

.message .reactions-container {
  order: 4; /* IMMER ganz unten */
}





/* ===== INPUT ===== */
#input-area {
  background: #0e1116;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding: 12px 14px;
  display: flex;
  gap: 10px;
}

#input {
  flex: 1;
  background: #151a21;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: #e6e9ee;
  padding: 10px 12px;
}

#input:focus {
  outline: none;
  border-color: #8bb3ff;
}

/* ===== TYPING INDICATOR ===== */
#typing-indicator {
  height: 20px;
  position: absolute;
  bottom: 64px;
  left: 240px;
  right: 220px;
  padding: 4px 12px;
  font-size: 0.8em;
  color: #9aa4b2;      /* ← FOG-Grau */
  opacity: 0.85;
  pointer-events: none;
  display: none;
    animation: typingPulse 1.4s ease-in-out infinite;
}

@keyframes typingPulse {
  0%   { opacity: 0.4; }
  50%  { opacity: 0.85; }
  100% { opacity: 0.4; }
}


/* ===== ROOM USERS ===== */
#room-users {
  display: none;
  width: 220px;
  background: rgba(21, 26, 33, 0.85);
  border-left: 1px solid rgba(255,255,255,0.05);
  padding: 14px 10px;
  overflow-y: auto;
}

.chat-public #room-users {
  display: block;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85em;
  padding: 4px 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #555; /* default = offline */
}

.status-dot.online {
  background: #4ade80;
}

.status-dot.offline {
  background: #555;
}

.private-chat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.private-chat-last {
  font-size: 0.75em;
  color: #9aa4b2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  /* NEU: sinnvolle maximale Breite */
  max-width: 180px;
  display: block;
}

.private-chat-item > div:first-child {
  font-size: 0.9em;
  font-weight: 600;
  color: #e6e9ee;
}

.private-chat-last,
.private-chat-typing {
  font-size: 0.78em;
  color: #9aa4b2;
  opacity: 0.9;
}

/* Tipp: „schreibt gerade…“ leicht bläulich, damit man es schneller erkennt */
.private-chat-typing {
  color: #8bb3ff;
  font-style: italic;
}




#bugreport-overlay {
  z-index: 500;
}

/* =========================================================
   👥 BUGREPORT OVERLAY – MATCH SETTINGS STYLE
   ========================================================= */

/* Container */
#bugreport-content {
  position: relative;
  width: 92%;
  max-width: 420px;
  max-height: 85vh;

  background: #151a21;
  border-radius: 18px;
  padding: 24px 20px 20px;

  display: flex;
  flex-direction: column;
  gap: 16px;

  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
}

/* Close Button – identisch zu Settings */
#bugreport-overlay .close-btn {
  position: absolute;
  top: 14px;
  right: 14px;

  width: 32px;
  height: 32px;

  background: rgba(255,255,255,0.06);
  color: #e6e9ee;

  border: none;
  border-radius: 50%;

  font-size: 16px;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: background 0.15s ease, transform 0.1s ease;
}

#bugreport-overlay .close-btn:hover {
  background: rgba(255,255,255,0.12);
}

#bugreport-overlay .close-btn:active {
  transform: scale(0.92);
}


/* =========================================================
   👥 ALL USERS OVERLAY – MATCH SETTINGS STYLE
   ========================================================= */

#all-users-overlay {
  z-index: 500;
}

/* Container */
#all-users-content {
  position: relative;
  width: 92%;
  max-width: 420px;
  max-height: 85vh;

  background: #151a21;
  border-radius: 18px;
  padding: 24px 20px 20px;

  display: flex;
  flex-direction: column;
  gap: 16px;

  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
}

/* Titel */
#all-users-content h2 {
  font-size: 1.1em;
  font-weight: 500;
  color: #e6e9ee;
  margin: 0 0 6px;
}

/* Close Button – identisch zu Settings */
#all-users-overlay .close-btn {
  position: absolute;
  top: 14px;
  right: 14px;

  width: 32px;
  height: 32px;

  background: rgba(255,255,255,0.06);
  color: #e6e9ee;

  border: none;
  border-radius: 50%;

  font-size: 16px;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: background 0.15s ease, transform 0.1s ease;
}

#all-users-overlay .close-btn:hover {
  background: rgba(255,255,255,0.12);
}

#all-users-overlay .close-btn:active {
  transform: scale(0.92);
}

/* =========================================================
   👤 USER LIST
   ========================================================= */

#all-users-list {
  display: flex;
  flex-direction: column;
  gap: 6px;

  overflow-y: auto;
  padding-right: 4px;
}

/* Einzelner User */
#all-users-list .user-item-clickable {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 12px;
  border-radius: 10px;

  background: rgba(255,255,255,0.03);
  transition: background 0.15s ease;

  font-size: 0.9em;
  color: #e6e9ee;
}

#all-users-list .user-item-clickable:hover {
  background: rgba(139,179,255,0.12);
}

/* Status Dot */
#all-users-list .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

#all-users-list .status-dot.online {
  background: #4ade80;
}

#all-users-list .status-dot.offline {
  background: #555;
}


/* Glas / Hintergrund darf KEINE Klicks fressen */
#all-users-overlay::before {
  pointer-events: none;
}

/* ===== SETTINGS OVERLAY (NAMING CLEAN) ===== */

#settings-overlay #all-users-content {
  max-width: 480px;
  width: 100%;
  background: #151a21;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#settings-overlay h2 {
  font-size: 1.1em;
  font-weight: 600;
}

/* ===== SECTIONS ===== */

#settings-overlay .settings-section {
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#settings-overlay .settings-section h3 {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9aa4b2;
  margin-bottom: 4px;
}

#settings-overlay label {
  font-size: 0.75em;
  color: #9aa4b2;
}

#settings-overlay input {
  background: #0e1116;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 12px;
  color: #e6e9ee;
}

#settings-overlay input:focus {
  outline: none;
  border-color: #8bb3ff;
}

/* ===== CLOSE BUTTON (SETTINGS OVERLAY) ===== */

#settings-overlay .close-btn {
  width: 32px;
  height: 32px;

  background: rgba(255,255,255,0.06);
  color: #e6e9ee;

  border: none;
  border-radius: 50%;

  font-size: 14px;
  line-height: 1;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: background 0.15s ease, transform 0.1s ease;
}

#settings-overlay .close-btn:hover {
  background: rgba(255,255,255,0.12);
}

#settings-overlay .close-btn:active {
  transform: scale(0.92);
}


/* ===== ACTIONS ===== */

#settings-overlay .settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#settingsStatus {
  font-size: 0.75em;
  color: #9aa4b2;
}

/* ===== RECOVERY ===== */

#settings-overlay .recovery-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

#recovery-code-masked {
  flex: 1;
  background: #0e1116;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85em;
  letter-spacing: 0.12em;
}

#settings-overlay .hint {
  font-size: 0.75em;
  color: #9aa4b2;
  opacity: 0.8;
}


/* ===== USER LIST ===== */
.user-item,
.user-item-clickable {
  pointer-events: auto;
  cursor: pointer;
}

/* Optional: schönes Hover-Feedback */
.user-item-clickable:hover {
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
}


/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 6px;
}

/* ===== ANIMATION ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

#no-room-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#no-room-message.hidden {
  display: none !important;
  pointer-events: none !important;
}

.hidden {
  display: none !important;
}


#no-room-message h2 {
  font-size: 1.4em;
  font-weight: 500;
  color: #e6e9ee;
  margin-bottom: 6px;
}

#no-room-message p {
  font-size: 0.9em;
  opacity: 0.8;
}

#no-room-message::before {
  content: "💬";
  display: block;
  font-size: 2em;
  opacity: 0.15;
  margin-bottom: 10px;
}

/* ===== GENERIC OVERLAY ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(14,17,22,0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.release-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 25, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.release-box {
  background: #0f1625;
  color: #e6ebff;
  padding: 28px 32px;
  border-radius: 14px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.release-box h2 {
  margin-top: 0;
}

.release-intro {
  margin-bottom: 16px;
  opacity: 0.9;
}

.release-list {
  padding-left: 18px;
  margin-bottom: 16px;
}

.release-list li {
  margin-bottom: 6px;
}

.release-note {
  font-size: 0.9em;
  opacity: 0.75;
  margin-bottom: 16px;
}

.release-teaser {
  background: rgba(255,255,255,0.05);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
}

#release-close-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: #4c6fff;
  color: #fff;
  font-size: 1em;
  cursor: pointer;
}

/* ===== OVERLAY CONTENT ===== */
.overlay-content {
  background: #151a21;
  border-radius: 14px;
  padding: 22px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  position: relative;
  
  /* 🔑 WICHTIG */
  max-height: 85vh;
  overflow-y: auto;
}

.changelog-entry {
  margin-bottom: 16px;
}

.changelog-entry strong {
  color: #8bb3ff;
  font-size: 0.9em;
}

.changelog-entry ul {
  margin-top: 6px;
  padding-left: 18px;
  font-size: 0.85em;
  color: #c7ccd6;
}

#app-footer {
  position: fixed;
  left: 16px;
  bottom: 14px;
  display: flex;
  gap: 14px;
  font-size: 0.75em;
  color: #9aa4b2;
  opacity: 0.85;
  z-index: 100;
}

#connection-status.connected {
  color: #7dd3fc; /* blau */
}

#connection-status.disconnected {
  color: #f87171; /* rot */
}



/* =========================================================
   📱 MOBILE REWORK – CHAT FIRST
   ========================================================= */

@media (max-width: 900px) {

  body {
    font-size: 14px;
    height: 100svh; /* iOS safe viewport */
    overflow: hidden;
  }

  /* ===== HEADER ===== */
  header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }

  header > div:first-child {
    font-size: 0.8em;
    opacity: 0.8;
  }

  #header-right {
    display: flex;
    gap: 8px;
  }

  #header-right button {
    flex: 1;
    padding: 8px 0;
    font-size: 0.85em;
  }

  /* ===== LAYOUT ===== */
  .main-layout {
    flex-direction: column;
  }

  #toggle-sidebar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.9em;
  }

@media (max-width: 900px) {
  /* statt „Room-Bar“ im Row-Layout wieder Column-Layout */
  .sidebar {
    width: 100%;
    display: flex;
    flex-direction: column;   /* NEU: untereinander */
    gap: 4px;
    padding: 10px 14px;
    overflow-y: auto;         /* vertikal scrollen */
    overflow-x: hidden;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }

  /* Überschriften auf Mobile optional wieder sichtbar */
  .sidebar h3 {
    display: block;
    margin-top: 10px;
    margin-bottom: 4px;
  }

  .sidebar-item {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 0.9em;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
  }

  .sidebar-item.active {
    background: rgba(139,179,255,0.25);
    box-shadow: none;
  }
}


  /* ===== CHAT AREA ===== */
  #chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #messages-container {
    padding: 12px 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    overscroll-behavior: contain;
    padding-bottom: 12px;
  }

  /* ===== MESSAGES ===== */
  .message {
    max-width: 92%;
    padding: 10px 12px;
    border-radius: 14px;
  }

  .message.self {
    background: linear-gradient(
      135deg,
      rgba(139,179,255,0.35),
      rgba(139,179,255,0.15)
    );
  }

  .message .username {
    font-size: 0.7em;
  }

  

  /* ===== INPUT ===== */
  #input-area {
    padding: 10px;
    gap: 8px;
    position: sticky;
    bottom: 0;
    z-index: 20;
    flex-shrink: 0;
    background: #0e1116;
  }

  #input {
    font-size: 16px; /* iOS Zoom Kill */
  }

  /* ===== TYPING INDICATOR ===== */
  #typing-indicator {
    left: 0;
    right: 0;
    bottom: 58px;
    text-align: center;
    font-size: 0.75em;
    z-index: 10;
  pointer-events: none;
  }

  /* ===== ROOM USERS ===== */
  #room-users {
    display: none !important;
  }

  /* ===== OVERLAYS ===== */
  #all-users-content,
  #settings-content {
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
  }

  /* ===== NO ROOM MESSAGE ===== */
  #no-room-message h2 {
    font-size: 1.1em;
  }

  #no-room-message p {
    font-size: 0.85em;
  }
}


/* =========================================================
   📱 MOBILE SIDEBAR SLIDE-IN
   ========================================================= */
@media (max-width: 900px) {

  #toggle-sidebar-btn {
    background: rgba(255,255,255,0.12);
    color: #e6e9ee;
  }

  /* Sidebar wird Overlay */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    background: #14191F;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    padding-top: 70px; /* Platz für Header */
    overflow-y: auto;
  }

  /* Sidebar sichtbar */
  body.sidebar-open #sidebar {
    transform: translateX(0);
  }

  /* Backdrop */
  #sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 250;
    display: none;
  }

  body.sidebar-open #sidebar-backdrop {
    display: block;
  }

  /* Chat nimmt vollen Platz */
  .main-layout {
    flex-direction: column;
  }

    #messages-container {
    padding-bottom: 12px;
  }

  
  #app-footer {
    position: static;
    margin: 6px 12px;
    text-align: center;
    opacity: 0.6;
    padding-left: 25px;
  }
}





