/**
 * WhatsApp Floating Button Styles
 * 
 * Responsive design with hover animations
 * 
 * @author Case-Themes
 * @since 1.0.0
 */

/* ============================================================================
   WhatsApp Button Container
   ============================================================================ */

.pxl-whatsapp-container {
    position: relative;
    display: inline-block;
}

/* ============================================================================
   WhatsApp Button - Floating Position (Global Button)
   ============================================================================ */

.pxl-whatsapp-button {
    /* Base styling */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    
    /* Fixed position - bottom right corner */
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    
    /* Size and shape - Perfect circle */
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    padding: 0 !important;
    border-radius: 50%;
    
    /* Background and color */
    background-color: #25d366 !important;
    color: white !important;
    
    /* Typography */
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
    
    /* Transitions */
    transition: all 0.3s ease-in-out;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
    
    /* Typography for accessibility */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    
    /* Border */
    border: none;
}

/* Icon styling */
.pxl-whatsapp-button i {
    font-size: 2.5rem !important;
    display: inline-block !important;
    transition: transform 0.3s ease-in-out;
    color: white !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
    line-height: 1 !important;
    text-align: center !important;
}

/* Text styling - Hidden in circular design */
.pxl-whatsapp-button .pxl-whatsapp-text {
    display: none;
}

/* ============================================================================
   WhatsApp Button - Hover State
   ============================================================================ */

.pxl-whatsapp-button:hover {
    background-color: #20ba5a;
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.5);
    transform: translateY(-2px) scale(1.1);
}

.pxl-whatsapp-button:hover i {
    transform: scale(1.15) rotate(10deg);
}

.pxl-whatsapp-button:hover .pxl-whatsapp-text {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================================================
   WhatsApp Button - Active/Focus State (Accessibility)
   ============================================================================ */

.pxl-whatsapp-button:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.pxl-whatsapp-button:active {
    transform: translateY(0);
}

/* ============================================================================
   WhatsApp Button - Responsive Design
   ============================================================================ */

/* Tablet screens */
@media (max-width: 768px) {
    .pxl-whatsapp-button {
        bottom: 1.5rem;
        right: 1.5rem;
        height: 56px;
        width: 56px;
        padding: 0;
    }
    
    .pxl-whatsapp-button i {
        font-size: 2.25rem !important;
        line-height: 1 !important;
    }
    
    .pxl-whatsapp-button .pxl-whatsapp-text {
        display: none;
    }
}

/* Mobile screens */
@media (max-width: 480px) {
    .pxl-whatsapp-button {
        bottom: 1.25rem;
        right: 1.25rem;
        height: 52px;
        width: 52px;
        padding: 0;
    }
    
    .pxl-whatsapp-button i {
        font-size: 2rem !important;
        line-height: 1 !important;
    }
    
    /* Text always hidden on mobile */
    .pxl-whatsapp-button .pxl-whatsapp-text {
        display: none;
    }
}

/* ============================================================================
   WhatsApp Button - Hover Effects
   ============================================================================ */

/* Scale Effect (default) */
.pxl-whatsapp-button.pxl-whatsapp-scale:hover {
    transform: translateY(-2px) scale(1.1);
}

/* Lift Effect */
.pxl-whatsapp-button.pxl-whatsapp-lift:hover {
    transform: translateY(-8px);
}

/* Pulse Effect */
.pxl-whatsapp-button.pxl-whatsapp-pulse:hover {
    animation: pulse-effect 0.6s ease-in-out;
}

/* Bounce Effect */
.pxl-whatsapp-button.pxl-whatsapp-bounce:hover {
    animation: bounce-effect 0.6s ease-in-out;
}

/* No Effect */
.pxl-whatsapp-button.pxl-whatsapp-none:hover {
    transform: none;
}

/* ============================================================================
   WhatsApp Button - Pulse Animation on Load
   ============================================================================ */

@keyframes pulse-on-load {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
    }
    50% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.6);
    }
}

.pxl-whatsapp-button.pxl-whatsapp-pulse {
    animation: pulse-on-load 2s ease-in-out 3; /* Play 3 times on load */
}

/* ============================================================================
   WhatsApp Button - Shadow Enhancement
   ============================================================================ */

.pxl-whatsapp-button.pxl-whatsapp-shadow {
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.pxl-whatsapp-button.pxl-whatsapp-shadow:hover {
    box-shadow: 0 12px 28px rgba(37, 211, 102, 0.6);
}

/* ============================================================================
   Icon Animation Styles
   ============================================================================ */

/* Rotate Animation */
.pxl-whatsapp-button:hover .pxl-whatsapp-icon-rotate {
    animation: icon-rotate 0.6s ease-in-out;
}

@keyframes icon-rotate {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(-10deg); }
    100% { transform: scale(1.15) rotate(10deg); }
}

/* Wiggle Animation */
.pxl-whatsapp-button:hover .pxl-whatsapp-icon-wiggle {
    animation: icon-wiggle 0.6s ease-in-out;
}

@keyframes icon-wiggle {
    0%, 100% { transform: rotate(0deg); }
    15% { transform: rotate(-15deg); }
    30% { transform: rotate(15deg); }
    45% { transform: rotate(-15deg); }
    60% { transform: rotate(15deg); }
    75% { transform: rotate(-5deg); }
}

/* Pulse Icon Animation */
.pxl-whatsapp-button:hover .pxl-whatsapp-icon-pulse {
    animation: icon-pulse 0.6s ease-in-out;
}

@keyframes icon-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* No Icon Animation */
.pxl-whatsapp-button:hover .pxl-whatsapp-icon-none {
    transform: none;
}

/* Hover animations for default rotate icon */
.pxl-whatsapp-button .pxl-whatsapp-icon-rotate {
    transition: transform 0.3s ease-in-out;
}

.pxl-whatsapp-button:hover .pxl-whatsapp-icon-rotate {
    transform: scale(1.15) rotate(10deg);
}

/* ============================================================================
   Bubble/Tooltip Styles
   ============================================================================ */

.pxl-whatsapp-bubble {
    position: absolute;
    background-color: #333;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transform-origin: center;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Bubble arrow/pointer */
.pxl-whatsapp-bubble::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #333;
    border-radius: 2px;
    transform: rotate(45deg);
}

/* ============================================================================
   Bubble Position Styles
   ============================================================================ */

/* Bubble positioning base - applies to all bubble positions */
.pxl-whatsapp-bubble.pxl-whatsapp-bubble-left {
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
}

.pxl-whatsapp-bubble.pxl-whatsapp-bubble-left::after {
    left: -4px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

/* Bubble on Right */
.pxl-whatsapp-bubble.pxl-whatsapp-bubble-right {
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
}

.pxl-whatsapp-bubble.pxl-whatsapp-bubble-right::after {
    right: -4px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

/* Bubble on Top */
.pxl-whatsapp-bubble.pxl-whatsapp-bubble-top {
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
}

.pxl-whatsapp-bubble.pxl-whatsapp-bubble-top::after {
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

/* Bubble on Bottom */
.pxl-whatsapp-bubble.pxl-whatsapp-bubble-bottom {
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
}

.pxl-whatsapp-bubble.pxl-whatsapp-bubble-bottom::after {
    top: -4px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

/* Show bubble on button hover */
.pxl-whatsapp-button:hover ~ .pxl-whatsapp-bubble {
    opacity: 1;
}

/* ============================================================================
   Bubble Animation Styles
   ============================================================================ */

/* Slide Animation - Initial state (before hover) */
.pxl-whatsapp-bubble.pxl-whatsapp-bubble-slide.pxl-whatsapp-bubble-left {
    transform: translateY(-50%) translateX(-10px);
}

.pxl-whatsapp-bubble.pxl-whatsapp-bubble-slide.pxl-whatsapp-bubble-right {
    transform: translateY(-50%) translateX(10px);
}

.pxl-whatsapp-bubble.pxl-whatsapp-bubble-slide.pxl-whatsapp-bubble-top {
    transform: translateX(-50%) translateY(-10px);
}

.pxl-whatsapp-bubble.pxl-whatsapp-bubble-slide.pxl-whatsapp-bubble-bottom {
    transform: translateX(-50%) translateY(10px);
}

/* Slide Animation - Hover state (animates to final position) */
.pxl-whatsapp-button.pxl-whatsapp-bubble-slide:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-slide.pxl-whatsapp-bubble-left {
    transform: translateY(-50%) translateX(0);
}

.pxl-whatsapp-button.pxl-whatsapp-bubble-slide:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-slide.pxl-whatsapp-bubble-right {
    transform: translateY(-50%) translateX(0);
}

.pxl-whatsapp-button.pxl-whatsapp-bubble-slide:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-slide.pxl-whatsapp-bubble-top {
    transform: translateX(-50%) translateY(0);
}

.pxl-whatsapp-button.pxl-whatsapp-bubble-slide:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-slide.pxl-whatsapp-bubble-bottom {
    transform: translateX(-50%) translateY(0);
}

/* Fade Animation */
.pxl-whatsapp-bubble.pxl-whatsapp-bubble-fade {
    opacity: 0;
}

.pxl-whatsapp-button.pxl-whatsapp-bubble-fade:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-fade {
    opacity: 1;
}

/* Pop Animation - Initial state */
.pxl-whatsapp-bubble.pxl-whatsapp-bubble-pop {
    transform: scale(0.3);
    opacity: 0;
}

/* Pop Animation - Hover state */
.pxl-whatsapp-button.pxl-whatsapp-bubble-pop:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-pop.pxl-whatsapp-bubble-left {
    transform: translateY(-50%) scale(1);
    opacity: 1;
}

.pxl-whatsapp-button.pxl-whatsapp-bubble-pop:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-pop.pxl-whatsapp-bubble-right {
    transform: translateY(-50%) scale(1);
    opacity: 1;
}

.pxl-whatsapp-button.pxl-whatsapp-bubble-pop:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-pop.pxl-whatsapp-bubble-top {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

.pxl-whatsapp-button.pxl-whatsapp-bubble-pop:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-pop.pxl-whatsapp-bubble-bottom {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* Bounce Animation - Initial state */
.pxl-whatsapp-bubble.pxl-whatsapp-bubble-bounce {
    opacity: 0;
}

/* Bounce Animation - Hover state with keyframe animations */
.pxl-whatsapp-button.pxl-whatsapp-bubble-bounce:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-bounce.pxl-whatsapp-bubble-left {
    animation: bubble-bounce-left 0.5s ease-out forwards;
}

.pxl-whatsapp-button.pxl-whatsapp-bubble-bounce:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-bounce.pxl-whatsapp-bubble-right {
    animation: bubble-bounce-right 0.5s ease-out forwards;
}

.pxl-whatsapp-button.pxl-whatsapp-bubble-bounce:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-bounce.pxl-whatsapp-bubble-top {
    animation: bubble-bounce-top 0.5s ease-out forwards;
}

.pxl-whatsapp-button.pxl-whatsapp-bubble-bounce:hover ~ .pxl-whatsapp-bubble.pxl-whatsapp-bubble-bounce.pxl-whatsapp-bubble-bottom {
    animation: bubble-bounce-bottom 0.5s ease-out forwards;
}

@keyframes bubble-bounce-left {
    0% { transform: translateY(-50%) translateX(-20px); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateY(-50%) translateX(0); opacity: 1; }
}

@keyframes bubble-bounce-right {
    0% { transform: translateY(-50%) translateX(20px); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateY(-50%) translateX(0); opacity: 1; }
}

@keyframes bubble-bounce-top {
    0% { transform: translateX(-50%) translateY(-20px); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes bubble-bounce-bottom {
    0% { transform: translateX(-50%) translateY(20px); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ============================================================================
   Animation Keyframes (Hover Effects)
   ============================================================================ */

@keyframes pulse-effect {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

@keyframes bounce-effect {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-6px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-3px); }
}

/* ============================================================================
   WhatsApp Button - Inline/Shortcode Placement
   ============================================================================ */

/* When button is placed inline (via shortcode/function) */
.pxl-whatsapp-button.pxl-whatsapp-inline {
    position: relative;
    bottom: auto;
    right: auto;
    z-index: auto;
}

/* ============================================================================
   Reduced Motion Support (Accessibility)
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .pxl-whatsapp-button,
    .pxl-whatsapp-button i,
    .pxl-whatsapp-button .pxl-whatsapp-text {
        transition: none;
    }
    
    .pxl-whatsapp-button:hover {
        transform: none;
    }
    
    .pxl-whatsapp-button:hover i {
        transform: none;
    }
}

/* ============================================================================
   Dark Mode Support
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    .pxl-whatsapp-button {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.25);
    }
    
    .pxl-whatsapp-button:hover {
        box-shadow: 0 8px 20px rgba(37, 211, 102, 0.35);
    }
}
