/* --- Estilos para el Chatbot Personalizado --- */

/* Botón para abrir el chat */
.chatbot-toggler {
    position: fixed;
    bottom: 220px; /* Subimos el botón un poco más */
    right: 35px; /* Nueva posición derecha */
    width: 70px; /* Aumentamos el tamaño para que el logo se vea mejor */
    height: 70px;
    background-color: #fff; /* Fondo blanco para que el logo se integre */
    background-image: url('../imagenes/logo.png'); /* Usamos el logo como fondo */
    background-size: 50%; /* Ajustamos el tamaño del logo dentro del botón */
    background-position: center;
    background-repeat: no-repeat;
    color: #fff;
    border-radius: 50%;
    border: 3px solid var(--aisa-red); /* Borde rojo para mayor contraste */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 999;
}

.chatbot-toggler:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Ocultar el icono de cerrar por defecto */
.chatbot-toggler::before {
    content: '\f00d'; /* Código del icono de cerrar (X) de Font Awesome */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.8rem;
    color: var(--aisa-red);
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Cuando el chat está abierto, mostramos el icono de cerrar */
.show-chatbot .chatbot-toggler {
    background-image: none; /* Ocultamos el logo */
    background-color: #fff; /* Mantenemos el fondo */
}

.show-chatbot .chatbot-toggler::before {
    opacity: 1; /* Mostramos el icono de cerrar */
}

/* Contenedor principal del chat */
.chatbot-container {
    position: fixed;
    bottom: 300px; /* Ajustamos la ventana: 220px (bottom) + 70px (alto) + 10px (margen) */
    right: 40px; 
    width: 350px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 0 128px 0 rgba(0,0,0,0.1), 0 32px 64px -48px rgba(0,0,0,0.5);
    transform: scale(0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    transform-origin: bottom right; /* Cambiado para que la animación salga de la derecha */
    z-index: 998;
}

.show-chatbot .chatbot-container {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Cabecera del chat */
.chatbot-container .chat-header {
    background: var(--aisa-red); /* Cambiado a rojo para coherencia */
    color: #fff;
    padding: 16px 0;
    text-align: center;
    border-radius: 15px 15px 0 0;
}

.chatbot-container .chat-header h4 {
    font-size: 1.4rem;
    margin: 0;
}

/* Caja de mensajes */
.chatbot-container .chatbox {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
}

.chatbox .chat-message {
    display: flex;
    margin-bottom: 15px;
}

.chatbox .incoming p, .chatbox .outgoing p {
    padding: 12px 16px;
    border-radius: 10px;
    max-width: 90%;
    font-size: 0.95rem;
    word-wrap: break-word;
}

.chatbox .incoming p {
    background: #f2f2f2;
    color: #000;
    border-radius: 10px 10px 10px 0;
}

.chatbox .outgoing {
    justify-content: flex-end;
}

.chatbox .outgoing p {
    background: var(--aisa-orange);
    color: #fff;
    border-radius: 10px 10px 0 10px;
}

/* Área de entrada de texto */
.chatbot-container .chat-input {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 10px 20px;
    border-top: 1px solid #ddd;
}

.chat-input input {
    height: 45px;
    width: 100%;
    border: 1px solid #ccc;
    outline: none;
    border-radius: 5px;
    padding: 0 15px;
    font-size: 1rem;
    resize: none;
}

.chat-input button {
    height: 45px;
    width: 45px;
    border: none;
    outline: none;
    background: var(--aisa-orange);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.2s ease;
}

.chat-input button:hover {
    background: #c8641a;
}

/* --- Estilos para dispositivos móviles --- */
@media (max-width: 768px) {
    .chatbot-toggler {
        width: 60px; /* Botón más pequeño */
        height: 60px;
        bottom: 20px; /* Posición más baja */
        right: 15px; /* Más pegado al borde */
    }

    .chatbot-container {
        /* Ocupa casi toda la pantalla para una mejor experiencia */
        width: 95%;
        height: 90%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        transform-origin: bottom right;
    }
}