/* WhatsApp + Chatbot lead widgets */
.lead-widgets { --wa-green: #25D366; --wa-dark: #128C7E; --chat-primary: #2072f3; }

/* Floating WhatsApp */
.lead-wa-fab {
    position: fixed;
    right: 24px;
    bottom: 100px;
    width: 58px;
    height: 58px;
    background: linear-gradient(135deg, var(--wa-green), var(--wa-dark));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 6px 24px rgba(37,211,102,0.45);
    z-index: 1450;
    text-decoration: none;
    transition: transform 0.25s, box-shadow 0.25s;
}
.lead-wa-fab:hover { transform: scale(1.08); box-shadow: 0 10px 32px rgba(37,211,102,0.55); color: #fff; }
.lead-wa-pulse {
    position: absolute; inset: -4px; border-radius: 50%;
    border: 2px solid var(--wa-green); opacity: 0;
    animation: waPulse 2s infinite;
}
@keyframes waPulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 0; }
}
.lead-wa-tooltip {
    position: absolute; right: 68px; white-space: nowrap;
    background: #fff; color: #0f172a; padding: 8px 14px; border-radius: 10px;
    font-size: 13px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.lead-wa-fab:hover .lead-wa-tooltip { opacity: 1; }

/* Chatbot FAB */
.lead-chat-fab {
    position: fixed; right: 24px; bottom: 170px;
    width: 54px; height: 54px;
    background: linear-gradient(135deg, var(--chat-primary), #4f46e5);
    color: #fff; border: none; border-radius: 50%;
    font-size: 22px; cursor: pointer;
    box-shadow: 0 6px 24px rgba(32,114,243,0.4);
    z-index: 1450; transition: transform 0.25s;
    animation: chatFabGlow 3s ease-in-out infinite;
}

@keyframes chatFabGlow {
    0%, 100% { box-shadow: 0 6px 24px rgba(32,114,243,0.4); }
    50% { box-shadow: 0 8px 32px rgba(32,114,243,0.55); }
}
.lead-chat-fab:hover { transform: scale(1.08); }
.lead-chat-badge {
    position: absolute; top: -2px; right: -2px;
    background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* Chat panel */
.lead-chat-panel {
    position: fixed; right: 24px; bottom: 100px;
    width: 380px; max-width: calc(100vw - 32px);
    max-height: 520px; background: #fff;
    border-radius: 20px; box-shadow: 0 20px 60px rgba(15,23,42,0.2);
    z-index: 1500; display: flex; flex-direction: column;
    opacity: 0; visibility: hidden; transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden; border: 1px solid #e2e8f0;
}
.lead-chat-panel.is-open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.lead-chat-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(135deg, var(--chat-primary), #00c4a7);
    color: #fff;
}
.lead-chat-avatar {
    width: 42px; height: 42px; border-radius: 12px;
    background: rgba(255,255,255,0.2); display: flex;
    align-items: center; justify-content: center; font-size: 20px;
}
.lead-chat-header strong { display: block; font-size: 15px; }
.lead-chat-header small { opacity: 0.9; font-size: 12px; }
.lead-chat-close {
    margin-left: auto; background: none; border: none;
    color: #fff; font-size: 24px; cursor: pointer; line-height: 1; opacity: 0.8;
}
.lead-chat-close:hover { opacity: 1; }

.lead-chat-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 12px;
    min-height: 220px; max-height: 300px; background: #f8fafc;
}
.lead-chat-msg {
    max-width: 88%; padding: 10px 14px; border-radius: 14px;
    font-size: 14px; line-height: 1.5; animation: chatFadeIn 0.3s ease;
}
@keyframes chatFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.lead-chat-msg--bot {
    align-self: flex-start; background: #fff;
    border: 1px solid #e2e8f0; border-bottom-left-radius: 4px;
}
.lead-chat-msg--user {
    align-self: flex-end; background: linear-gradient(135deg, var(--chat-primary), #4f46e5);
    color: #fff; border-bottom-right-radius: 4px;
}
.lead-chat-msg--success {
    align-self: stretch; background: #ecfdf5; border: 1px solid #6ee7b7;
    color: #065f46; text-align: center; padding: 16px;
}
.lead-chat-wa-btn {
    display: inline-flex; align-items: center; gap: 8px;
    margin-top: 12px; padding: 12px 20px;
    background: var(--wa-green); color: #fff !important;
    border-radius: 10px; font-weight: 700; text-decoration: none;
    font-size: 14px;
}
.lead-chat-wa-btn:hover { background: var(--wa-dark); color: #fff; }

.lead-chat-input-area { padding: 12px 14px; border-top: 1px solid #e2e8f0; background: #fff; }
.lead-chat-form-row { display: flex; gap: 8px; }
.lead-chat-input {
    flex: 1; padding: 10px 14px; border: 1px solid #e2e8f0;
    border-radius: 12px; font-size: 14px; outline: none;
}
.lead-chat-input:focus { border-color: var(--chat-primary); box-shadow: 0 0 0 3px rgba(32,114,243,0.15); }
.lead-chat-send {
    width: 42px; height: 42px; border: none; border-radius: 12px;
    background: var(--chat-primary); color: #fff; cursor: pointer; font-size: 16px;
}
.lead-chat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.lead-chat-chip {
    padding: 8px 14px; border-radius: 50px; border: 1px solid #bfdbfe;
    background: #eff6ff; color: var(--chat-primary); font-size: 12px;
    font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.lead-chat-chip:hover { background: var(--chat-primary); color: #fff; border-color: var(--chat-primary); }
.lead-chat-powered { text-align: center; font-size: 10px; color: #94a3b8; padding: 6px; background: #f8fafc; }

/* WhatsApp buttons sitewide */
.btn-whatsapp, .btn-wa-outline {
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #fff !important; border: none; padding: 12px 22px;
    border-radius: 10px; font-weight: 700; text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.btn-whatsapp:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37,211,102,0.4); color: #fff; }
.btn-wa-outline {
    background: transparent; border: 2px solid #25D366; color: #25D366 !important;
}
.btn-wa-outline:hover { background: #25D366; color: #fff !important; }
.btn-whatsapp--sm { padding: 8px 16px; font-size: 13px; }
.btn-whatsapp--white { background: #fff; color: #128C7E !important; }
.btn-whatsapp--white:hover { background: #f0fdf4; color: #128C7E !important; }

/* Mobile offsets */
@media (max-width: 768px) {
    .lead-wa-fab {
        bottom: calc(var(--mobile-nav-height, 62px) + 12px);
        right: 16px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
    .lead-chat-fab {
        bottom: calc(var(--mobile-nav-height, 62px) + 70px);
        right: 16px;
        width: 46px;
        height: 46px;
        font-size: 18px;
    }
    .lead-chat-panel {
        right: 8px;
        left: 8px;
        bottom: calc(var(--mobile-nav-height, 62px) + 8px);
        width: auto;
        max-width: none;
        border-radius: 20px 20px 0 0;
    }
    .lead-wa-tooltip { display: none; }
    body.has-mobile-nav .back-to-top {
        bottom: calc(var(--mobile-nav-height, 62px) + 12px);
    }
}
