/* ============================================================
   SUPPORT WIDGET - Menu unificato WhatsApp + Tawk.to
   ============================================================ */

.support-widget {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 99998;
    font-family: 'Inter', sans-serif;
}

/* ============ PULSANTE HAMBURGER ============ */
.support-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #b300ff, #800080);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(179, 0, 255, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    z-index: 2;
}

.support-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 25px rgba(179, 0, 255, 0.55);
}

.support-toggle .bars {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 24px;
    height: 18px;
    justify-content: center;
    position: relative;
}

.support-toggle .bars span {
    display: block;
    width: 100%;
    height: 2.5px;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Animazione: quando aperto, le barre diventano una X */
.support-widget.open .support-toggle .bars span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.support-widget.open .support-toggle .bars span:nth-child(2) {
    opacity: 0;
}

.support-widget.open .support-toggle .bars span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* ============ MENU OPZIONI ============ */
.support-menu {
    position: absolute;
    bottom: 75px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.support-widget.open .support-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ============ BOTTONE OPZIONE ============ */
.support-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px 12px 14px;
    border-radius: 50px;
    text-decoration: none;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
    min-width: 180px;
    justify-content: flex-start;
}

.support-option:hover {
    transform: translateX(-4px) scale(1.03);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.support-option i {
    font-size: 1.3rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    flex-shrink: 0;
}

/* WhatsApp */
.support-option.whatsapp {
    background: linear-gradient(135deg, #25d366, #128c7e);
}

/* Chat live (Tawk.to) */
.support-option.chat {
    background: linear-gradient(135deg, #b300ff, #800080);
}

/* ============ BADGE "ONLINE" ============ */
.support-option.chat::after {
    content: 'ONLINE';
    margin-left: auto;
    font-size: 0.65rem;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    letter-spacing: 0.5px;
}

/* ============ EFFETTO PULSE SUL PULSANTE ============ */
.support-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(179, 0, 255, 0.4);
    animation: supportPulse 2.5s infinite;
    z-index: -1;
}

@keyframes supportPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    70% {
        transform: scale(1.5);
        opacity: 0;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.support-widget.open .support-toggle::before {
    animation: none;
}

/* ============ RESPONSIVE MOBILE ============ */
@media (max-width: 768px) {
    .support-widget {
        bottom: 18px;
        right: 18px;
    }

    .support-toggle {
        width: 54px;
        height: 54px;
    }

    .support-toggle .bars {
        width: 22px;
        height: 16px;
    }

    .support-option {
        font-size: 0.9rem;
        padding: 11px 16px 11px 12px;
        min-width: 165px;
    }

    .support-option i {
        font-size: 1.15rem;
        width: 28px;
        height: 28px;
    }

    .support-menu {
        bottom: 68px;
    }
}

/* ============ NASCONDI IL WIDGET DI TAWK.TO NATIVO ============ */
/* Tawk.to crea un iframe con id 'tawk-chat-bubble' o simile.
   Lo nascondiamo perché useremo il nostro pulsante. */
iframe[title="chat widget"],
iframe[id*="tawk"],
.tawk-min-container {
    display: none !important;
}

/* ============================================================
   FIX: Assicura che il widget Mako sia sempre sopra Tawk.to
   ============================================================ */

.support-widget {
    z-index: 2147483000 !important; /* Alto ma non massimo */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Nascondi in modo aggressivo qualsiasi iframe di Tawk.to 
   che potrebbe apparire come icona flottante */
iframe[id*="tawk"][style*="bottom"],
iframe[title*="chat"][style*="bottom"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.support-toggle {
    pointer-events: auto !important;
    position: relative;
}

.support-menu {
    z-index: 2147483001 !important;
}

.support-widget[style*="visibility: hidden"] {
    pointer-events: none !important;
}