/* ==========================================================================
   FAQ BOT - GRUPO VDG
   ========================================================================== */

/* Variables locales del bot para evitar conflictos, usando los colores de GRUPO VDG */
.faq-bot-container {
    --faq-bot-primary: #0B5CAB;
    --faq-bot-dark: #0D2A52;
    --faq-bot-bg: #FFFFFF;
    --faq-bot-bg-alt: #F5F8FC;
    --faq-bot-text: #172033;
    --faq-bot-border: #DCE5EF;
    
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    font-family: inherit; /* Heredar tipografía global */
}

/* --- BURBUJA FLOTANTE --- */
.faq-bot-bubble {
    width: 58px;
    height: 58px;
    background-color: var(--faq-bot-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(11, 92, 171, 0.3);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    animation: faq-bot-breathe 4s infinite ease-in-out;
}

.faq-bot-bubble:hover {
    transform: scale(1.05);
    background-color: var(--faq-bot-dark);
    box-shadow: 0 6px 20px rgba(11, 92, 171, 0.4);
    animation-play-state: paused;
}

.faq-bot-bubble i {
    color: #FFFFFF;
    font-size: 1.8rem;
}

.faq-bot-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #38bdf8;
    border: 2px solid var(--faq-bot-bg);
    border-radius: 50%;
}

@keyframes faq-bot-breathe {
    0% { transform: scale(1.0); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1.0); }
}

/* --- VENTANA DEL CHAT --- */
.faq-bot-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 360px;
    height: 500px;
    background: var(--faq-bot-bg);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--faq-bot-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    
    /* Animación inicial oculta */
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.faq-bot-window.faq-bot-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.faq-bot-window.faq-bot-closing {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
}

/* --- HEADER --- */
.faq-bot-header {
    background-color: var(--faq-bot-dark);
    color: #FFFFFF;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-bot-header-info {
    display: flex;
    flex-direction: column;
}

.faq-bot-header-info strong {
    font-size: 1rem;
    font-weight: 700;
}

.faq-bot-header-info span {
    font-size: 0.75rem;
    opacity: 0.8;
}

.faq-bot-close {
    background: transparent;
    border: none;
    color: #FFFFFF;
    cursor: pointer;
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.faq-bot-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* --- MESSAGES AREA --- */
.faq-bot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: #FFFFFF;
    scrollbar-width: thin;
    scrollbar-color: var(--faq-bot-border) transparent;
}

.faq-bot-messages::-webkit-scrollbar {
    width: 6px;
}
.faq-bot-messages::-webkit-scrollbar-thumb {
    background-color: var(--faq-bot-border);
    border-radius: 3px;
}

/* Burbujas de mensaje */
.faq-bot-message {
    max-width: 85%;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
    animation: faq-bot-fade-in 0.3s ease;
}

@keyframes faq-bot-fade-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.faq-bot-message.bot {
    align-self: flex-start;
    background-color: var(--faq-bot-bg-alt);
    color: var(--faq-bot-text);
    border-radius: 12px 12px 12px 0;
    border: 1px solid var(--faq-bot-border);
}

.faq-bot-message.user {
    align-self: flex-end;
    background-color: var(--faq-bot-primary);
    color: #FFFFFF;
    border-radius: 12px 12px 0 12px;
}

/* Formato de la lista de preguntas */
.faq-bot-questions-list {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}
.faq-bot-questions-list p {
    margin-bottom: 0.3rem;
}
.faq-bot-questions-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--faq-bot-dark);
}

/* Animación de "Escribiendo..." */
.faq-bot-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    height: 1.2rem;
}
.faq-bot-typing span {
    width: 6px;
    height: 6px;
    background-color: #a0aec0;
    border-radius: 50%;
    animation: faq-bot-bounce 1.4s infinite ease-in-out both;
}
.faq-bot-typing span:nth-child(1) { animation-delay: -0.32s; }
.faq-bot-typing span:nth-child(2) { animation-delay: -0.16s; }

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

/* Botones de acción dentro del chat */
.faq-bot-nav-btn {
    display: block;
    width: 100%;
    padding: 0.7rem;
    margin-top: 0.8rem;
    background-color: var(--faq-bot-primary);
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(11, 92, 171, 0.2);
}
.faq-bot-nav-btn:hover {
    background-color: var(--faq-bot-dark);
    transform: translateY(-2px);
}

.faq-bot-suggestion {
    display: block;
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.4rem;
    background-color: var(--faq-bot-bg);
    border: 1px solid var(--faq-bot-primary);
    color: var(--faq-bot-primary);
    border-radius: 8px;
    text-align: left;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.faq-bot-suggestion:hover {
    background-color: var(--faq-bot-primary);
    color: #FFFFFF;
}

/* Sistema de mensajes internos (ej. "Analizando...") */
.faq-bot-system-msg span {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--faq-bot-text);
    opacity: 0.8;
}

/* --- INPUT AREA --- */
.faq-bot-input-area {
    padding: 1rem;
    border-top: 1px solid var(--faq-bot-border);
    background-color: var(--faq-bot-bg);
    display: flex;
    gap: 0.5rem;
}

.faq-bot-input-area input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--faq-bot-border);
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
    color: var(--faq-bot-text);
}

.faq-bot-input-area input:focus-visible {
    border-color: var(--faq-bot-primary);
}

.faq-bot-input-area button {
    background-color: var(--faq-bot-primary);
    color: #FFFFFF;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.faq-bot-input-area button:hover {
    background-color: var(--faq-bot-dark);
}
.faq-bot-input-area button:active {
    transform: scale(0.95);
}

/* --- RESPONSIVE --- */
@media (max-width: 480px) {
    .faq-bot-window {
        width: calc(100vw - 40px);
        bottom: 85px;
        right: -5px;
        height: 60vh;
        max-height: 500px;
    }
}
