.jbwa-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --jbwa-verde: #00BB43;
    --jbwa-verde-osc: #009536;
}

/* Botón flotante */

.jbwa-boton {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--jbwa-verde), var(--jbwa-verde-osc));
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 149, 54, .38);
    transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .25s ease;
    padding: 0;
}

.jbwa-boton::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--jbwa-verde);
    opacity: .55;
    animation: jbwa-pulso 2.4s ease-out infinite;
    z-index: -1;
}

.jbwa-boton:hover {
    transform: scale(1.08) rotate(-4deg);
    box-shadow: 0 8px 26px rgba(0, 149, 54, .46);
}

.jbwa-boton[aria-expanded="true"] {
    transform: scale(.94);
}

.jbwa-boton svg {
    width: 38px;
    height: 38px;
    fill: #fff;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .15));
}

@keyframes jbwa-pulso {
    0% {
        transform: scale(1);
        opacity: .45;
    }
    75% {
        transform: scale(1.7);
        opacity: 0;
    }
    100% {
        transform: scale(1.7);
        opacity: 0;
    }
}

/* Ventana del chat */

.jbwa-popup {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 330px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .28), 0 0 0 1px rgba(0, 0, 0, .04);
    opacity: 0;
    transform: translateY(20px) scale(.96);
    transform-origin: bottom right;
    transition: opacity .25s cubic-bezier(.16, 1, .3, 1), transform .25s cubic-bezier(.16, 1, .3, 1);
    pointer-events: none;
}

.jbwa-popup[hidden] {
    display: block;
}

.jbwa-popup--visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */

.jbwa-popup__header {
    background: linear-gradient(120deg, var(--jbwa-verde-osc), var(--jbwa-verde));
    color: #fff;
    padding: 16px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.jbwa-popup__perfil {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.jbwa-avatar {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    display: flex;
    align-items: center;
    justify-content: center;
}

.jbwa-avatar svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

.jbwa-popup__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.jbwa-popup__nombre {
    font-size: 15px;
    font-weight: 600;
}

.jbwa-popup__estado {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: rgba(255, 255, 255, .85);
}

.jbwa-punto {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7CFFA0;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .25);
}

.jbwa-popup__cerrar {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    border: none;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, transform .2s ease;
}

.jbwa-popup__cerrar:hover {
    background: rgba(255, 255, 255, .26);
    transform: rotate(90deg);
}

/* Cuerpo */

.jbwa-popup__body {
    background: #f0f2f5 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='%23000000' fill-opacity='0.025'%3E%3Ccircle cx='6' cy='6' r='2'/%3E%3Ccircle cx='30' cy='6' r='2'/%3E%3Ccircle cx='54' cy='6' r='2'/%3E%3Ccircle cx='18' cy='18' r='2'/%3E%3Ccircle cx='42' cy='18' r='2'/%3E%3Ccircle cx='6' cy='30' r='2'/%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3Ccircle cx='54' cy='30' r='2'/%3E%3Ccircle cx='18' cy='42' r='2'/%3E%3Ccircle cx='42' cy='42' r='2'/%3E%3Ccircle cx='6' cy='54' r='2'/%3E%3Ccircle cx='30' cy='54' r='2'/%3E%3Ccircle cx='54' cy='54' r='2'/%3E%3C/g%3E%3C/svg%3E");
    padding: 18px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.jbwa-burbuja {
    position: relative;
    align-self: flex-start;
    max-width: 88%;
    background: #fff;
    border-radius: 14px;
    border-top-left-radius: 3px;
    padding: 11px 14px;
    font-size: 14px;
    line-height: 1.45;
    color: #111b21;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
    animation: jbwa-aparecer .3s ease both .1s;
}

.jbwa-burbuja::before {
    content: "";
    position: absolute;
    top: 0;
    left: -7px;
    width: 12px;
    height: 14px;
    background: #fff;
    clip-path: polygon(100% 0, 100% 100%, 0 0);
}

@keyframes jbwa-aparecer {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Composer */

.jbwa-composer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Selector calificado con .jbwa-widget para ganarle en especificidad al
   reset del tema (input[type=text]{border:1px solid #666;border-radius:3px})
   sin recurrir a !important. */
.jbwa-widget .jbwa-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    box-sizing: border-box;
    border: none;
    background: #fff;
    border-radius: 14px;
    border-top-left-radius: 3px;
    padding: 11px 14px;
    font-size: 14px;
    line-height: 1.45;
    color: #111b21;
    outline: none;
    font-family: inherit;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
    transition: box-shadow .2s ease;
}

.jbwa-widget .jbwa-input::placeholder {
    color: #8696a0;
}

.jbwa-widget .jbwa-input:focus {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 3px rgba(0, 187, 67, .22);
}

.jbwa-enviar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(120deg, var(--jbwa-verde), var(--jbwa-verde-osc));
    color: #fff;
    border: none;
    border-radius: 22px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 149, 54, .3);
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.jbwa-enviar:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 149, 54, .38);
}

.jbwa-enviar:active {
    transform: translateY(0);
}

.jbwa-enviar svg {
    width: 15px;
    height: 15px;
    fill: #fff;
}

@media (max-width: 480px) {
    .jbwa-widget {
        bottom: 16px;
        right: 16px;
    }

    .jbwa-boton {
        width: 56px;
        height: 56px;
    }

    .jbwa-popup {
        width: calc(100vw - 32px);
        right: -8px;
        bottom: 70px;
    }
}
