.esfera-whatsapp-chat,
.esfera-whatsapp-widget {
    --esfera-whatsapp-green: #25d366;
    --esfera-whatsapp-blue: #006396;
    --esfera-whatsapp-bottom: var(--esfera-whatsapp-bottom-desktop, 20px);
    --esfera-whatsapp-side: var(--esfera-whatsapp-side-desktop, 20px);
    --esfera-whatsapp-size: var(--esfera-whatsapp-size-desktop, 58px);
    box-sizing: border-box;
    font-family: inherit;
    -webkit-font-smoothing: antialiased;
}

.esfera-whatsapp-chat {
    position: fixed;
    bottom: calc(var(--esfera-whatsapp-bottom) + env(safe-area-inset-bottom, 0px));
    z-index: var(--esfera-whatsapp-z-index, 990);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--esfera-whatsapp-size);
    box-sizing: border-box;
    margin: 0;
    border: 0;
    border-radius: 9999px;
    background: var(--esfera-whatsapp-green);
    color: #fff !important;
    box-shadow: 0 8px 24px rgb(0 0 0 / 24%);
    float: none;
    font: inherit;
    font-weight: 700;
    letter-spacing: normal;
    line-height: 1;
    text-align: center;
    text-decoration: none !important;
    text-transform: none;
    vertical-align: middle;
    opacity: 1;
    visibility: visible;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

.esfera-whatsapp-chat[hidden],
.esfera-whatsapp-widget[hidden],
.esfera-whatsapp-widget__panel[hidden],
.esfera-whatsapp-widget__typing[hidden],
.esfera-whatsapp-widget__content[hidden] {
    display: none !important;
}

.esfera-whatsapp-chat--right {
    right: calc(var(--esfera-whatsapp-side) + env(safe-area-inset-right, 0px));
    left: auto;
}

.esfera-whatsapp-chat--left {
    right: auto;
    left: calc(var(--esfera-whatsapp-side) + env(safe-area-inset-left, 0px));
}

.esfera-whatsapp-chat--icon-only {
    width: var(--esfera-whatsapp-size);
    max-width: var(--esfera-whatsapp-size);
    padding: 0;
}

.esfera-whatsapp-chat--with-text {
    gap: 10px;
    min-width: var(--esfera-whatsapp-size);
    max-width: min(320px, calc(100vw - (2 * var(--esfera-whatsapp-side))));
    padding: 7px 18px 7px 7px;
}

.esfera-whatsapp-chat__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--esfera-whatsapp-size) - 12px);
    height: calc(var(--esfera-whatsapp-size) - 12px);
    flex: 0 0 calc(var(--esfera-whatsapp-size) - 12px);
    box-sizing: border-box;
    border-radius: 9999px;
    color: currentColor;
}

.esfera-whatsapp-chat__icon svg {
    display: block;
    width: 65%;
    height: 65%;
    overflow: visible;
    fill: currentColor;
}


.esfera-whatsapp-chat__text {
    display: inline-block;
    min-width: 0;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
    .esfera-whatsapp-chat:hover {
        color: #fff !important;
        box-shadow: 0 10px 28px rgb(0 0 0 / 30%);
        transform: translateY(0px);
    }
}

.esfera-whatsapp-chat:active {
    transform: translateY(0);
}

.esfera-whatsapp-chat:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgb(37 211 102 / 45%);
}

.esfera-whatsapp-chat--pulse {
    animation: esfera-whatsapp-pulse 2s infinite;
}

@keyframes esfera-whatsapp-pulse {
    0% {
        box-shadow: 0 8px 24px rgb(0 0 0 / 24%), 0 0 0 0 rgb(37 211 102 / 48%);
    }
    70% {
        box-shadow: 0 8px 24px rgb(0 0 0 / 24%), 0 0 0 16px rgb(37 211 102 / 0%);
    }
    100% {
        box-shadow: 0 8px 24px rgb(0 0 0 / 24%), 0 0 0 0 rgb(37 211 102 / 0%);
    }
}

/* Enhanced conversation window. The direct-link button above remains the fallback. */
.esfera-whatsapp-widget {
    position: fixed;
    bottom: calc(var(--esfera-whatsapp-bottom) + env(safe-area-inset-bottom, 0px));
    z-index: var(--esfera-whatsapp-z-index, 990);
    display: inline-flex;
    align-items: flex-end;
    justify-content: flex-end;
    margin: 0;
    padding: 0;
    line-height: 1.35;
}

.esfera-whatsapp-widget--right {
    right: calc(var(--esfera-whatsapp-side) + env(safe-area-inset-right, 0px));
    left: auto;
}

.esfera-whatsapp-widget--left {
    right: auto;
    left: calc(var(--esfera-whatsapp-side) + env(safe-area-inset-left, 0px));
}

.esfera-whatsapp-widget > .esfera-whatsapp-chat {
    position: relative;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: auto;
}

.esfera-whatsapp-widget__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    box-sizing: border-box;
    border: 0;
    border-radius: 50%;
    background: #ff0000;
    pointer-events: none;
}

.esfera-whatsapp-widget__panel {
    position: absolute;
    bottom: calc(var(--esfera-whatsapp-size) + 12px);
    display: flex;
    width: min(360px, calc(100vw - 24px));
    max-height: calc(100vh - var(--esfera-whatsapp-bottom) - var(--esfera-whatsapp-size) - 36px);
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: #efe8e0;
    box-shadow: 0 14px 42px rgb(0 0 0 / 24%);
    color: #272727;
    animation: esfera-whatsapp-panel-in 190ms ease-out;
}

.esfera-whatsapp-widget--right .esfera-whatsapp-widget__panel {
    right: 0;
    left: auto;
}

.esfera-whatsapp-widget--left .esfera-whatsapp-widget__panel {
    right: auto;
    left: 0;
}

@keyframes esfera-whatsapp-panel-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.esfera-whatsapp-widget__header {
    position: relative;
    display: flex;
    min-height: 92px;
    align-items: center;
    box-sizing: border-box;
    padding: 16px 48px 16px 18px;
    background: var(--esfera-whatsapp-blue);
    color: #fff;
}

.esfera-whatsapp-widget__avatar {
    position: relative;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    margin-right: 14px;
}

.esfera-whatsapp-widget__avatar picture,
.esfera-whatsapp-widget__avatar img {
    display: block;
    width: 100%;
    height: 100%;
}

.esfera-whatsapp-widget__avatar img {
    box-sizing: border-box;
    border: 2px solid rgb(255 255 255 / 84%);
    border-radius: 50%;
    background: #fff;
    object-fit: cover;
}

.esfera-whatsapp-widget__status {
    position: absolute;
    right: 0;
    bottom: 1px;
    width: 11px;
    height: 11px;
    box-sizing: border-box;
    border: 2px solid var(--esfera-whatsapp-blue);
    border-radius: 50%;
    background: #4fce5d;
}

.esfera-whatsapp-widget__header-info {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
}

.esfera-whatsapp-widget__title,
.esfera-whatsapp-widget__subtitle {
    display: block;
    overflow-wrap: anywhere;
}

.esfera-whatsapp-widget__title {
    margin: 0 0 3px;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
}

.esfera-whatsapp-widget__subtitle {
    color: rgb(255 255 255 / 90%);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.35;
}

.esfera-whatsapp-widget button.esfera-whatsapp-widget__close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    width: 32px;
    height: 32px;
    min-height: 0;
    min-width: 0;
    max-width: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    background-image: none;
    color: rgb(255 255 255 / 65%);
    box-shadow: none;
    font-size: 0;
    font-weight: 400;
    line-height: 1;
    text-indent: 0;
    text-transform: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: color 140ms ease, background-color 140ms ease;
}

.esfera-whatsapp-widget button.esfera-whatsapp-widget__close svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.esfera-whatsapp-widget button.esfera-whatsapp-widget__close:hover {
    background: rgb(255 255 255 / 10%);
    color: #fff;
    border: 0;
}

.esfera-whatsapp-widget button.esfera-whatsapp-widget__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

.esfera-whatsapp-widget__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 248px;
    box-sizing: border-box;
    overflow: auto;
    padding: 14px 20px 20px;
    background-color: #efe8e0;
    background-image: url('../images/background-whatsapp.jpg');
    background-image: image-set(
        url('../images/background-whatsapp.webp') type('image/webp'),
        url('../images/background-whatsapp.jpg') type('image/jpeg')
    );
    background-position: center;
    background-repeat: repeat;
    background-size: 430px auto;
}

.esfera-whatsapp-widget__time {
    display: block;
    grid-row: 1;
    grid-column: 1;
    min-height: 16px;
    margin: 0 0 8px;
    color: rgb(39 39 39 / 48%);
    font-size: 11px;
    font-weight: 500;
    line-height: 16px;
    text-align: center;
}

.esfera-whatsapp-widget__typing {
    position: relative;
    display: inline-flex;
    z-index: 2;
    grid-row: 2;
    grid-column: 1;
    align-self: start;
    justify-self: start;
    min-width: 54px;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-sizing: border-box;
    margin: 3px 0 14px 10px;
    padding: 8px 12px;
    border-radius: 0 15px 15px 15px;
    background: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 8%);
}

.esfera-whatsapp-widget__typing::before,
.esfera-whatsapp-widget__message::before {
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 0 solid transparent;
    border-right: 9px solid #fff;
    border-bottom: 14px solid transparent;
    content: '';
}

.esfera-whatsapp-widget__typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
    animation: esfera-whatsapp-typing 900ms infinite ease-in-out;
}

.esfera-whatsapp-widget__typing span:nth-child(2) {
    animation-delay: 100ms;
}

.esfera-whatsapp-widget__typing span:nth-child(3) {
    animation-delay: 200ms;
}

@keyframes esfera-whatsapp-typing {
    0%, 60%, 100% {
        opacity: .45;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.esfera-whatsapp-widget__content {
    display: flex;
    grid-row: 2;
    grid-column: 1;
    min-width: 0;
    flex-direction: column;
    align-items: center;
}

.esfera-whatsapp-widget__body--typing
.esfera-whatsapp-widget__message {
    visibility: hidden;
}

.esfera-whatsapp-widget__message {
    position: relative;
    width: min(255px, calc(100% - 18px));
    align-self: flex-start;
    box-sizing: border-box;
    margin: 3px 0 20px 10px;
    padding: 14px 16px;
    border-radius: 0 16px 16px 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 8%);
    color: #272727;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.esfera-whatsapp-widget__cta {
    display: inline-flex;
    min-height: 48px;
    max-width: 100%;
    align-items: center;
    justify-content: center;
    gap: 9px;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 12px 24px;
    border: 0;
    border-radius: 9999px;
    background-color: var(--esfera-whatsapp-blue);
    color: #fff !important;
    box-shadow: 0 2px 5px rgb(0 0 0 / 14%);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    text-decoration: none !important;
    transition:
        background-color .3s ease-in-out,
        filter .3s ease-in-out,
        transform .3s ease-in-out;
}

.esfera-whatsapp-widget__cta-icon {
    display: inline-flex;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    align-items: center;
    justify-content: center;
}

.esfera-whatsapp-widget__cta-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: #fff;
}


.esfera-whatsapp-widget__cta:hover {
    color: #fff !important;
    background:#004d75;
    filter: brightness(1);
    transform: translateY(0px);
}

.esfera-whatsapp-widget__cta:focus-visible {
    outline: 3px solid rgb(0 99 150 / 28%);
    outline-offset: 3px;
}

@media (max-width: 767px) {
    .esfera-whatsapp-chat,
    .esfera-whatsapp-widget {
        --esfera-whatsapp-bottom: var(--esfera-whatsapp-bottom-mobile, 14px);
        --esfera-whatsapp-side: var(--esfera-whatsapp-side-mobile, 14px);
        --esfera-whatsapp-size: var(--esfera-whatsapp-size-mobile, 54px);
    }

    .esfera-whatsapp-chat__text {
        max-width: 145px;
        font-size: 14px;
    }

    .esfera-whatsapp-widget__panel {
        width: min(360px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
        max-height: calc(100vh - var(--esfera-whatsapp-bottom) - var(--esfera-whatsapp-size) - 28px - env(safe-area-inset-bottom, 0px));
        border-radius: 14px;
    }

    .esfera-whatsapp-widget__header {
        min-height: 86px;
        padding: 14px 44px 14px 16px;
    }

    .esfera-whatsapp-widget__avatar {
        width: 48px;
        height: 48px;
        flex-basis: 48px;
        margin-right: 12px;
    }

    .esfera-whatsapp-widget__title {
        font-size: 16px;
    }

    .esfera-whatsapp-widget__subtitle {
        font-size: 13px;
    }

    .esfera-whatsapp-widget__body {
        min-height: 232px;
        padding: 12px 16px 18px;
    }

    .esfera-whatsapp-widget__message {
        font-size: 15px;
    }

    .esfera-whatsapp-widget__cta {
        min-height: 46px;
        padding: 11px 20px;
        font-size: 15px;
    }
}

@media (max-width: 380px) {
    .esfera-whatsapp-widget__panel {
        width: calc(100vw - 20px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    }

    .esfera-whatsapp-widget__body {
        padding-right: 14px;
        padding-left: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .esfera-whatsapp-chat,
    .esfera-whatsapp-chat--pulse,
    .esfera-whatsapp-widget__panel,
    .esfera-whatsapp-widget__typing span,
    .esfera-whatsapp-widget__close,
    .esfera-whatsapp-widget__cta {
        animation: none;
        transition: none;
    }
}


.esfera-whatsapp-widget__panel.esfera-whatsapp-widget__panel--closing {
    pointer-events: none;
    animation: esfera-whatsapp-panel-out 190ms ease-in forwards;
}

@keyframes esfera-whatsapp-panel-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(10px) scale(.985);
    }
}

@media (prefers-reduced-motion: reduce) {
    .esfera-whatsapp-widget__panel.esfera-whatsapp-widget__panel--closing {
        animation: none;
    }
}