/* Aplica la tipografía Poppins */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f4f4f4;
}

/* Contenedor principal */
.chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 100%;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Área de mensajes */
.chat-box {
    flex-grow: 1;
    padding: 20px;
    background-color: #f9f9f9;
    overflow-y: auto;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Alinea los mensajes a la izquierda */
}

/* Estilo de los mensajes en forma de burbuja con un rabito más visible */
.chat-box div {
    margin-bottom: 14px;
    padding: 10px 16px;
    border-radius: 18px; 
    border-bottom-left-radius: 4px; 
    background-color: #e4e4e6; 
    display: flex;
    flex-direction: column;
    position: relative;
    max-width: 80%;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    margin-left: 6px; /* Deja espacio para que el rabito no se pegue al borde de la pantalla */
}

/* Rabito / pico rediseñado para que sea visible y estético */
.chat-box div::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    /* Creamos un triángulo perfecto usando bordes */
    border: 8px solid transparent;
    border-top-color: #e4e4e6; /* Simula la esquina inferior izquierda */
    border-bottom: 0;
    border-left: 0;
    transform: rotate(90deg);
}

.chat-box div strong {
    font-weight: 600;
    color: #007bff;
    margin-right: 10px;
    margin-bottom: 2px;
}

.chat-box div .message-text {
    font-size: 14px;
    color: #333;
    word-wrap: break-word;
    line-height: 1.4;
}

.chat-box div .time-ago {
    font-size: 11px;
    color: #777;
    margin-top: 4px;
    align-self: flex-end;
}

/* Estilo del contenedor de los inputs y botones */
.input-container {
    display: flex;
    flex-wrap: wrap;
    padding: 8px;
    background-color: #fff;
    border-top: 1px solid #ddd;
    align-items: center;
    gap: 6px;
    position: relative;
}

.input-container input {
    flex: 1 1 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
    box-sizing: border-box;
}

@media screen and (min-width: 400px) {
    #username {
        flex: 1 1 30%;
    }
    #messageInput {
        flex: 1 1 40%;
    }
}

/* Estilo para el botón de enviar mensaje */
.input-container button {
    padding: 8px 14px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s ease;
    margin-left: 0;
}

.input-container button:hover {
    background-color: #0056b3;
}

/* Estilo para el botón de emojis */
#emojiButton {
    background-color: #1257cd;
    border: none;
    margin-left: 0;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    flex-shrink: 0;
}

#emojiButton .emoji {
    font-size: 18px;
    line-height: 1;
}

#emojiButton:hover {
    background-color: #0a45a0;
}

/* Adaptación a pantallas pequeñas */
@media screen and (max-width: 600px) {
    .chat-box div {
        max-width: 90%;
    }
}

/* Estilo para el contenedor desplegable de emojis */
.emoji-container {
    display: none;
    position: absolute;
    bottom: 55px;
    right: 10px;
    background-color: white;
    border: 1px solid #ccc;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.emoji-container .emoji {
    font-size: 20px;
    margin: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 4px;
}

.emoji-container .emoji:hover {
    background-color: #f0f0f0;
}