/**
 * WhatsApp Floating Button Styles
 * Fixed floating button with avatar and animations
 */

/* Base button styles */
#whatsapp-button {
    position: fixed !important;
    right: 2rem !important;
    bottom: 2rem !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 50 !important;
    cursor: pointer !important;
    transition: bottom 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible !important;
    background: transparent !important;
    transform: translateY(0) !important;
    will-change: bottom, transform !important;
    padding: 0 !important;
    border: none !important;
}

#whatsapp-button:hover {
    transform: scale(1.05);
}

/* Avatar image */
#whatsapp-button .whatsapp-avatar {
    width: 60px !important;
    height: 60px !important;
    object-fit: contain !important;
    object-position: center center !important;
    border-radius: 0 !important;
    animation: gentleFloat 3s ease-in-out infinite;
    box-shadow: none !important;
    display: block !important;
    border: none !important;
    background: transparent !important;
}

/* Gentle floating animation */
@keyframes gentleFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Shake animation triggered by JS */
@keyframes shake {
    0%, 100% {
        transform: rotate(0deg);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: rotate(-8deg);
    }
    20%, 40%, 60%, 80% {
        transform: rotate(8deg);
    }
}

/* Shake on hover release */
@keyframes shakeOnRelease {
    0% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.05) rotate(-5deg);
    }
    50% {
        transform: scale(1.05) rotate(5deg);
    }
    75% {
        transform: scale(1.05) rotate(-5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Pause float on hover */
#whatsapp-button:hover .whatsapp-avatar {
    animation-play-state: paused;
}

/* Shake animation class */
#whatsapp-button .whatsapp-avatar.shake {
    animation: shake 0.6s ease-in-out !important;
}

/* Shake on release */
#whatsapp-button .whatsapp-avatar.shake-release {
    animation: shakeOnRelease 0.4s ease-in-out;
}

/* Move up on scroll */
#whatsapp-button.move-up {
    bottom: 6rem !important;
    /* Fallback animation in CSS if JS inline style doesn't work */
    animation: floatUpBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* Moving down animation */
#whatsapp-button.moving-down {
    animation: floatDownBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* Bounce effect */
#whatsapp-button.move-up::before {
    content: '';
    position: absolute;
    inset: 0;
    animation: pulseRing 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

/* Pulse ring effect */
@keyframes pulseRing {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.2;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Float up animation with bounce */
@keyframes floatUpBounce {
    0% {
        transform: translateY(0) scale(1);
    }
    30% {
        transform: translateY(-12px) scale(1.05);
    }
    50% {
        transform: translateY(8px) scale(0.98);
    }
    70% {
        transform: translateY(-6px) scale(1.02);
    }
    85% {
        transform: translateY(3px) scale(0.99);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* Float down animation with bounce */
@keyframes floatDownBounce {
    0% {
        transform: translateY(0) scale(1);
    }
    30% {
        transform: translateY(12px) scale(1.05);
    }
    50% {
        transform: translateY(-8px) scale(0.98);
    }
    70% {
        transform: translateY(6px) scale(1.02);
    }
    85% {
        transform: translateY(-3px) scale(0.99);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* Tooltip */
#whatsapp-button .tooltip {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #2c3e50;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

#whatsapp-button .tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid #2c3e50;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

#whatsapp-button:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #whatsapp-button {
        right: 1.2rem !important;
        bottom: 1rem !important;
        transition: bottom 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    }
    
    #whatsapp-button .whatsapp-avatar {
        width: 70px !important;
        height: 70px !important;
    }
    
    /* Move up saat scroll */
    #whatsapp-button.move-up {
        bottom: 5.5rem !important;
    }
    
    #whatsapp-button .tooltip {
        display: none !important;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    #whatsapp-button {
        right: 1rem !important;
        bottom: 1rem !important;
    }
    
    #whatsapp-button .whatsapp-avatar {
        width: 66px !important;
        height: 66px !important;
    }
    
    #whatsapp-button.move-up {
        bottom: 5rem !important;
    }
}

/* ========================================
   BACK TO TOP BUTTON - Responsive
   ======================================== */
@media (max-width: 768px) {
    #back-to-top {
        width: 52px !important;
        height: 52px !important;
        right: 1rem !important;
        bottom: 1rem !important;
        font-size: 20px !important;
    }
    
    #back-to-top i[data-lucide] {
        width: 24px !important;
        height: 24px !important;
    }
}

@media (max-width: 480px) {
    #back-to-top {
        width: 48px !important;
        height: 48px !important;
        right: 1rem !important;
        bottom: 1rem !important;
    }
    
    #back-to-top i[data-lucide] {
        width: 22px !important;
        height: 22px !important;
    }
}
