/* chatbot.css */

/* ===========================================
   Icono flotante (clase)
   =========================================== */
.chatbot-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    cursor: pointer;
    display: inline-block;
    transition: transform 0.3s ease;
}

.chatbot-icon img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.chatbot-icon:hover img {
    transform: scale(1.1);
}

/* ===========================================
   Modal (clase .chatbot-modal) - con flex para mejor control
   =========================================== */
.chatbot-modal {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: #f4f4f4;
    border: 1px solid #222d50;
    border-radius: 8px;
    width: 320px;
    max-width: 90vw;
    height: 450px;
    max-height: 80vh;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    overflow-y: scroll;
}

/* Título */
.chatbot-titulo {
    background: #011A6A;
    color: #fff;
    padding: 6px 12px;
    border-radius: 5px;
    margin-bottom: 8px;
    font-size: 0.95rem;
    text-align: center;
    flex-shrink: 0;
}

/* Botón cerrar (clase .close-btn) */
.close-btn {
    float: right;
    font-size: 1.8rem;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.close-btn:hover {
    background: #000;
    color: #fff;
    border-radius: 4px;
}

/* Historial de mensajes - con scroll */
.chatbot-historial {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #ccc;
    padding: 10px;
    background: #ebf4fd;
    border-radius: 4px;
    margin-bottom: 8px;
    min-height: 0;  /* Importante para flex */
}

/* Formulario - fijo al final */
.chatbot-form {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}

.chatbot-form button {
    padding: 6px 14px;
    background: #011A6A;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Mensajes */
.chatbot-historial .mensaje-bot p {
    background: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    margin: 4px 0;
    text-align: left;
    word-wrap: break-word;
    font-size: 0.85rem;
    line-height: 1.2;
}
.chatbot-historial .mensaje-bot a {
    color: #011A6A;
    text-decoration: underline;
}
.chatbot-historial .mensaje-cliente p {
    background: #ebf4fd;
    padding: 6px 10px;
    border-radius: 6px;
    margin: 4px 0;
    text-align: right;
    word-wrap: break-word;
    font-size: 0.85rem;
    line-height: 1.2;
}

/* ===========================================
   Ajustes para móviles
   =========================================== */
@media (max-width: 600px) {
    .chatbot-modal {
        width: 90vw;
        height: 70vh;
        bottom: 80px;
        right: 5vw;
    }
    .chatbot-icon {
        bottom: 15px;
        right: 15px;
    }
    .chatbot-icon img {
        width: 50px;
        height: 50px;
    }
}