/* WhatsApp Floating Widget - Enhanced Version */
.whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.whatsapp-float.animate-in {
    animation: slideInBounce 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideInBounce {
    0% {
        transform: translateX(200px) rotate(45deg);
        opacity: 0;
    }
    60% {
        transform: translateX(-10px) rotate(-5deg);
        opacity: 1;
    }
    80% {
        transform: translateX(5px) rotate(2deg);
    }
    100% {
        transform: translateX(0) rotate(0);
    }
}

.whatsapp-button {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 4px 15px rgba(37, 211, 102, 0.4),
        0 8px 30px rgba(0, 0, 0, 0.2),
        inset 0 -2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.3);
    overflow: visible;
}

.whatsapp-button:hover {
    box-shadow: 
        0 8px 25px rgba(37, 211, 102, 0.6),
        0 15px 45px rgba(0, 0, 0, 0.3),
        inset 0 -2px 8px rgba(0, 0, 0, 0.2);
    transform: translateY(-8px) scale(1.1) rotate(5deg);
    border-color: rgba(255, 255, 255, 0.5);
}

.whatsapp-button:active {
    transform: translateY(-4px) scale(1.05);
}

.whatsapp-button svg {
    width: 34px;
    height: 34px;
    fill: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.whatsapp-button:hover svg {
    transform: scale(1.1) rotate(-5deg);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Multi-layer pulse animation */
.whatsapp-button::before,
.whatsapp-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.6);
    z-index: 0;
}

.whatsapp-button::before {
    animation: pulse1 2.5s ease-out infinite;
}

.whatsapp-button::after {
    animation: pulse2 2.5s ease-out infinite 0.5s;
}

@keyframes pulse1 {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.8);
        opacity: 0;
    }
}

@keyframes pulse2 {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        opacity: 0.3;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Glowing ring effect */
.whatsapp-button-glow {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: linear-gradient(45deg, #25D366, #128C7E, #25D366);
    background-size: 200% 200%;
    animation: rotateGlow 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    filter: blur(8px);
}

.whatsapp-button:hover .whatsapp-button-glow {
    opacity: 0.6;
}

@keyframes rotateGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Enhanced Tooltip with animation */
.whatsapp-tooltip {
    position: absolute;
    right: 85px;
    top: 50%;
    transform: translateY(-50%) translateX(20px);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #1E4B8B;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-family: 'Inter', sans-serif;
    border: 2px solid rgba(37, 211, 102, 0.2);
}

.whatsapp-tooltip::before {
    content: '💬';
    margin-right: 6px;
    font-size: 14px;
}

.whatsapp-tooltip::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid #ffffff;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    filter: drop-shadow(2px 0 2px rgba(0, 0, 0, 0.1));
}

.whatsapp-float:hover .whatsapp-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Notification badge */
.whatsapp-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #ff4757 0%, #ff6348 100%);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.5);
    animation: badgePulse 2s ease-in-out infinite;
    z-index: 3;
    border: 2px solid white;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

/* Sparkle effect */
.whatsapp-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.whatsapp-button:hover .whatsapp-sparkle {
    animation: sparkle 1s ease-out;
}

.whatsapp-sparkle:nth-child(1) {
    top: 10%;
    left: 20%;
    animation-delay: 0s;
}

.whatsapp-sparkle:nth-child(2) {
    top: 20%;
    right: 15%;
    animation-delay: 0.2s;
}

.whatsapp-sparkle:nth-child(3) {
    bottom: 15%;
    left: 15%;
    animation-delay: 0.4s;
}

.whatsapp-sparkle:nth-child(4) {
    bottom: 20%;
    right: 20%;
    animation-delay: 0.6s;
}

@keyframes sparkle {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.5) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: scale(0) rotate(360deg);
    }
}

/* Shake animation on page load */
@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px) rotate(-3deg); }
    20%, 40%, 60%, 80% { transform: translateX(5px) rotate(3deg); }
}

.whatsapp-float.shake {
    animation: shake 0.8s ease-in-out;
}

/* Floating animation */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.whatsapp-button.floating {
    animation: float 3s ease-in-out infinite;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .whatsapp-float {
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-button {
        width: 58px;
        height: 58px;
    }
    
    .whatsapp-button svg {
        width: 30px;
        height: 30px;
    }
    
    .whatsapp-tooltip {
        display: none;
    }
    
    .whatsapp-badge {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .whatsapp-float {
        bottom: 16px;
        right: 16px;
    }
    
    .whatsapp-button {
        width: 54px;
        height: 54px;
    }
    
    .whatsapp-button svg {
        width: 28px;
        height: 28px;
    }
    
    .whatsapp-button:hover {
        transform: translateY(-6px) scale(1.08);
    }
}

/* Ensure it doesn't overlap with other elements */
@media (max-height: 600px) {
    .whatsapp-float {
        bottom: 16px;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .whatsapp-float,
    .whatsapp-button,
    .whatsapp-tooltip {
        animation: none !important;
        transition: none !important;
    }
    
    .whatsapp-button::before,
    .whatsapp-button::after {
        animation: none !important;
    }
}
