@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;
}

/* 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;
    }
}