/* Serigest WhatsApp — wrapper + pulsante + caption */

.sgw-float-wrap {
    position: fixed;
    z-index: 99990;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: min(200px, calc(100vw - 40px));
    pointer-events: none;
}

.sgw-float-wrap > * {
    pointer-events: auto;
}

/* Testo sopra il pulsante */
.sgw-float__caption {
    display: block;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    color: #111;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.06);
    letter-spacing: 0.01em;
}

/* Pulsante tondo */
.sgw-float {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(145deg, #2fe06d 0%, #25d366 45%, #1ebe5d 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.45), 0 2px 6px rgba(0, 0, 0, 0.12);
    text-decoration: none !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    flex-shrink: 0;
}

.sgw-float:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 22px rgba(37, 211, 102, 0.5), 0 3px 10px rgba(0, 0, 0, 0.15);
    color: #fff;
}

.sgw-float:focus {
    outline: 3px solid rgba(37, 211, 102, 0.45);
    outline-offset: 3px;
}

.sgw-float__icon {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

/* Icona bianca nitida sulla bolla verde */
.sgw-float__svg {
    display: block;
    width: 34px;
    height: 34px;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

/* Alone luminoso molto leggero (solo se pulse attivo) */
.sgw-float__glow {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.45);
    z-index: 1;
    pointer-events: none;
}

.sgw-float-wrap--pulse .sgw-float {
    animation: sgw-soft-blink 3.2s ease-in-out infinite;
}

.sgw-float-wrap--pulse .sgw-float__glow {
    animation: sgw-soft-ring 3.2s ease-out infinite;
}

/* Lampeggio delicato: luminosità, non invasivo */
@keyframes sgw-soft-blink {
    0%,
    100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.08);
    }
}

@keyframes sgw-soft-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.35);
        opacity: 1;
    }
    70% {
        box-shadow: 0 0 0 10px rgba(37, 211, 102, 0);
        opacity: 0.6;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
        opacity: 0;
    }
}

/* ── Posizioni (sul wrapper) ── */
.sgw-float-wrap--bottom-right {
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
    right: max(20px, env(safe-area-inset-right, 0px));
    left: auto;
    top: auto;
}

.sgw-float-wrap--bottom-left {
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
    left: max(20px, env(safe-area-inset-left, 0px));
    right: auto;
    top: auto;
}

.sgw-float-wrap--middle-right {
    top: 50%;
    right: max(20px, env(safe-area-inset-right, 0px));
    left: auto;
    bottom: auto;
    transform: translateY(-50%);
}

.sgw-float-wrap--middle-left {
    top: 50%;
    left: max(20px, env(safe-area-inset-left, 0px));
    right: auto;
    bottom: auto;
    transform: translateY(-50%);
}

@media (max-width: 600px) {
    /* Più attaccato al bordo destro (desktop resta a 20px) */
    .sgw-float-wrap--bottom-right,
    .sgw-float-wrap--middle-right {
        right: max(8px, env(safe-area-inset-right, 0px));
    }

    .sgw-float__caption {
        font-size: 10px;
        padding: 5px 8px;
    }

    .sgw-float {
        width: 56px;
        height: 56px;
        margin-bottom: 50px;
        margin-right: 6px;
    }

    .sgw-float__svg {
        width: 30px;
        height: 30px;
    }
}
