/* ============================================
   Burbuja flotante de WhatsApp (global).
   Render condicional desde _WhatsAppBubble.cshtml.
   z-index < 1050 (modales Bootstrap) y > 1030 (sticky/navbar).
   ============================================ */
.wa-bubble {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1040;
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #25D366;
    color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    text-decoration: none;
    transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
    animation: wa-bubble-pulse 2.4s ease-in-out infinite;
}

.wa-bubble:hover,
.wa-bubble:focus-visible {
    background-color: #128C7E;
    color: #ffffff;
    transform: scale(1.06);
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.wa-bubble:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 2px;
}

.wa-bubble__icon {
    width: 32px;
    height: 32px;
    pointer-events: none;
}

.wa-bubble__tooltip {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background-color: #202c33;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.wa-bubble__tooltip::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #202c33;
}

.wa-bubble:hover .wa-bubble__tooltip,
.wa-bubble:focus-visible .wa-bubble__tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

@keyframes wa-bubble-pulse {
    0%, 100% {
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(37, 211, 102, 0.55);
    }
    50% {
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 0 14px rgba(37, 211, 102, 0);
    }
}

/* Si la barra promocional bbar está visible, subir la burbuja.
   Soporta tanto la clase manual en body como la detección automática vía :has(). */
body.bbar-visible .wa-bubble,
body:has(.promo-bar) .wa-bubble {
    bottom: calc(20px + var(--bbar-height, 56px));
}

/* Mobile */
@media (max-width: 576px) {
    .wa-bubble {
        right: 16px;
        bottom: 16px;
        width: 52px;
        height: 52px;
    }

    .wa-bubble__icon {
        width: 28px;
        height: 28px;
    }

    .wa-bubble__tooltip {
        display: none;
    }

    /* En mobile la promo-bar suele apilar texto + CTA y ocupa más alto. */
    body.bbar-visible .wa-bubble,
    body:has(.promo-bar) .wa-bubble {
        bottom: calc(16px + var(--bbar-height, 90px));
    }
}

/* Respetar preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    .wa-bubble {
        animation: none;
        transition: none;
    }

    .wa-bubble:hover,
    .wa-bubble:focus-visible {
        transform: none;
    }
}

/* Print: ocultar */
@media print {
    .wa-bubble {
        display: none !important;
    }
}

/* Visibilidad por dispositivo (controlada desde WhatsAppOptions) */
@media (max-width: 575.98px) {
    .wa-bubble--desktop-only {
        display: none !important;
    }
}

@media (min-width: 576px) {
    .wa-bubble--mobile-only {
        display: none !important;
    }
}
