#chat-toggle {
  position: fixed;
  bottom: 70px;
  left: 20px;
  background: linear-gradient(90deg,var(--red),var(--red-2));
  color: #fff;
  padding: 10px 18px;
  border: none;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: var(--glow);
  cursor: pointer;
  z-index: 1001;
  transition: all .3s;
}
#chat-toggle.hidden { opacity: 0; transform: scale(0.9); pointer-events: none; }

#chat-popup {
  position: fixed;
  bottom: 80px;
  left: 20px;
  width: 340px;
  height: 460px;
  background: #0f0f12;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  transform: translateY(100%);
  opacity: 0;
  transition: all .35s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
}
#chat-popup.open { transform: translateY(0); opacity: 1; }

.popup-header {
  background: linear-gradient(90deg,var(--red),var(--red-2));
  color: #fff;
  text-align: center;
  padding: 10px;
  font-weight: 700;
  position: relative;
}
.popup-header button.minimize {
  position: absolute;
  top: 6px; right: 8px;
  border: none; background: none; color: #fff;
  font-size: 18px; cursor: pointer;
}

.popup-messages {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  background: #141414;
}
.message {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.message img {
  width: 36px; height: 36px;
  border-radius: 50%;
}
.message .content {
  flex: 1;
  background: #1d1d1d;
  color: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 14px;
}
.message .meta {
  font-size: 12px;
  color: #bbb;
  margin-bottom: 3px;
}
.message .meta .username-admin { color: var(--red-2); }

.popup-input {
  display: flex;
  border-top: 1px solid #222;
  background: #0d0d0f;
}
.popup-input input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  padding: 10px;
  outline: none;
}
.popup-input button, #emoji-btn {
  background: none;
  border: none;
  color: var(--red-2);
  font-size: 18px;
  padding: 0 12px;
  cursor: pointer;
}

.emoji-picker, .emoji-picker__wrapper {
  z-index: 2000 !important;
}

/* ✅ ปรับตำแหน่งปุ่มลบข้อความให้อยู่มุมขวาบน */
.message {
  position: relative;
}

.message .delete-btn {
  position: absolute;
  top: 4px;
  right: 6px;
  background: none;
  border: none;
  color: #999;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, color 0.2s;
}

.message .delete-btn:hover {
  opacity: 1;
  color: #ff4b4b;
}
