* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: #0b141a; /* Fondo ultra oscuro estilo WhatsApp */
  color: #e9edef;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
}

/* Tapa o botón de activación inicial en el móvil */
.chat-toggler {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #00a884; /* Verde chat */
  color: #fff;
  padding: 16px 32px;
  border-radius: 24px;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 168, 132, 0.3);
  z-index: 10;
  transition: transform 0.2s;
  text-align: center;
}

.chat-toggler:active {
  transform: translate(-50%, -50%) scale(0.95);
}

/* Contenedor principal de la app */
.chat-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: #0b141a;
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: transform 0.3s ease-out;
}

/* Escondido por defecto abajo si está minimizado */
.chat-container.minimized {
  transform: translateY(100%);
}

/* Encabezado superior plano */
.chat-header {
  background: #202c33;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #2a3942;
  cursor: pointer;
}

.chat-header h2 {
  font-size: 1.1rem;
  font-weight: 500;
  color: #e9edef;
}

.close-icon {
  font-size: 1.1rem;
  color: #8696a0;
  padding: 4px 8px;
}

/* Área de mensajes con fondo de chat fluido */
.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #0b141a;
}

/* Burbuja de chat moderna que no se deforma en móviles */
.msg-block {
  background: #202c33;
  padding: 8px 12px;
  border-radius: 8px;
  max-width: 85%;
  align-self: flex-start; /* Alineados a la izquierda de forma natural */
  position: relative;
  word-wrap: break-word;
  display: inline-block;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Cabecera interna: Nombre del usuario */
.msg-meta {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #53bdeb; /* Color azul vivo para resaltar el usuario */
  margin-bottom: 3px;
}

/* Contenido del texto del mensaje */
.msg-text {
  font-size: 0.95rem;
  line-height: 1.4;
  color: #e9edef;
  padding-right: 50px; /* Espacio de seguridad para que la hora no pise el texto */
  display: inline;
}

/* Hora incrustada de forma fija abajo a la derecha de la burbuja */
.msg-time {
  font-size: 0.68rem;
  color: #8696a0;
  position: absolute;
  bottom: 4px;
  right: 8px;
  white-space: nowrap;
}

/* Formulario e inputs inferiores */
.chat-form {
  padding: 10px;
  background: #202c33;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #2a3942;
}

#userInput {
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: #2a3942;
  color: #e9edef;
  font-size: 0.9rem;
}

.input-group {
  display: flex;
  gap: 8px;
}

#messageInput {
  flex: 1;
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  background: #2a3942;
  color: #e9edef;
  font-size: 0.95rem;
}

#messageInput:focus, #userInput:focus {
  outline: none;
}

button {
  background: #00a884;
  color: #fff;
  border: none;
  padding: 0 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

button:active {
  background: #008f72;
}