@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css");
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

:root {
    --primary-gradient: linear-gradient(45deg, #99b127 0%, #829c03 100%);
    --bot-bg: #f0f2f5;
    --user-bg: #99b127;
    --shadow: 0 10px 25px rgba(0,0,0,0.15);
    --border-radius: 16px;
}

/* Burbuja flotante */
.chatbot-bubble {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 65px;
    height: 65px;
    color: white;
    border-radius: 50%;
    border: 4px solid white;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: var(--shadow);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-bubble:hover {
    transform: scale(1.1);
}

/* Ventana Principal */
#chatgpt-bot {
    font-family: 'Outfit', sans-serif;
    z-index: 9999;
    position: fixed; /* Forzado para default */
    bottom: 100px;
    right: 25px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: none; /* Se controla con jQuery */
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Reset para versiones Block y Minimalist */
#chatgpt-bot.block, #chatgpt-bot.minimalist {
    position: static;
    display: block;
    width: 100%;
}

#chatgpt-bot.minimalist {
    height: auto;
    background: transparent;
    box-shadow: none;
}

/* Contenedor interno para asegurar el flex */
#chatgpt-bot .chatbot-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Cabecera */
.chat-header {
    /* Elimina el background fijo que había antes */
    padding: 15px 20px;
    color: white;
    position: relative;
    flex-shrink: 0;
    border-radius: 16px 16px 0px 0px;
}

#chatgpt-bot .msg.user {
    align-self: flex-end;
    /* Elimina el background-color fijo */
    border-radius: 15px 15px 4px 15px;
}

/* Botón cerrar */
#chatgpt-bot .closeBtn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    padding: 0;
}

#chatgpt-bot .closeBtn:hover {
    background: rgba(255,255,255,0.3);
}

/* ÁREA DE MENSAJES (EL SCROLL) */
#chat-output {
    flex: 1; /* Ocupa todo el espacio disponible */
    overflow-y: auto !important; /* Forzamos scroll vertical */
    padding: 20px;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0; /* IMPORTANTE: Permite que el contenedor colapse y active el scroll */
}

/* Burbujas */
#chatgpt-bot .msg {
    margin: 0;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    max-width: 85%;
}

#chatgpt-bot .msg.bot {
    align-self: flex-start;
    background-color: var(--bot-bg);
    color: #333;
    border-radius: 4px 15px 15px 15px;
}

#chatgpt-bot .msg.user {
    align-self: flex-end;
    background-color: var(--user-bg);
    color: white;
    border-radius: 15px 15px 4px 15px;
}

/* Input */
.chat-input-container {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0; /* Evita que el input desaparezca */
}

.chat-input-container.default, .chat-input-container.block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-radius: 32px;
}

.chat-input-container.minimalist {
    display: flex;
    flex-direction: row;
    gap: 8px;
}

#chatgpt-bot input {
    width: 100% !important;
    border: 2px solid #f0f2f5 !important;
    background: #f0f2f5 !important;
    padding: 10px 15px !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
}

#chatgpt-bot input:focus {
    border-color: #d9d9d9 !important;
    background: white !important;
    outline: none;
}

#chatgpt-bot button#send-chat {
    width: 100%;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

/* Scrollbar */
#chat-output::-webkit-scrollbar {
    width: 5px;
}
#chat-output::-webkit-scrollbar-track {
    background: #f1f1f1;
}
#chat-output::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

/* Contenedor del avatar con indicador online */
.chatbot-header-avatar {
    position: relative;
    display: inline-block;
}

.chatbot-header-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* El punto verde de "Conectado" */
.chatbot-header-avatar::after {
    content: "";
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background-color: #2ecc71; /* Verde esmeralda */
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

/* --- AJUSTES ESPECÍFICOS VERSIÓN MINIMALISTA --- */

/* Limitación de altura y scroll */
.chatgpt-bot.minimalist #chat-output {
    max-height: 300px !important;
    overflow-y: auto !important;
    background: transparent !important;
    padding-right: 5px; /* Espacio para el scroll */
}

/* Personalización del scroll para que sea elegante y blanco */
.chatgpt-bot.minimalist #chat-output::-webkit-scrollbar {
    width: 4px;
}

.chatgpt-bot.minimalist #chat-output::-webkit-scrollbar-track {
    background: transparent;
}

.chatgpt-bot.minimalist #chat-output::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* Estructura transparente */
.chatgpt-bot.minimalist, 
.chatbot-content.minimalist {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: 100%;
}

/* Burbujas de mensajes minimalistas */
.chatgpt-bot.minimalist .msg.bot {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin-bottom: 10px;
    font-size: 14px;
}

/* Input y contenedor inferior */
.chat-input-container.minimalist {
    background: transparent !important;
    border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
    padding: 10px 0 !important;
    margin-top: 10px;
}

.chat-input-container.minimalist input#chat-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
    border-radius: 20px;
    padding: 10px 15px;
    outline: none;
}

.chat-input-container.minimalist input#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Botón de voz e icono blanco */
.chat-input-container.minimalist #voice-chat {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
}

.chat-input-container.minimalist #mic-icon {
    fill: #ffffff !important;
}

#mic-spinner {
    color: #ffffff !important;
}

/* Ajuste específico para la versión MINIMALISTA */
.chatgpt-bot.minimalist .chatbot-footer-extra {
    color: rgba(255, 255, 255, 0.8) !important; /* Más brillo en modo transparente */
    padding: 5px 0 !important; /* Alineado con el input sin margen lateral */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 5px;
}


.chatgpt-bot.default .chatbot-footer-extra a {
    color: var(--chatbot-color); 
}

/* Responsive */
@media (max-width: 768px) {
    #chatgpt-bot.default {
        width: 100% !important;
        height: 100% !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        border-radius: 0 !important;
    }
}