/* Contenedor Global (Posicionado y centrado sobre WhatsApp que está a right: 20px, width: 60px) */
#lovi-chatbot-container {
    position: fixed;
    bottom: 155px;
    right: 10px;
    z-index: 999999;
    font-family: var(--default-font, "Roboto", sans-serif);
}

/* Botón Flotante con Animación Vectorial (Lottie) */
#lovi-chat-bubble,
#lovi-chat-bubble:hover,
#lovi-chat-bubble:focus,
#lovi-chat-bubble:active {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    width: 80px;
    height: 80px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.2));
}

#lovi-chat-bubble:hover {
    transform: scale(1.08) translateY(-3px);
}

#lovi-chat-bubble:active {
    transform: scale(0.96);
}

/* Reproductor Lottie Vectorial */
#lovi-chat-bubble lottie-player {
    width: 100%;
    height: 100%;
    transform: scale(1.22);
    transform-origin: center center;
    pointer-events: none;
}

/* Teaser / Globito de Sugerencias Flotante */
.lovi-chat-teaser {
    position: absolute;
    right: 86px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(221, 176, 99, 0.18);
    border: 1.5px solid rgba(221, 176, 99, 0.45);
    padding: 12px 14px 10px 14px;
    width: 255px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease, border-color 0.25s ease;
    z-index: 10;
    pointer-events: auto;
    font-family: inherit;
    user-select: none;
}

/* Flechita apuntando hacia el corazón (Desktop) */
.lovi-chat-teaser::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid #ffffff;
}

.lovi-chat-teaser::before {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 9px solid rgba(221, 176, 99, 0.45);
}

.lovi-chat-teaser.lovi-teaser-visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(-50%) translateX(0);
    animation: loviTeaserPulse 4s infinite ease-in-out;
}

@keyframes loviTeaserPulse {

    0%,
    100% {
        transform: translateY(-50%) scale(1);
    }

    50% {
        transform: translateY(-50%) scale(1.025);
    }
}

.lovi-chat-teaser:hover {
    transform: translateY(-50%) scale(1.035);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(221, 176, 99, 0.3);
    border-color: #ddb063;
    animation: none;
}

.lovi-teaser-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lovi-teaser-badge {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lovi-teaser-dot {
    width: 7px;
    height: 7px;
    background-color: #25d366;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.25);
    animation: loviDotPulse 1.8s infinite;
}

@keyframes loviDotPulse {
    0% {
        transform: scale(0.9);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.3);
        opacity: 1;
        box-shadow: 0 0 6px rgba(37, 211, 102, 0.7);
    }

    100% {
        transform: scale(0.9);
        opacity: 0.8;
    }
}

.lovi-teaser-author {
    font-size: 11.5px;
    font-weight: 700;
    color: #ddb063;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.lovi-teaser-text {
    font-size: 13px;
    line-height: 1.35;
    color: #2d465e;
    margin: 0;
    font-weight: 500;
    transition: opacity 0.25s ease;
}

.lovi-teaser-cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: #5777ba;
    margin-top: 4px;
}

.lovi-teaser-cta svg {
    flex-shrink: 0;
}

.lovi-teaser-close {
    position: absolute;
    top: 5px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 16px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    transition: color 0.2s;
}

.lovi-teaser-close:hover {
    color: #334155;
}

/* Ventana de Chat (Fija en la esquina, amplia y espaciosa) */
#lovi-chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 580px;
    max-width: 90vw;
    max-height: calc(100vh - 40px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: calc(100% - 35px) calc(100% - 35px);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 1;
    transform: scale(1);
}

#lovi-chat-window.lovi-hidden {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

/* Cabecera */
.lovi-chat-header {
    padding: 16px 20px;
    background: rgba(221, 176, 99, 0.95);
    /* Accent color */
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-family: var(--heading-font, "Raleway", sans-serif);
}

.lovi-chat-header strong {
    font-size: 16.5px;
    font-weight: 600;
    display: block;
}

#lovi-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.85;
    transition: opacity 0.2s;
    padding: 0 4px;
}

#lovi-chat-close:hover {
    opacity: 1;
}

/* Contenedor de Mensajes */
#lovi-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#lovi-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#lovi-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(87, 119, 186, 0.3);
    border-radius: 3px;
}

/* Burbujas de Mensaje */
.lovi-message {
    display: flex;
    width: 100%;
}

.lovi-message-bubble {
    max-width: 86%;
    padding: 13px 18px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Mensaje del Asistente */
.lovi-message-assistant {
    justify-content: flex-start;
}

.lovi-message-assistant .lovi-message-bubble {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    color: var(--heading-color, #2d465e);
}

/* Mensaje del Usuario */
.lovi-message-user {
    justify-content: flex-end;
}

.lovi-message-user .lovi-message-bubble {
    background: var(--default-color, #5777ba);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Input y Envío */
#lovi-chat-input-container {
    display: flex;
    padding: 15px;
    background: rgba(255, 255, 255, 0.85);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    gap: 10px;
    align-items: center;
}

#lovi-chat-input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 22px;
    outline: none;
    background: #ffffff;
    font-size: 14.5px;
    transition: border-color 0.3s;
    font-family: inherit;
}

#lovi-chat-input:focus {
    border-color: var(--accent-color, #ddb063);
}

#lovi-chat-send {
    background: var(--accent-color, #ddb063);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 10px rgba(221, 176, 99, 0.3);
    flex-shrink: 0;
}

#lovi-chat-send:hover {
    transform: scale(1.06);
}

#lovi-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Responsive (Mobile) */
@media (max-width: 480px) {
    #lovi-chatbot-container {
        bottom: 165px;
        right: 10px;
    }

    #lovi-chat-bubble {
        width: 80px;
        height: 80px;
        margin-right: 0;
    }

    /* Teaser en móvil: posicionado justo encima del corazón con flecha hacia abajo */
    .lovi-chat-teaser {
        right: 0;
        top: auto;
        bottom: 84px;
        transform: translateY(8px);
        width: 230px;
        padding: 10px 12px 8px 12px;
    }

    .lovi-chat-teaser::after {
        right: 34px;
        top: 100%;
        transform: none;
        border-top: 7px solid #ffffff;
        border-bottom: none;
        border-left: 7px solid transparent;
        border-right: 7px solid transparent;
    }

    .lovi-chat-teaser::before {
        right: 33px;
        top: 100%;
        transform: none;
        border-top: 8px solid rgba(221, 176, 99, 0.45);
        border-bottom: none;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
    }

    .lovi-chat-teaser.lovi-teaser-visible {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0);
        animation: loviTeaserPulseMobile 4s infinite ease-in-out;
    }

    @keyframes loviTeaserPulseMobile {

        0%,
        100% {
            transform: translateY(0) scale(1);
        }

        50% {
            transform: translateY(-3px) scale(1.02);
        }
    }

    .lovi-chat-teaser:hover {
        transform: translateY(-3px) scale(1.03);
    }

    #lovi-chat-window {
        position: fixed;
        bottom: 85px;
        right: 16px;
        left: auto;
        width: 310px;
        max-width: calc(100vw - 32px);
        height: 480px;
        max-height: 60vh;
        margin-bottom: 0;
        border-radius: 16px;
    }
}