/* ============================================================
   WhatsApp Sales Bot — Floating CTA Widget
   FindiBANKIT Lead Conversion Asset
   ============================================================
   Zero-dependency, mobile-first design.
   Sits at bottom-right corner. Opens wa.me deeplink on tap.
   Includes pulse animation + tooltip for engagement.
   ============================================================ */

/* --- Widget Container --- */
.wa-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* --- Tooltip Bubble --- */
.wa-widget__tooltip {
    background: #ffffff;
    color: #1b3d5c;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.04);
    max-width: 220px;
    position: relative;
    opacity: 0;
    transform: translateY(8px) scale(0.95);
    animation: waTooltipIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 2.5s forwards;
    pointer-events: none;
    white-space: nowrap;
}

/* Tooltip tail */
.wa-widget__tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    transform: rotate(45deg);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.06);
    border-radius: 2px;
}

/* Close button on tooltip */
.wa-widget__tooltip-close {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e5e7eb;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #6b7280;
    line-height: 1;
    padding: 0;
    pointer-events: auto;
    transition: background 0.2s ease;
}

.wa-widget__tooltip-close:hover {
    background: #d1d5db;
}

/* --- FAB Button --- */
.wa-widget__fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25D366;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 14px rgba(37, 211, 102, 0.4),
        0 8px 32px rgba(37, 211, 102, 0.15);
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.3s ease;
    animation: waFabIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 1s both;
}

.wa-widget__fab:hover {
    transform: scale(1.08);
    box-shadow:
        0 6px 20px rgba(37, 211, 102, 0.5),
        0 12px 40px rgba(37, 211, 102, 0.2);
}

.wa-widget__fab:active {
    transform: scale(0.95);
}

/* WhatsApp SVG Icon */
.wa-widget__fab svg {
    width: 32px;
    height: 32px;
    fill: #ffffff;
    flex-shrink: 0;
}

/* --- Pulse Ring --- */
.wa-widget__fab::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.3);
    animation: waPulse 2.5s ease-out infinite;
    z-index: -1;
}

/* --- Notification Badge --- */
.wa-widget__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border-radius: 50%;
    border: 2.5px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    color: #ffffff;
    animation: waBadgeBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 3s both;
}

/* --- Animations --- */
@keyframes waFabIn {
    from {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes waPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    70% {
        transform: scale(1.5);
        opacity: 0;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes waTooltipIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes waBadgeBounce {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

/* --- Tooltip Dismissed State --- */
.wa-widget--tooltip-hidden .wa-widget__tooltip {
    display: none;
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    .wa-widget {
        bottom: 16px;
        right: 16px;
    }

    .wa-widget__fab {
        width: 56px;
        height: 56px;
    }

    .wa-widget__fab svg {
        width: 28px;
        height: 28px;
    }

    .wa-widget__tooltip {
        font-size: 12px;
        padding: 8px 14px;
        max-width: 180px;
    }
}

/* Ensure widget doesn't overlap mobile nav drawer */
.mobile-drawer[hidden] ~ .wa-widget,
body .wa-widget {
    /* Always visible regardless of drawer state */
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .wa-widget__fab,
    .wa-widget__tooltip,
    .wa-widget__badge {
        animation: none !important;
        opacity: 1;
        transform: none;
    }

    .wa-widget__fab::before {
        animation: none !important;
        display: none;
    }
}
