#sales-chat-toggle {
    /* Misma altura que #whatsapp-flotante (bottom: 20px) mientras la flecha
       de "volver al inicio" esta oculta; en cuanto esa flecha aparece
       (scroll > 300px, ver sales-chat.js) sube a 90px para no encimarse con
       ella y mantener la simetria con el boton de WhatsApp del otro lado. */
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--purple-accent, #4b04fe);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s, bottom 0.3s;
    z-index: 991;
    animation: sales-chat-beacon-glow 2.4s ease-in-out infinite;
}

#sales-chat-toggle.chat-elevated {
    bottom: 90px;
}

#sales-chat-toggle::before,
#sales-chat-toggle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--purple-accent, #4b04fe);
    transform: translate(-50%, -50%) scale(1);
    z-index: -1;
    pointer-events: none;
    animation: sales-chat-beacon-ring 2.4s ease-out infinite;
}

#sales-chat-toggle::after {
    animation-delay: 1.2s;
}

#sales-chat-toggle:hover {
    transform: scale(1.1);
}

@keyframes sales-chat-beacon-ring {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.55; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

@keyframes sales-chat-beacon-glow {
    0%, 100% { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(75, 4, 254, 0.55); }
    50% { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 26px 12px rgba(75, 4, 254, 0.6); }
}

@media (prefers-reduced-motion: reduce) {
    #sales-chat-toggle,
    #sales-chat-toggle::before,
    #sales-chat-toggle::after {
        animation: none;
    }
}

#sales-chat-tooltip {
    position: fixed;
    bottom: 85px;
    right: 16px;
    max-width: 210px;
    background-color: #1a1a24;
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    line-height: 1.35;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s, bottom 0.3s;
    z-index: 990;
    pointer-events: none;
}

#sales-chat-tooltip.chat-elevated {
    bottom: 155px;
}

#sales-chat-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 28px;
    width: 12px;
    height: 12px;
    background-color: #1a1a24;
    transform: rotate(45deg);
}

#sales-chat-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (min-width: 992px) {
    #sales-chat-tooltip {
        display: none;
    }
}

#sales-chat-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 340px;
    max-width: calc(100vw - 40px);
    height: 460px;
    max-height: calc(100vh - 200px);
    background-color: #1a1a24;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s, bottom 0.3s;
    z-index: 991;
}

#sales-chat-panel.chat-elevated {
    bottom: 160px;
}

#sales-chat-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#sales-chat-header {
    background-color: var(--purple-accent, #4b04fe);
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
}

#sales-chat-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
}

#sales-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sales-chat-bubble {
    max-width: 85%;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.sales-chat-bubble-assistant {
    align-self: flex-start;
    background-color: #2a2a38;
    color: #ffffff;
    border-bottom-left-radius: 2px;
}

.sales-chat-bubble-user {
    align-self: flex-end;
    background-color: var(--purple-accent, #4b04fe);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.sales-chat-typing {
    opacity: 0.6;
    font-style: italic;
}

.sales-chat-bubble a {
    word-break: break-all;
    text-decoration: underline;
}

.sales-chat-bubble-assistant a {
    color: #b39dff;
}

.sales-chat-bubble-user a {
    color: #ffffff;
}

#sales-chat-form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #2a2a38;
}

#sales-chat-input {
    flex: 1;
    border: 1px solid #2a2a38;
    background-color: #121218;
    color: #ffffff;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.9rem;
    outline: none;
}

#sales-chat-input:focus {
    border-color: var(--purple-accent, #4b04fe);
}

#sales-chat-send {
    background-color: var(--purple-accent, #4b04fe);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 1rem;
}

#sales-chat-send:disabled,
#sales-chat-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    #sales-chat-panel {
        right: 12px;
        bottom: 150px;
    }
    #sales-chat-toggle {
        right: 12px;
    }
}
