:root {
    /* Colores base */
    --wa-green: #25D366;
    --wa-green-dark: #1EBE57;
    --wa-green-press: #1f9f4e; /* para el botón cerrar */
    --wa-white: #ffffff;
    --wa-text-dark: #222;

    /* Medidas y layout */
    --wa-spacing: 18px;          /* distancia a los bordes */
    --wa-btn-size: 60px;         /* tamaño del ícono flotante */

    /* Panel principal */
    --wa-panel-width: 380px;
    --wa-panel-max-h: 500px;
    --wa-card-radius: 22px;
    --wa-shadow: 0 18px 48px rgba(0,0,0,.18), 0 10px 22px rgba(0,0,0,.12);

    /* Teaser (globito previo) */
    --wa-teaser-gap: 12px;       /* separación entre teaser e ícono */
    --wa-teaser-shadow: 0 10px 16px rgba(0,0,0,.14);
}

/* Contenedor anclado a la esquina */
.wa-widget {
    position: fixed;
    right: calc(env(safe-area-inset-right, 0px) + var(--wa-spacing));
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--wa-spacing));
    z-index: 1085;
}

/* Ícono flotante WhatsApp */
.wa-btn {
    position: relative;
    width: var(--wa-btn-size);
    height: var(--wa-btn-size);
    border-radius: 999px;
    background: var(--wa-green);
    color: var(--wa-white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 12px 26px rgba(0,0,0,.18), 0 6px 12px rgba(0,0,0,.12);
    transition: background-color .2s ease, filter .2s ease; /* sin movimiento */
}
.wa-btn .bi, .wa-btn .fa { font-size: 1.8rem; color: currentColor; }
/* Oscurecer progresivo al hover (antes de abrir) */
.wa-btn:hover { filter: brightness(.93); }
/* Ocultar botón cuando el chat está abierto */
.wa-widget.is-open .wa-btn { display: none; }

/* Teaser: ¿Necesitas ayuda? */
.wa-teaser {
    position: absolute;
    right: calc(var(--wa-btn-size) + var(--wa-teaser-gap));
    bottom: 8px; /* centrado aproximado al botón */
    max-width: 260px;
    background: #fff;
    color: var(--wa-text-dark);
    border: 1px solid #eef3ef;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: .98rem;
    line-height: 1.3;
    box-shadow: var(--wa-teaser-shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}
.wa-teaser::after {
    /* cola horizontal a la derecha, apuntando al ícono */
    content: "";
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    background: #fff;
    border-right: 1px solid #eef3ef;
    border-top: 1px solid #eef3ef;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.wa-widget.show-teaser .wa-teaser { opacity: 1; pointer-events: auto; }
/* No mostrar teaser si el chat ya está abierto */
.wa-widget.is-open .wa-teaser { display: none; }

/* Panel tipo Joinchat */
.wa-preview {
    position: absolute;
    right: 0;
    bottom: 0;
    width: var(--wa-panel-width);
    max-height: var(--wa-panel-max-h);
    background: var(--wa-white);
    border-radius: var(--wa-card-radius);
    box-shadow: var(--wa-shadow);
    overflow: hidden;
    opacity: 0;                 /* oculto por defecto */
    pointer-events: none;
}
/* Al abrir: animación corta de aparición (opuesto a desvanecimiento) */
.wa-widget.is-open .wa-preview {
    opacity: 1;
    pointer-events: auto;
    animation: wa-appear .14s ease-out both;
}
@keyframes wa-appear {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Header verde */
.wa-header {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 14px 52px 14px 14px;
    background: linear-gradient(180deg, var(--wa-green) 0%, var(--wa-green-dark) 100%);
    color: var(--wa-white);
}
.wa-logo {
    width: 30px; height: 30px; border-radius: 999px;
    background: rgba(255,255,255,.22);
    display: inline-flex; align-items: center; justify-content: center;
}
.wa-logo .bi { color: #fff; font-size: 1.1rem; }
.wa-title { font-weight: 700; font-size: 1.02rem; letter-spacing: .2px; }

/* Botón cerrar (sin movimiento; oscurecer al hover) */
.wa-close {
    position: absolute;
    right: 10px; top: 10px;
    width: 32px; height: 32px;
    border: 0; border-radius: 999px;
    background: var(--wa-green-press);
    color: #fff;
    display: grid; place-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,.12);
    cursor: pointer;
    transition: filter .15s ease;
}
.wa-close .bi { font-size: .9rem; }
.wa-close:hover { filter: brightness(.92); }

/* Cuerpo con burbuja de saludo SIN línea separadora inferior */
.wa-body {
    padding: 18px 16px;
    background:
            radial-gradient(24px 24px at 24px 24px, rgba(37,211,102,0.06), transparent 60%) 0 0/48px 48px,
            linear-gradient(#fff,#fff);
    overflow: auto;
}
/* Burbuja con cola horizontal a la IZQUIERDA (como pediste) */
.wa-bubble {
    display: inline-block;
    max-width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #eef3ef;
    border-radius: 22px;
    color: var(--wa-text-dark);
    font-size: .98rem;
    line-height: 1.4;
    box-shadow: 0 8px 18px rgba(0,0,0,.08);
    position: relative;
    margin-left: 18px; /* espacio para la cola izquierda */
}
.wa-bubble::after {
    content: "";
    position: absolute;
    left: -8px;                 /* cola a la izquierda */
    top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    background: #fff;
    border-left: 1px solid #eef3ef;
    border-top: 1px solid #eef3ef;
    clip-path: polygon(0 50%, 100% 0, 100% 100%); /* abre hacia la izquierda */
}

/* Footer con CTA (SIN separador: quitamos la línea) */
.wa-footer {
    padding: 12px 14px 16px;
    /* border-top: none; */  /* importante: sin línea */
    background: #fff;
    display: flex; justify-content: flex-end;
}

/* CTA “Abrir chat”: iluminar suavemente al hover, sin movimiento */
.wa-cta {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 12px 18px;
    border-radius: 999px; border: 0; cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--wa-green), var(--wa-green-dark));
    box-shadow: 0 12px 22px rgba(37,211,102,.22);
    font-weight: 700;
    transition: filter .15s ease; /* sin translate/scale */
}
.wa-cta .bi { font-size: 1.05rem; }
.wa-cta:hover { filter: brightness(1.06); }

/* Preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    .wa-btn, .wa-cta, .wa-close { transition: none; }
    .wa-widget.is-open .wa-preview { animation: none; }
}

/* Responsive mínimo */
@media (max-width: 420px) {
    :root {
        --wa-spacing: 14px;
        --wa-panel-width: calc(100vw - 28px);
        --wa-panel-max-h: 520px;
    }
}
