/* ============ Burbuja flotante + ondas pulsantes ============ */
#ac-chat-bubble-wrap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    z-index: 999998;
}

.ac-pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--ac-pulse-color, #1a1a2e);
    animation: ac-pulse 2.2s ease-out infinite;
    pointer-events: none;
}

.ac-pulse-ring.ac-delay {
    animation-delay: 1.1s;
}

@keyframes ac-pulse {
    0%   { transform: scale(1);   opacity: 0.55; }
    100% { transform: scale(1.7); opacity: 0; }
}

#ac-chat-bubble {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: none;
    background: var(--ac-bubble-color, #1a1a2e);
    color: var(--ac-bubble-icon-color, #ffffff);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

#ac-chat-bubble svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

/* ============ Ventana de chat ============ */
#ac-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    max-width: 90vw;
    height: 440px;
    max-height: 70vh;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    font-family: -apple-system, Arial, sans-serif;

    /* Estado cerrado: invisible y sin interacción, listo para animar */
    opacity: 0;
    transform: scale(0.85) translateY(16px);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#ac-chat-window.ac-open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* ============ Encabezado ============ */
#ac-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    background: var(--ac-header-bg, #1a1a2e);
    color: var(--ac-header-text, #ffffff);
    flex-shrink: 0;
}

.ac-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ac-header-logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    flex-shrink: 0;
}

.ac-header-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ac-header-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ac-header-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    opacity: 0.9;
}

.ac-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ac-status-dot, #3ddc84);
    flex-shrink: 0;
}

#ac-chat-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 4px;
    opacity: 0.85;
    flex-shrink: 0;
}

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

/* ============ Mensajes ============ */
#ac-chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.4;
}

.ac-msg {
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    max-width: 85%;
    white-space: pre-wrap;
}

.ac-msg-user {
    background: var(--ac-header-bg, #1a1a2e);
    color: var(--ac-header-text, #ffffff);
    margin-left: auto;
}

.ac-msg-bot {
    background: #f0f0f2;
    color: #1a1a1a;
}

/* ============ Input ============ */
#ac-chat-input-row {
    display: flex;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

#ac-chat-input {
    flex: 1;
    border: none;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

#ac-chat-send {
    border: none;
    background: var(--ac-bubble-color, #1a1a2e);
    color: var(--ac-bubble-icon-color, #ffffff);
    padding: 0 16px;
    cursor: pointer;
    font-size: 14px;
}
