/* === chat.css - Tema WhatsApp === */

/* CONTENEDOR DE MENSAJES */
.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
  font-size: 14px;
  line-height: 1.4;
}

/* Mensajes de otros usuarios */
.message.incoming {
  align-self: flex-start;
  flex-direction: row;
}

/* Mensajes del dueño del chat */
.message.outgoing {
  align-self: flex-end;
  flex-direction: row;
}

/* CÍRCULO IZQUIERDO */
.initial-circle-left {
  width: 50px;
  height: 50px;
  background-color: #DFE5E7; /* Gris WhatsApp */
  color: #3B4A54; /* Texto oscuro WhatsApp */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  flex-shrink: 0;
  border: 2px solid #FFFFFF; /* Borde blanco */
}

/* CÍRCULO DERECHO */
.initial-circle-right {
  width: 50px;
  height: 50px;
  background-color: #25D366; /* Verde WhatsApp */
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  flex-shrink: 0;
  margin-left: auto;
  border: 2px solid #FFFFFF; /* Borde blanco */
}

/* BURBUJA DE MENSAJE (otros usuarios) */
.bubble {
  background-color: #FFFFFF; /* Blanco */
  padding: 2px 10px 0px 10px; /* ← TUS PADDINGS ORIGINALES */  
  margin: 2px 0px 2px 0px; /* ← TUS MÁRGENES ORIGINALES */  
  border-radius: 0px 10px 10px 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 1px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Mensaje del dueño del chat */
.message.outgoing .bubble {
  background-color: #D9FDD3; /* Verde claro WhatsApp */
  color: white;
  border-radius: 10px 0px 0 10px;
}

.message.outgoing .message-text,
.message.outgoing .sender-name,
.message.outgoing .message-time {
  color: #000000; /* Negro */
}

/* NOMBRE DEL REMITENTE */
.sender-name {
  font-weight: bold;
  background-color: transparent;
  margin-bottom: 2px;
  font-size: 14px;
  color: #1A1A1A; /* Negro suave WhatsApp */
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Texto momentáneo */
.sender-name span {
  font-weight: normal;
  font-size: 12px;
  color: #667781; /* Gris WhatsApp */
}

/* Nombre alineado a la izquierda (mensajes entrantes) */
.message.incoming .sender-name {
  align-self: flex-start;
  text-align: left;
}

/* Nombre alineado a la derecha (mensajes salientes) */
.message.outgoing .sender-name {
  align-self: flex-end;
  text-align: right;
}

/* IMÁGENES EN MENSAJES - Solo imágenes dentro de burbujas */
.bubble img {
  width: 180px;
  height: 60px;
  border-radius: 5px;
  border: 1px solid #E0E0E0; /* Gris claro */
  object-fit: cover;
  object-position: center center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}

/* IMÁGENES DE AVATARES - Estilos específicos */
.initial-circle-left img,
.initial-circle-right img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: none;
}

/* HORA DEL MENSAJE - IZQUIERDA (hora a la DERECHA) */
.message-time-izquierdo {
  font-size: 10px;
  color: #8696A0; /* Gris WhatsApp */
  margin-top: 2px;
  margin-left: auto;
  text-align: right;
}

/* HORA DEL MENSAJE - DERECHA (hora a la IZQUIERDA) */
.message-time-derecho {
  font-size: 10px;
  color: #8696A0; /* Gris WhatsApp */
  margin-top: 2px;
  margin-right: auto;
  text-align: left;
}

/* FLECHA IZQUIERDA - CRECE HACIA LA IZQUIERDA (hacia el círculo) */
.message.incoming .bubble::before {
  content: "";
  position: absolute;
  top: 0;
  left: -13px; /* ← Se mueve más a la izquierda para compensar el crecimiento */
  width: 0;
  height: 0;
  border-top: 6px solid #FFFFFF;
  border-bottom: 4px solid transparent;
  border-right: 14px solid transparent; /* ← Más ancho hacia la izquierda */
transform: rotate(-360deg) scaleX(-1); /* ← Agrega scaleX(-1) */
}

/* FLECHA DERECHA - CRECE HACIA LA DERECHA (hacia el círculo) */
.message.outgoing .bubble::before {
  content: "";
  position: absolute;
  top: 0;
  right: -13px; /* ← Se mueve más a la derecha para compensar el crecimiento */
  width: 0;
  height: 0;
  border-top: 6px solid #D9FDD3;
  border-bottom: 4px solid transparent;
  border-left: 14px solid transparent; /* ← Más ancho hacia la derecha */
transform: rotate(360deg) scaleX(-1); /* ← Agrega scaleX(-1) */
}

/* Asegurar que las burbujas tengan posición relativa */
.bubble {
  position: relative;
}

/* BOTON MODERACION */
.moderation-buttons {
    font-size: 10px;
    text-align: right;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #888888; /* Un color gris plomo */
}
.debug {
    background-color: rgba(255, 0, 0, 0.2); /* Rojo semitransparente */
}