/* WhatsApp Bubble Pro v7.1 */

/* ── WRAP: ancla fija, referencia de posicionamiento para burbuja y tooltip ── */
.wbp-wrap {
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    /* SIN width/height para que el botón sea el único elemento en flujo */
}
.wbp-pos-right { right: 24px; }
.wbp-pos-left  { left:  24px; }

/* ── BOTÓN FLOTANTE: es el padre de posicionamiento para burbuja y tooltip ── */
.wbp-btn {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--wbp-color, #25D366);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37,211,102,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
    outline: none;
}
.wbp-btn:hover {
    background: var(--wbp-color-hover, var(--wbp-color, #25D366));
    filter: var(--wbp-color-hover, none) brightness(1);
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(37,211,102,.55);
}
.wbp-btn:focus-visible {
    outline: 3px solid var(--wbp-color, #25D366);
    outline-offset: 3px;
}

/* Pulso de atención */
.wbp-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--wbp-color, #25D366);
    opacity: .22;
    animation: wbp-pulse 2.4s ease-out infinite;
    pointer-events: none;
}
@keyframes wbp-pulse {
    0%   { transform: scale(1);   opacity: .22; }
    70%  { transform: scale(1.6); opacity: 0;   }
    100% { transform: scale(1.6); opacity: 0;   }
}

/* Íconos del botón */
.wbp-icon-wa,
.wbp-icon-close {
    position: absolute;
    width: 46px;
    height: 46px;
    transition: opacity .2s, transform .25s cubic-bezier(.34,1.56,.64,1);
}
.wbp-icon-close {
    width: 22px;
    height: 22px;
    opacity: 0;
    transform: rotate(-90deg) scale(.6);
}
.wbp-btn--open .wbp-icon-wa {
    opacity: 0;
    transform: rotate(90deg) scale(.6);
}
.wbp-btn--open .wbp-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ── TOOLTIP: anclado al botón ── */
.wbp-tooltip {
    position: fixed;
    bottom: 96px; /* igual que la burbuja cuando está cerrada */
    right: 24px;
    background: #fff;
    color: #222;
    font-size: 13px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.wbp-pos-left .wbp-tooltip {
    right: auto;
    left: 24px;
}

/* ── BURBUJA: anclada al botón, abre hacia arriba ── */
.wbp-bubble {
    position: fixed;
    bottom: 16px;  /* arranca casi desde el mismo nivel que el botón para taparlo */
    right: 24px;
    width: 360px;
    background: #f0f0f0;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    overflow: hidden;
    z-index: 100000; /* encima del botón (99999) */
    /* Estado cerrado */
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px) scale(.96);
    transform-origin: bottom right;
    transition: opacity .25s ease, transform .3s cubic-bezier(.34,1.56,.64,1);
}

.wbp-pos-left .wbp-bubble {
    right: auto;
    left: 24px;
    transform-origin: bottom left;
}
/* Estado abierto */
.wbp-bubble--open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Header verde */
.wbp-bubble-header {
    background: var(--wbp-color, #25D366);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.wbp-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wbp-header-name {
    flex: 1;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.01em;
}

/* Botón X dentro del header */
.wbp-close {
    background: rgba(255,255,255,.2);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s;
    flex-shrink: 0;
}
.wbp-close:hover { background: rgba(255,255,255,.35); }

/* Cuerpo: fondo estilo WhatsApp */
.wbp-bubble-body {
    padding: 16px;
    background: #ece5dd;
    min-height: 72px;
}
.wbp-message {
    background: #fff;
    border-radius: 0 12px 12px 12px;
    padding: 10px 14px;
    display: inline-block;
    max-width: 90%;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
    position: relative;
    animation: wbp-msg-in .35s cubic-bezier(.34,1.56,.64,1) both;
}
/* Triángulo del globo */
.wbp-message::before {
    content: '';
    position: absolute;
    top: 0; left: -8px;
    border: 8px solid transparent;
    border-right-color: #fff;
    border-top-color: #fff;
}
.wbp-message p {
    margin: 0;
    font-size: 14px;
    color: #303030;
    line-height: 1.5;
}
@keyframes wbp-msg-in {
    from { opacity: 0; transform: translateX(-6px) scale(.97); }
    to   { opacity: 1; transform: translateX(0)   scale(1);   }
}

/* Footer */
.wbp-bubble-footer {
    background: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: flex-end;
}

/* Botón "Contactar" con ícono avión */
.wbp-send-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--wbp-color, #25D366);
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    transition: filter .15s, transform .15s;
    box-sizing: border-box;
}
.wbp-send-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

/* Ícono avión con animación */
.wbp-send-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
.wbp-plane {
    animation: wbp-fly 1.6s ease-in-out infinite;
}
@keyframes wbp-fly {
    0%   { transform: translate(0, 0) rotate(0deg);   opacity: 1; }
    40%  { transform: translate(5px, -5px) rotate(-15deg); opacity: .6; }
    50%  { transform: translate(8px, -8px) rotate(-20deg); opacity: 0; }
    51%  { transform: translate(-6px, 6px) rotate(-20deg); opacity: 0; }
    100% { transform: translate(0, 0) rotate(0deg);   opacity: 1; }
}

/* ── RESPONSIVE ── */
@media (max-width: 420px) {
    .wbp-bubble  { width: calc(100vw - 32px); right: 16px; bottom: 16px; }
    .wbp-pos-left .wbp-bubble { left: 16px; right: auto; }
    .wbp-pos-right { right: 16px; }
    .wbp-pos-left  { left:  16px; }
    .wbp-wrap      { bottom: 16px; }
    .wbp-tooltip   { bottom: 96px; right: 16px; }
    .wbp-pos-left .wbp-tooltip { left: 16px; right: auto; }
}
