/* Reset básico */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* =====================
   ESTRUCTURA GENERAL
===================== */
body {
  font-family: 'Segoe UI', sans-serif;
  background-color: #18191c;
  color: #ffffff;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* =====================
   LOGIN
===================== */
#login {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: #18191c;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  flex-direction: column;
  padding: 40px 20px;
  text-align: center;
}

#login .logo {
  font-size: 40px;
  font-weight: bold;
  color: #ff7675;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  animation: glow 1.8s ease-in-out infinite alternate;
}

#login h1 {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 20px;
}

#login p {
  font-size: 16px;
  color: #dfe6e9;
  max-width: 500px;
  margin: 0 auto 30px;
}

#login-btn {
  padding: 14px 28px;
  background: linear-gradient(135deg, #6c5ce7, #00cec9);
  color: white;
  border: none;
  border-radius: 999px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#login-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* =====================
   CONTENEDOR PRINCIPAL
===================== */
#chat-container {
  display: flex;
  flex-grow: 1;
  height: 100%;
}

#chat-section {
  flex: 3;
  display: flex;
  flex-direction: column;
  padding: 12px;
  background-color: #1e1f23;
  position: relative;
}

/* =====================
   PESTAÑAS
===================== */
#tabBar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background-color: #1e1e1e;
  border-bottom: 2px solid #444;
  overflow-x: auto;   /* ✅ permite scroll horizontal si hay muchas pestañas */
  overflow-y: hidden; /* ✅ evita scroll vertical innecesario */
  max-height: 150px;  /* ✅ asegura que no se expanda verticalmente */
	height: 100px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background-color: #2b2b2b;
  color: #ccc;
  border-radius: 999px;
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
  height: 30px;
}

.tab:hover {
  background-color: #3d3d3d;
  color: #fff;
}

.tab.active {
  background-color: #6c5ce7;
  color: #fff;
}

.tab .close-tab {
  background-color: #ff7675;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s;
}

.tab .close-tab:hover {
  background-color: #d63031;
}

/* =====================
   ÁREA DE MENSAJES
===================== */
.messages-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 12px;
  background-color: #2a2b2f;
  border-radius: 8px;
}

.tab-content {
  display: none;
}

.tab-content.active,
.messages-area.active {
  display: block;
}

.message {
  margin-bottom: 12px;
  padding: 8px 12px;
  background-color: #37383e;
  border-radius: 6px;
  word-wrap: break-word;
}

.message button {
  background: #444;
  color: #ccc;
  border: none;
  padding: 4px 6px;
  border-radius: 4px;
  margin-left: 6px;
  cursor: pointer;
  font-size: 14px;
}

.message button:hover {
  background-color: #6200ea;
  color: #fff;
}

.sistema {
  background-color: #333;
  color: #f1c40f;
  font-style: italic;
  padding: 10px 14px;
  margin: 16px 0;
  border-left: 4px solid #f1c40f;
  border-radius: 4px;
}
.unread-count {
  font-size: 12px;
  background-color: #03dac6;
  color: #000;
  padding: 2px 6px;
  border-radius: 9px;
  margin-left: 8px;
  display: none;
}

/* =====================
   EMOJIS
===================== */
#emoji-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background-color: #24252b;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}

#emoji-bar button {
  font-size: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: transform 0.2s;
}

#emoji-bar button:hover {
  transform: scale(1.3);
}

/* =====================
   INPUT Y ENVÍO
===================== */
.input-area {
  margin-top: 8px;
}

#mensaje {
  padding: 10px 14px;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  background-color: #3a3b41;
  color: white;
  width: 100%;
  height: 48px;
}

#mensaje:focus {
  outline: 2px solid #6200ea;
}

#enviar {
  margin-top: 10px;
  padding: 14px 22px;
  background-color: #03dac6;
  color: #000;
  border: none;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background-color 0.3s, transform 0.2s;
}

#enviar:hover {
  background-color: #00bfa5;
  transform: translateY(-1px);
}

/* =====================
   PANEL DE USUARIOS
===================== */
#user-panel {
  flex: 1;
  background-color: #202124;
  padding: 12px;
  min-width: 180px;
  border-left: 1px solid #333;
}

#user-panel h4 {
  margin-bottom: 8px;
  font-size: 16px;
  color: #fff;
}

#userList {
  list-style: none;
}

#userList li {
  padding: 6px 0;
  color: #bbb;
  cursor: pointer;
}

#userList li:hover {
  background-color: #333;
  border-radius: 4px;
  padding-left: 6px;
}

/* =====================
   BOTÓN LOGOUT
===================== */
#logout {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #444;
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

#logout:hover {
  background-color: #e53935;
}

/* =====================
   MENÚ CONTEXTUAL
===================== */
#context-menu {
  background-color: #2c2c2c;
  color: white;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#context-menu div {
  padding: 6px 12px;
  cursor: pointer;
}

#context-menu div:hover {
  background-color: #444;
}

/* =====================
   TOAST
===================== */
#toast {
  visibility: hidden;
  min-width: 200px;
  max-width: 80%;
  background-color: #323232;
  color: #fff;
  text-align: center;
  border-radius: 8px;
  padding: 12px 18px;
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  font-size: 16px;
  opacity: 0;
  transition: visibility 0s, opacity 0.5s ease;
}

#toast.show {
  visibility: visible;
  opacity: 1;
}

#toast.info    { background-color: #323232; }
#toast.success { background-color: #4caf50; }
#toast.error   { background-color: #e53935; }

/* =====================
   FONDO DE PARTÍCULAS MODERNO
===================== */
#particles-bg {
  position: fixed;
  width: 100%;
  height: 100%;
  background: #0f0f0f;
  overflow: hidden;
  z-index: -1;
}

#particles-bg::before,
#particles-bg::after {
  content: '';
  position: absolute;
  width: 200%;
  height: 200%;
  top: -50%;
  left: -50%;
  background-image: radial-gradient(circle, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: moveParticles 60s linear infinite;
  opacity: 0.2;
}

#particles-bg::after {
  background-size: 60px 60px;
  animation-duration: 120s;
  opacity: 0.1;
}

@keyframes moveParticles {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

/* =====================
   RESPONSIVE
===================== */
@media (max-width: 768px) {
  #login {
    padding: 20px;
  }
  #chat-container {
    flex-direction: column;
  }

  #chat-container {
    flex-direction: column;
  }

  #user-panel {
    border-left: none;
    border-top: 1px solid #333;
    min-width: 100%;
  }

  #logout {
    bottom: 10px;
    top: auto;
  }

  #login-btn {
    margin-top: 20px;
  }
}