/* Botón flotante */
.chat-toggle {
    position: fixed;
    bottom: 2.5rem;
    right: 20px;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 50%;
    width: 4rem;
    height: 4rem;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Contenedor del chat (oculto por defecto) */
.chat-container {
    position: fixed;
    bottom: 4rem;
    right: 20px;
    width: 350px;
    height: 500px;
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    background-color: white;
    /* Mejoras de transición */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-origin: bottom right;
    z-index: 1000;
}

/* Cuando el chat está visible */
.chat-container.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(-3rem) scale(1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}


/* Encabezado del chat */
.chat-header {
    background-color: #2c3e50;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    padding-inline: 15px;
    padding-block: 10px;
    align-content: center;
    justify-content: space-between;
}

/* Botón para cerrar el chat */
.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

/* Área de mensajes */
.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

/* Estilos de mensajes */
.message {
    white-space: pre-wrap;
    /* Preserva saltos de línea */
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    max-width: 80%;
    word-wrap: break-word;
}

.bot-message {
    background-color: #e6e6e6;
    align-self: flex-start;
    border-radius: 18px 18px 18px 4px;
}

.user-message {
    background-color: #2c3e50;
    color: white;
    margin-left: auto;
    border-radius: 18px 18px 4px 18px;
}

/* Área de entrada */
.chat-input {
    display: flex;
    align-items: center;
    padding: 10px;
    border-top: 1px solid #ddd;
    background-color: white;
}

.chat-input textarea {
    font-size: 16px !important;
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    outline: none;
}

.send-button {
    max-height: 3rem !important;
}

.chat-input button {
    margin-left: 10px;
    padding: 10px 15px;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* indicador de escribiendo */
.typing-indicator {
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    max-width: 20%;
    word-wrap: break-word;
    background-color: #e6e6e6;
}

.typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #666;
    margin: 0 2px;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

.chat-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 10px;
}

.chat-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: bold;
}

.chat-logo {
    height: 30px;
    width: auto;
    max-width: 100%;
    border-radius: 100vmax
}

@media (max-width: 768px) {
    .chat-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 96%;
        border-radius: 0;
        transform: translateY(104%);
        z-index: 1002;
    }

    .chat-container.visible {
        transform: translateY(0);
    }

}

.img-toggle {
    display: inline-block;
    width: 100%;
    height: auto;
    background-size: contain;
    background-repeat: no-repeat;
    border-radius: 100vmax;
}


.chat-toggle {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    transform-origin: center !important;
}

.message img {
    max-width: 100%;
    max-height: 300px;
    height: auto;
    width: auto;
    display: block;
    object-fit: contain;
    border-radius: 6px;
}


