/* ========================================
   AvalosCPA WhatsApp Floating Widget
   ======================================== */

/* ---------- Floating Button ---------- */
.acpa-whatsapp-btn {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25d366;
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: acpa-whatsapp-pulse 2s infinite;
}

.acpa-whatsapp-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
    color: #ffffff;
}

.acpa-whatsapp-btn:active {
    transform: scale(0.95);
}

/* ---------- Pulse Animation ---------- */
@keyframes acpa-whatsapp-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5);
    }
    70% {
        box-shadow: 0 0 0 14px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* ---------- Tooltip ---------- */
.acpa-whatsapp-btn::after {
    content: 'WhatsApp';
    position: absolute;
    right: 72px;
    background: #333;
    color: #fff;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.acpa-whatsapp-btn:hover::after {
    opacity: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .acpa-whatsapp-btn {
        bottom: 86px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    .acpa-whatsapp-btn::after {
        display: none;
    }
}

/* ========================================
   WhatsApp Mini Chatbot Panel

   NOTE: every selector is prefixed with
   `.acpa-wa-chat` to beat the Hello
   Elementor theme reset (`button`,
   `[type=button]`, `input[type=text]`).
   ======================================== */

.acpa-wa-chat {
    position: fixed;
    bottom: 168px;
    right: 24px;
    width: 380px;
    height: 500px;
    max-height: calc(100vh - 200px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(8, 39, 70, 0.18);
    z-index: 99999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    border: 1px solid #e5e7eb;
}

.acpa-wa-chat.acpa-open {
    display: flex;
    animation: acpa-wa-slide-up 0.3s ease;
}

@keyframes acpa-wa-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Header ---------- */
.acpa-wa-chat .acpa-wa-chat-header {
    background: #082746;
    color: #ffffff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.acpa-wa-chat .acpa-wa-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.acpa-wa-chat .acpa-wa-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #25d366;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.acpa-wa-chat .acpa-wa-chat-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.acpa-wa-chat .acpa-wa-chat-subtitle {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
}

.acpa-wa-chat .acpa-wa-chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: 0;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
}

.acpa-wa-chat .acpa-wa-chat-close svg {
    display: block;
    width: 20px;
    height: 20px;
    stroke: #ffffff;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
}

.acpa-wa-chat .acpa-wa-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* ---------- Messages ---------- */
.acpa-wa-chat .acpa-wa-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fb;
    min-height: 0;
}

.acpa-wa-chat .acpa-wa-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.acpa-wa-chat .acpa-wa-chat-messages::-webkit-scrollbar-thumb {
    background: #c99a32;
    border-radius: 10px;
}

.acpa-wa-chat .acpa-wa-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: acpa-wa-fade-in 0.25s ease;
}

@keyframes acpa-wa-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.acpa-wa-chat .acpa-wa-chat-message.bot {
    align-self: flex-start;
}

.acpa-wa-chat .acpa-wa-chat-message.user {
    align-self: flex-end;
}

.acpa-wa-chat .acpa-wa-chat-message-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    word-wrap: break-word;
    white-space: pre-line;
}

.acpa-wa-chat .acpa-wa-chat-message.bot .acpa-wa-chat-message-bubble {
    background: #ffffff;
    color: #333;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.acpa-wa-chat .acpa-wa-chat-message.user .acpa-wa-chat-message-bubble {
    background: #082746;
    color: #ffffff;
    border: 1px solid #082746;
    border-bottom-right-radius: 4px;
}

/* ---------- Typing Indicator ---------- */
.acpa-wa-chat .acpa-wa-chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.acpa-wa-chat .acpa-wa-chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #c99a32;
    animation: acpa-wa-bounce 1.2s infinite;
}

.acpa-wa-chat .acpa-wa-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.acpa-wa-chat .acpa-wa-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes acpa-wa-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%           { transform: translateY(-6px); }
}

/* ---------- Input Area ---------- */
.acpa-wa-chat .acpa-wa-chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
    flex-shrink: 0;
}

.acpa-wa-chat .acpa-wa-chat-input {
    flex: 1;
    min-width: 0;
    width: auto;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 13.5px;
    line-height: 1.4;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    color: #333;
    background: #ffffff;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    text-transform: none;
}

.acpa-wa-chat .acpa-wa-chat-input::placeholder {
    color: #aaa;
}

.acpa-wa-chat .acpa-wa-chat-input:focus {
    border-color: #c99a32;
    box-shadow: none;
}

.acpa-wa-chat .acpa-wa-chat-input.acpa-wa-chat-input-error {
    border-color: #e05a4f;
    animation: acpa-wa-shake 0.3s ease;
}

@keyframes acpa-wa-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

.acpa-wa-chat .acpa-wa-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #25d366;
    color: #ffffff;
    border: 0;
    box-shadow: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.2s, transform 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.acpa-wa-chat .acpa-wa-chat-send:hover,
.acpa-wa-chat .acpa-wa-chat-send:focus {
    background: #1fb857;
    color: #ffffff;
    transform: scale(1.05);
    border: 0;
}

.acpa-wa-chat .acpa-wa-chat-send svg {
    fill: none;
    stroke: currentColor;
}

/* ---------- Actions (Iniciar) ---------- */
.acpa-wa-chat .acpa-wa-chat-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
    flex-shrink: 0;
}

.acpa-wa-chat .acpa-wa-chat-actions[hidden] {
    display: none;
}

.acpa-wa-chat .acpa-wa-chat-start {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 16px;
    background: #25d366;
    color: #ffffff;
    border: 0;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    font-family: 'Inter', sans-serif;
    text-align: center;
    text-transform: none;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.2s, transform 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.acpa-wa-chat .acpa-wa-chat-start:hover,
.acpa-wa-chat .acpa-wa-chat-start:focus {
    background: #1fb857;
    color: #ffffff;
    border: 0;
    transform: translateY(-1px);
}

.acpa-wa-chat .acpa-wa-chat-start svg {
    flex-shrink: 0;
    fill: currentColor;
    stroke: none;
}

.acpa-wa-chat .acpa-wa-chat-restart {
    width: 100%;
    padding: 8px 16px;
    background: transparent;
    border: 0;
    color: #6b7280;
    font-size: 12.5px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: underline;
    text-transform: none;
    box-shadow: none;
    transition: color 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.acpa-wa-chat .acpa-wa-chat-restart:hover,
.acpa-wa-chat .acpa-wa-chat-restart:focus {
    color: #082746;
    background: transparent;
    border: 0;
}

/* ---------- Panel Responsive ---------- */
@media (max-width: 480px) {
    .acpa-wa-chat {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 152px;
        height: calc(100vh - 172px);
        max-height: none;
        border-radius: 12px;
    }
}
