/* Botón flotante */
.openai-chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    text-align: center;
    line-height: 60px;
    font-size: 24px;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    position: fixed;
    bottom: 20px;
    right: 20px;
    transition: all 0.3s ease;
    background-color: #fff;
    border: 2px solid #2f5bec;
    overflow: hidden;
    animation: pulse-shadow 2s infinite;
}

.openai-chatbot-button img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Animación de sombra pulsante azul */
@keyframes pulse-shadow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(0, 115, 170, 0.4), 0 4px 8px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 115, 170, 0.8), 0 4px 8px rgba(0, 0, 0, 0.2);
    }
}

/* Modal */
.openai-chatbot-modal {
    display: flex;
    opacity: 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.openai-chatbot-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.openai-chatbot-modal-content {
    position: relative;
    background-color: white;
    padding: 20px;
    border-radius: 15px;
    width: 70vw;
    max-width: 90%;
    height: 80vh;
    max-height: 85vh;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    transform: scale(0.9);
    display: flex;
    flex-direction: column;
}

.openai-chatbot-modal.active .openai-chatbot-modal-content {
    transform: scale(1);
}

body.openai-chatbot-dark .openai-chatbot-modal-content {
    background-color: #1e1e1e;
    color: #ffffff;
}

.openai-chatbot-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #000;
    transition: color 0.3s ease;
}

body.openai-chatbot-dark .openai-chatbot-close {
    color: #fff;
}

.openai-chatbot-close:hover {
    color: #ff4d4d;
}

/* Contenedor de mensajes */
#openai-chatbot-messages {
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid #ccc;
    padding: 10px;
    margin-bottom: 70px;
}

body.openai-chatbot-dark #openai-chatbot-messages {
    border-color: #444;
    background-color: #333;
    color: #fff;
    font-size: 13px;
}

/* Input y botón de envío */
.openai-chatbot-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    position: static;
    bottom: 35px;
    left: 30px;
    right: 30px;
}

#openai-chatbot-input {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

body.openai-chatbot-dark #openai-chatbot-input {
    background-color: #5b5858;
    color: #fff;
    border-color: #444;
}

#openai-chatbot-send, #openai-chatbot-send.disabled {
    width: 40px;
    height: 40px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #fff;
    padding: 8px;
    border-radius: 30px;
}

#openai-chatbot-send img, #openai-chatbot-send.disabled img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Mensajes del bot */
#openai-chatbot-messages {
    display: block;
    margin-bottom: 10px;
}

#openai-chatbot-messages .bot-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

img.bot-avatar {
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    border: solid 2px #000 !important;
}

/* Mensajes del usuario */
.openai-chatbot-user-message {
    display: block;
    background-color: #444;
    text-align: right;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;

}

.openai-chatbot-user-message::before {
    content: "👤";
    font-size: 24px;
    color: #0073aa;
    margin-right: 8px;
}

.openai-chatbot-user-message div {
        background-color: #444;
        color: #e0e0e0;
}

/* Animación de carga */
.typing-indicator {
    display: flex;
    justify-content: center;
    margin-top: 5px;
}

.typing-indicator .dot {
    width: 6px;
    height: 6px;
    background-color: #0073aa;
    border-radius: 50%;
    margin: 0 3px;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Disparadores */
.openai-chatbot-triggers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 15px 0;
}

.trigger-btn {
    background: #f0f0f0;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9em;
}

.trigger-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

body.openai-chatbot-dark .trigger-btn {
    background: #444;
    color: #e0e0e0;
}



/* Mensaje de bienvenida */
.openai-chatbot-greeting {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
}

body.openai-chatbot-dark .openai-chatbot-greeting {
    background: #3a3a3a;
    color: #e0e0e0;
}



/* Respuestas formateadas */
.assistant-response {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    padding: 15px;
    border-radius: 8px;
    background-color: #f9f9f9;
}

body.openai-chatbot-dark .assistant-response {
    background-color: #444;
    color: #e0e0e0;
}

.assistant-response a {
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
}

.assistant-response a:hover {
    text-decoration: underline;
}

.assistant-response ol,
.assistant-response ul {
    padding-left: 20px;
}

.assistant-response li {
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 600px) {
    .openai-chatbot-modal-content {
        width: 100%;
        padding: 10px;
    }

    #openai-chatbot-input {
        width: calc(100% - 60px);
    }

    #openai-chatbot-send {
        padding: 5px 10px;
    }
}



.formatted-response {
    line-height: 1.6;
    padding: 15px;
}

.response-title {
    color: #2f5bec;
    margin: 15px 0 10px;
    padding: 0;
    font-size: 1.1em;
    border-bottom: 2px solid #eee;
}

.response-list {
    list-style: decimal;
    margin: 10px 0 10px 20px;
    padding-left: 15px;
}

.response-item {
    margin: 8px 0;
    padding-left: 5px;
}

.response-text {
    margin: 10px 0;
    white-space: pre-wrap; /* Mantener saltos de línea originales */
}

/* Tema oscuro */
body.openai-chatbot-dark .formatted-response {
    color: #e0e0e0;
}

body.openai-chatbot-dark .response-title {
    color: #6ab0f3;
    border-color: #444;
}



.response-list {
    list-style: none;
    padding-left: 20px;
    counter-reset: list-counter;
}
.response-list li:before {
    content: counter(list-counter) ". ";
    counter-increment: list-counter;
    font-weight: bold;
    display: inline-block;
    width: 25px;
}