/* Autos Esquivel V2 — CTA único de WhatsApp.
 * Sustituye el dock de acciones rápidas en escritorio y móvil. */

.ae-floating-whatsapp {
    --ae-wa-green: #25d366;
    --ae-wa-green-dark: #1fbd59;
    --ae-wa-bubble-bg: rgba(12, 14, 16, .96);
    --ae-wa-bubble-text: #ffffff;
    --ae-wa-bubble-muted: rgba(255, 255, 255, .70);
    --ae-wa-bubble-line: rgba(255, 255, 255, .12);
    position: fixed;
    z-index: 980;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 16px));
    font-family: "Manrope", "Avenir Next", "Segoe UI Variable", "Segoe UI", Inter, ui-sans-serif, system-ui, sans-serif;
    pointer-events: none;
}

html[data-theme="light"] .ae-floating-whatsapp {
    --ae-wa-bubble-bg: rgba(255, 255, 255, .98);
    --ae-wa-bubble-text: #111315;
    --ae-wa-bubble-muted: #646a70;
    --ae-wa-bubble-line: rgba(17, 19, 21, .10);
}

.ae-floating-whatsapp *,
.ae-floating-whatsapp *::before,
.ae-floating-whatsapp *::after {
    box-sizing: border-box;
}

.ae-floating-whatsapp__link {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 11px;
    color: inherit;
    text-decoration: none;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}

.ae-floating-whatsapp__bubble {
    position: relative;
    min-width: 154px;
    max-width: min(250px, calc(100vw - 104px));
    display: grid;
    gap: 3px;
    padding: 11px 14px 12px;
    border: 1px solid var(--ae-wa-bubble-line);
    border-radius: 16px;
    background: var(--ae-wa-bubble-bg);
    box-shadow: 0 14px 38px rgba(0, 0, 0, .22);
    color: var(--ae-wa-bubble-text);
    backdrop-filter: blur(15px) saturate(120%);
    -webkit-backdrop-filter: blur(15px) saturate(120%);
    transform-origin: right center;
    animation: ae-wa-bubble-in .42s cubic-bezier(.2, .8, .2, 1) both;
}

.ae-floating-whatsapp__bubble::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -6px;
    width: 11px;
    height: 11px;
    border-top: 1px solid var(--ae-wa-bubble-line);
    border-right: 1px solid var(--ae-wa-bubble-line);
    background: var(--ae-wa-bubble-bg);
    transform: translateY(-50%) rotate(45deg);
}

.ae-floating-whatsapp__bubble strong {
    display: block;
    overflow: hidden;
    color: var(--ae-wa-bubble-text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.015em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ae-floating-whatsapp__bubble > span {
    display: -webkit-box;
    overflow: hidden;
    color: var(--ae-wa-bubble-muted);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: .005em;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.ae-floating-whatsapp__button {
    position: relative;
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    border: 1px solid rgba(255, 255, 255, .30);
    border-radius: 999px;
    background: linear-gradient(145deg, #2be26f, var(--ae-wa-green-dark));
    box-shadow:
        0 12px 30px rgba(17, 148, 70, .32),
        0 3px 10px rgba(0, 0, 0, .22);
    color: #fff;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.ae-floating-whatsapp__button::before {
    content: "";
    position: absolute;
    inset: -5px;
    border: 1px solid rgba(37, 211, 102, .24);
    border-radius: inherit;
    animation: ae-wa-ring 2.8s ease-out infinite;
}

.ae-floating-whatsapp__button svg {
    position: relative;
    z-index: 1;
    width: 31px;
    height: 31px;
    display: block;
    flex: 0 0 auto;
    margin: 0;
    overflow: visible;
    fill: currentColor;
    vertical-align: middle;
    transform: translateY(-1px);
    transform-origin: 50% 50%;
}

.ae-floating-whatsapp__link:hover .ae-floating-whatsapp__button,
.ae-floating-whatsapp__link:focus-visible .ae-floating-whatsapp__button {
    transform: translateY(-2px) scale(1.035);
    box-shadow:
        0 16px 34px rgba(17, 148, 70, .38),
        0 4px 12px rgba(0, 0, 0, .24);
    filter: saturate(1.05) brightness(1.02);
}

.ae-floating-whatsapp__link:hover .ae-floating-whatsapp__bubble,
.ae-floating-whatsapp__link:focus-visible .ae-floating-whatsapp__bubble {
    border-color: rgba(37, 211, 102, .35);
}

.ae-floating-whatsapp__link:focus-visible {
    outline: none;
}

.ae-floating-whatsapp__link:focus-visible .ae-floating-whatsapp__button {
    outline: 3px solid rgba(37, 211, 102, .34);
    outline-offset: 3px;
}

@keyframes ae-wa-bubble-in {
    from {
        opacity: 0;
        transform: translateX(8px) scale(.97);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes ae-wa-ring {
    0%, 55% {
        opacity: 0;
        transform: scale(.94);
    }
    65% {
        opacity: .75;
    }
    100% {
        opacity: 0;
        transform: scale(1.14);
    }
}

@media (max-width: 640px) {
    .ae-floating-whatsapp {
        right: max(14px, env(safe-area-inset-right));
        bottom: max(16px, calc(env(safe-area-inset-bottom) + 12px));
    }

    .ae-floating-whatsapp__link {
        gap: 9px;
    }

    .ae-floating-whatsapp__bubble {
        min-width: 0;
        max-width: min(208px, calc(100vw - 92px));
        padding: 10px 12px 10px;
        border-radius: 14px;
    }

    .ae-floating-whatsapp__bubble strong {
        font-size: 12px;
    }

    .ae-floating-whatsapp__bubble > span {
        font-size: 9px;
    }

    .ae-floating-whatsapp__button {
        width: 56px;
        height: 56px;
        flex-basis: 56px;
    }

    .ae-floating-whatsapp__button svg {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 360px) {
    .ae-floating-whatsapp__bubble {
        max-width: 178px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ae-floating-whatsapp__bubble,
    .ae-floating-whatsapp__button::before {
        animation: none;
    }

    .ae-floating-whatsapp__button {
        transition: none;
    }
}
