/* chat.css */

/* Aplicar box-sizing global para evitar problemas de ancho */
* {
    box-sizing: border-box;
}

/* Contenedor principal del chat */
.chat-container {
    max-width: 400px;
    width: 100%; /* Asegura que la caja no exceda su contenedor padre */
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 400px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background-color: #ffffff;
}

/* Encabezado del chat */
.chat-container .card-header {
    background-color: #007bff; /* Color primario de Bootstrap */
    padding: 15px;
    text-align: center;
}

/* Cuerpo del chat */
.chat-container .card-body {
    flex: 1;
    padding: 15px;
    background-color: #f8f9fa; /* Fondo claro */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Previene desbordamiento horizontal */
	scroll-behavior: smooth;
}

/* Área de mensajes */
#chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Mensajes individuales */
.message {
    max-width: 80%;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 20px;
    word-wrap: break-word; /* Fuerza la ruptura de palabras largas */
    overflow-wrap: break-word; /* Compatibilidad adicional */
    word-break: break-word; /* Más compatibilidad y control */
    white-space: pre-wrap; /* Mantiene los saltos de línea */
    font-size: 14px;
    line-height: 1.4;
}

/* Mensajes del bot */
.message.bot {
    align-self: flex-start;
    background-color: #e1f5fe; /* Azul claro */
    color: #333333;
    position: relative;
}

/* Mensajes del usuario */
.message.user {
    align-self: flex-end;
    background-color: #007bff; /* Color primario de Bootstrap */
    color: #ffffff;
    position: relative;
}

/* Icono de burbuja (opcional) */
.message.bot::before {
    content: "";
    position: absolute;
    top: 10px;
    left: -10px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-right: 10px solid #e1f5fe;
    border-bottom: 10px solid transparent;
}

.message.user::before {
    content: "";
    position: absolute;
    top: 10px;
    right: -10px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-left: 10px solid #007bff;
    border-bottom: 10px solid transparent;
}

/* Área de entrada y botón */
.chat-container .card-footer {
    padding: 10px 15px;
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
}

.input-group {
    display: flex;
    width: 100%;
}

#chat-input {
    border-radius: 20px;
    padding: 10px 15px;
    border: 1px solid #ced4da;
    transition: border-color 0.3s;
    flex: 1;
}

#chat-input:focus {
    border-color: #007bff;
    box-shadow: none;
}

#chat-send {
    border-radius: 20px;
    padding: 10px 20px;
    margin-left: 10px;
}

/* Scroll personalizado para el chat */
.chat-container .card-body::-webkit-scrollbar {
    width: 6px;
}

.chat-container .card-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-container .card-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.chat-container .card-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsividad */
@media (max-width: 576px) {
    .chat-container {
        height: 100vh;
        border-radius: 0;
    }
}