/* FV Chatbot – Estilos v3 */

:root {
    --fv-cb-accent: #0078D4;
    --fv-cb-header-text: #FFFFFF;
    --chat-width: 450px;
    --chat-height: 680px;
    --header-height: 56px;
    --border-radius: 16px;
    --transition-speed: 0.3s;
}

/* Popup del chat */
#chatbot-popup {
    display: flex !important;
    flex-direction: column !important;
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: var(--chat-width);
    height: var(--chat-height);
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 18px 40px -5px rgba(0, 0, 0, 0.2),
                0 15px 20px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    opacity: 0;
    transform-origin: bottom right;
    transform: scale(0.95);
    transition: all var(--transition-speed) ease-in-out;
    z-index: 9999;
    pointer-events: none;
}

#chatbot-popup.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Header */
#chatbot-header {
    background: var(--primary-color);
    padding: 16px 20px;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--fv-cb-header-text);
    flex-shrink: 0;
}

.fv-cb-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.8);
    flex-shrink: 0;
}

.fv-cb-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    flex: 1;
    padding: 0 12px;
}

.header-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.icon-button {
    background: none;
    border: none;
    color: var(--fv-cb-header-text);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-button:hover {
    color: var(--fv-cb-header-text);
    background: rgba(255, 255, 255, 0.1);
}

.icon-button:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Body: reCAPTCHA + WebChat */
.fv-cb-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#recaptcha-wrapper {
    padding: 12px 16px;
    flex: 0 0 auto;
}

/* Área de WebChat */
#webchat {
    flex: 1;
    min-height: 0;
    width: 100%;
    background-color: #f9fafb;
    position: relative;
}

.webchat-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    pointer-events: none;
    z-index: 1;
}

#webchat > div {
    position: relative;
    z-index: 2;
}

#webchat .webchat__basic-transcript__content {
    white-space: pre-wrap !important;
    word-break: break-word !important;
}

#webchat .webchat__bubble__content {
    padding: 8px 12px !important;
}

#webchat .webchat__bubble {
    max-width: 85% !important;
    margin: 8px !important;
}

#webchat .webchat__basic-transcript__content ul,
#webchat .webchat__basic-transcript__content ol,
#webchat .webchat__bubble__content ul,
#webchat .webchat__bubble__content ol {
    padding-left: 24px !important;
    margin: 8px 0 !important;
    list-style-position: outside !important;
}

#webchat .webchat__basic-transcript__content li,
#webchat .webchat__bubble__content li {
    margin: 4px 0 !important;
    padding-left: 4px !important;
}

/* Ocultar citaciones del bot */
a[href^="cite:"],
[data-testid*="citation"],
.webchat__citation,
.webchat__stacked-layout__citation {
    display: none !important;
}

/* Botón flotante para abrir el chat */
#open-chat {
    position: fixed !important;
    bottom: 40px !important;
    right: 40px !important;
    width: 90px !important;
    height: 90px !important;
    border-radius: 50% !important;
    background-color: #0078D4 !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25) !important;
    transition: all var(--transition-speed) ease-in-out;
    z-index: 10000 !important;
    overflow: hidden !important;
    padding: 0 !important;
}

#open-chat.hidden {
    opacity: 0 !important;
    transform: scale(0.8) translateY(20px) !important;
    pointer-events: none !important;
}

#open-chat:hover {
    transform: translateY(-4px) scale(1.28) !important;
    box-shadow: 0 12px 25px -5px rgba(0, 0, 0, 0.25) !important;
}

#open-chat:focus {
    outline: 2px solid rgba(79, 70, 229, 0.5);
    outline-offset: 2px;
}

#open-chat svg {
    width: 28px;
    height: 28px;
    color: white;
    transition: transform 0.2s ease;
}

.fv-chat-image-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.fv-chat-image-btn img {
    display: block;
    width: 85px !important;
    height: 85px !important;
    object-fit: contain !important;
    border-radius: 50% !important;
}

/* Responsive */
@media (max-width: 768px) {
    #chatbot-popup {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}
