/* ===== VIAÇÃO CEDRO - WHATSAPP FLOAT BUTTON ===== */

/* ===== WHATSAPP BUTTON VARIABLES ===== */
:root {
    /* WhatsApp specific colors */
    --whatsapp-primary: var(--secondary-color); /* #43a047 - Verde do sistema */
    --whatsapp-hover: #2e7d32; /* Verde mais escuro para hover */
    --whatsapp-shadow: rgba(67, 160, 71, 0.3);
    --whatsapp-shadow-hover: rgba(67, 160, 71, 0.5);
    
    /* Button dimensions */
    --whatsapp-size-desktop: 60px;
    --whatsapp-size-mobile: 56px;
    --whatsapp-icon-size-desktop: 32px;
    --whatsapp-icon-size-mobile: 28px;
    
    /* Positioning */
    --whatsapp-bottom-desktop: 30px;
    --whatsapp-right-desktop: 30px;
    --whatsapp-bottom-mobile: 20px;
    --whatsapp-right-mobile: 20px;
    
    /* Z-index */
    --whatsapp-z-index: 1000;
}

/* ===== MAIN BUTTON STYLES ===== */
.whatsapp-float {
    position: fixed;
    bottom: var(--whatsapp-bottom-desktop);
    right: var(--whatsapp-right-desktop);
    width: var(--whatsapp-size-desktop);
    height: var(--whatsapp-size-desktop);
    background-color: var(--whatsapp-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    z-index: var(--whatsapp-z-index);
    transition: all var(--animation-duration-normal) var(--animation-easing-ease-out);
    cursor: pointer;
    
    /* Accessibility */
    outline: none;
    
    /* Performance optimization */
    will-change: transform, box-shadow;
    
    /* Prevent text selection */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ===== HOVER AND FOCUS STATES ===== */
.whatsapp-float:hover {
    background-color: var(--whatsapp-hover);
    transform: scale(1.1);
    box-shadow: 0 1rem 3rem var(--whatsapp-shadow-hover);
    text-decoration: none;
}

.whatsapp-float:focus {
    background-color: var(--whatsapp-hover);
    transform: scale(1.1);
    box-shadow: 0 1rem 3rem var(--whatsapp-shadow-hover), 
                0 0 0 3px rgba(67, 160, 71, 0.4);
    outline: none;
}

.whatsapp-float:active {
    transform: scale(0.95);
    transition-duration: var(--animation-duration-fast);
}

/* ===== ICON STYLES ===== */
.whatsapp-icon {
    width: var(--whatsapp-icon-size-desktop);
    height: var(--whatsapp-icon-size-desktop);
    fill: var(--white);
    transition: transform var(--animation-duration-normal) var(--animation-easing-ease-out);
}

.whatsapp-float:hover .whatsapp-icon {
    transform: scale(1.1);
}

/* ===== TOOLTIP STYLES ===== */
.whatsapp-tooltip {
    position: absolute;
    right: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--text-primary);
    color: var(--white);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--animation-duration-normal) var(--animation-easing-ease-out);
    pointer-events: none;
    z-index: calc(var(--whatsapp-z-index) + 1);
    
    /* Arrow */
    &::after {
        content: '';
        position: absolute;
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        border: 6px solid transparent;
        border-left-color: var(--text-primary);
    }
}

.whatsapp-float:hover .whatsapp-tooltip,
.whatsapp-float:focus .whatsapp-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(-5px);
}

/* ===== PULSE ANIMATION ===== */
.whatsapp-float::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background-color: var(--whatsapp-primary);
    animation: whatsapp-pulse 2s infinite;
    z-index: -1;
}

@keyframes whatsapp-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet styles */
@media (max-width: 768px) {
    .whatsapp-float {
        width: var(--whatsapp-size-mobile);
        height: var(--whatsapp-size-mobile);
        bottom: var(--whatsapp-bottom-mobile);
        right: var(--whatsapp-right-mobile);
    }
    
    .whatsapp-icon {
        width: var(--whatsapp-icon-size-mobile);
        height: var(--whatsapp-icon-size-mobile);
    }
    
    .whatsapp-tooltip {
        font-size: 13px;
        padding: 6px 10px;
        right: calc(100% + 12px);
    }
}

/* Mobile styles */
@media (max-width: 480px) {
    .whatsapp-float {
        bottom: 15px;
        right: 15px;
    }
    
    /* Hide tooltip on very small screens to avoid overflow */
    .whatsapp-tooltip {
        display: none;
    }
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */
@media (prefers-contrast: high) {
    .whatsapp-float {
        border: 2px solid var(--white);
    }
    
    .whatsapp-float:focus {
        border-color: var(--text-primary);
        box-shadow: 0 0 0 3px var(--white), 
                    0 0 0 6px var(--text-primary);
    }
}

/* ===== REDUCED MOTION SUPPORT ===== */
@media (prefers-reduced-motion: reduce) {
    .whatsapp-float {
        transition: none;
    }
    
    .whatsapp-float::before {
        animation: none;
    }
    
    .whatsapp-float:hover {
        transform: none;
    }
    
    .whatsapp-icon {
        transition: none;
    }
    
    .whatsapp-tooltip {
        transition: opacity var(--animation-duration-fast) ease;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .whatsapp-float {
        display: none !important;
    }
}

/* ===== DARK MODE SUPPORT (Future-proofing) ===== */
@media (prefers-color-scheme: dark) {
    .whatsapp-tooltip {
        background-color: var(--gray-800);
        color: var(--white);
    }
    
    .whatsapp-tooltip::after {
        border-left-color: var(--gray-800);
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

/* Focus visible for keyboard navigation */
.whatsapp-float:focus-visible {
    box-shadow: 0 1rem 3rem var(--whatsapp-shadow-hover), 
                0 0 0 3px rgba(67, 160, 71, 0.6);
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

/* GPU acceleration for smooth animations */
.whatsapp-float {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Contain layout and paint for better performance */
.whatsapp-float {
    contain: layout style paint;
}