.floating-menu {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    -webkit-transform: translateY(-50%);
    -moz-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
    /* Miglioramenti per mobile */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Force hardware acceleration */
    transform: translateY(-50%) translateZ(0);
    -webkit-transform: translateY(-50%) translateZ(0);
}

.contact-btn {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    border: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.contact-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.phone-btn {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.5), rgba(69, 160, 73, 0.5));
}

.phone-btn:hover {
    background: linear-gradient(135deg, #45a049, #3d8b40);
}

.whatsapp-btn {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.5), rgba(32, 179, 88, 0.5));
}

.whatsapp-btn:hover {
    background: linear-gradient(135deg, #20b358, #1a9644);
}

.contact-btn svg {
    width: 22px;
    height: 22px;
    fill: white;
    transition: all 0.3s ease;
}

.contact-btn:hover svg {
    transform: scale(1.1) !important;
}

/* Tooltip */
.contact-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.contact-btn::after {
    content: '';
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid rgba(0, 0, 0, 0.8);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.contact-btn:hover::before,
.contact-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Animazione pulsante */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

@keyframes phone-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.whatsapp-btn {
    animation: pulse 2s infinite;
}

.phone-btn {
    animation: phone-pulse 2s infinite 1s;
}

/* Responsive e ottimizzazioni mobile */
@media (max-width: 768px) {
    .floating-menu {
        right: 15px;
        /* Gestione viewport dinamico iOS */
        top: 50vh;
        transform: translateY(-50%) translateZ(0);
        -webkit-transform: translateY(-50%) translateZ(0);
    }
   
    .contact-btn {
        width: 44px;
        height: 44px;
    }
   
    .contact-btn svg {
        width: 20px;
        height: 20px;
    }

    /* Nasconde tooltip su mobile per evitare problemi */
    .contact-btn::before,
    .contact-btn::after {
        display: none;
    }
}

/* Fix specifico per iOS Safari */
@supports (-webkit-appearance: none) and (orientation: portrait) {
    .floating-menu {
        position: fixed;
        top: 50vh;
        transform: translateY(-50%) translate3d(0, 0, 0);
        -webkit-transform: translateY(-50%) translate3d(0, 0, 0);
    }
}