* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  background-color: #2c2f33;
  color: #fff;
  height: 100%;
  width: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
}

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
 height: calc(100vh - 50px);
  width: 100vw;
  background-color: #36393f;
  padding: 10px;
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;   /* ✅ Забранява хоризонтален скрол */
  background-color: #2f3136;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  scroll-behavior: auto;
}

/* Формата за писане */
.chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-form textarea {
  flex: 1;
  resize: none;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  background: #40444b;
  color: #fff;
  line-height: 1.4;
  min-height: 48px;
  max-height: 150px;
  overflow-y: auto;
  font-family: inherit;
}

.chat-form button {
  background-color: #7289da;
  color: white;
  border: none;
  padding: 10px 14px;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  height: 48px;
}

.chat-form button:hover {
  background-color: #5b6eae;
}

/* Съобщения и визуално оформление */
.message-wrapper {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
  position: relative;
  animation: fadeIn 0.3s ease;
}

.align-left {
  align-items: flex-start;
}

.align-right {
  align-items: flex-end;
}

.name {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 4px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #7289da;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 4px;
  user-select: none;
}

.align-right .avatar {
  background-color: #2ea86f;
}

.message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 10px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.4;
  font-size: 1rem;
}

.from-chat {
  background-color: #5865f2;
  align-self: flex-start;
  margin-right: auto;
}

.from-site {
  background-color: #2ea86f;
  align-self: flex-end;
  margin-left: auto;
  text-align: right;
}

/* Анимация при появяване */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Скриване на скрол лентата на мобилно */
.chat-box::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

/* ----------------- Минимални допълнения за top bar и + меню ----------------- */

.top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 10px 20px;
  background-color: #2f3136;
  color: white;
  gap: 12px;
}

.username-display {
  margin-right: 0;
  font-weight: 600;
  color: #ddd;
}

.logout-btn {
  background-color: #d9534f;
  color: white;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background-color 0.2s;
}

.logout-btn:hover {
  background-color: #c94b43;
}

.extra-menu-container {
  position: relative;
  margin-right: 6px;
}

.extra-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background-color: #00b894;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

.extra-menu {
  position: absolute;
  bottom: 45px;
  left: 0;
  background: #2f3136;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  z-index: 100;
  min-width: 140px;
}

.extra-item {
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  padding: 8px;
  font-size: 14px;
  color: #ddd;
  border-radius: 6px;
}

.extra-item:hover {
  background: rgba(255,255,255,0.03);
}

.hidden {
  display: none !important;
}

/* стили за вложените <img>, <video>, <audio> в съобщенията */
.message img,
.message video,
.message audio {
  max-width: 320px;
  border-radius: 8px;
  display: block;
}

/* Прогрес бар за качване */
.upload-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 20px;
  width: 200px;
}

.upload-progress.hidden {
  display: none;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #444;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  transition: width 0.2s linear;
}

.progress-bar {
  background: #00b894;
  width: 0%;
}

.progress-text {
  font-size: 0.8rem;
  color: #fff;
  min-width: 35px;
  text-align: right;
}

/* Прогрес бар за качване */
.upload-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 20px;
  width: 200px;
}

.upload-progress.hidden {
  display: none;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: #2ea86f; /* зелено */
  border-radius: 4px;
  overflow: hidden;
  width: 0%;
  transition: width 0.2s linear;
}


.progress-text {
  font-size: 0.8rem;
  color: #fff;
  min-width: 35px;
  text-align: right;
}

/* Индикатор "пише някой" */
.typing-indicator {
  font-size: 0.85rem;
  color: #ccc;
  margin-bottom: 5px;
  height: 20px;
  transition: opacity 0.3s ease;
  opacity: 1;
}

.typing-indicator.hidden {
  opacity: 0;
  height: 0;
  overflow: hidden;
}
