/* =============================================================================
 * hmwhatsapp · front.css · Hakuna Mataza
 * Botón flotante WhatsApp (verde) + burbuja de saludo (marca) + botón de ficha.
 * Usa los tokens --hk-* de hmtheme si están; si no, fallbacks.
 * ========================================================================== */

/* ---- Contenedor flotante ------------------------------------------------ */
.hmwa-fab {
    position: fixed;
    bottom: 20px;
    z-index: 9998;
    --hmwa-color: #6f8568;   /* test buyer: verde SAGE (el oficial #25d366 cantaba en una web pastel) */
    font-family: Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.hmwa-fab.hmwa-pos-bottom-right { right: 20px; }
.hmwa-fab.hmwa-pos-bottom-left  { left: 20px; }

/* ---- Botón redondo ------------------------------------------------------ */
.hmwa-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--hmwa-color, #25d366);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .22);
    transition: transform .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s ease;
    -webkit-appearance: none;
    appearance: none;
}
.hmwa-btn:hover { background: #8AA07F; transform: scale(1.07); box-shadow: 0 10px 26px rgba(0, 0, 0, .28); }
.hmwa-btn:focus-visible { outline: 3px solid rgba(111, 133, 104, .45); outline-offset: 3px; }
.hmwa-btn svg { width: 30px; height: 30px; display: block; }

/* Pulso sutil para atraer la mirada (anillo que se expande) */
.hmwa-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(111, 133, 104, .5);
    animation: hmwaPulse 2.4s ease-out infinite;
    pointer-events: none;
}
@keyframes hmwaPulse {
    0%   { box-shadow: 0 0 0 0 rgba(111, 133, 104, .45); }
    70%  { box-shadow: 0 0 0 16px rgba(111, 133, 104, 0); }
    100% { box-shadow: 0 0 0 0 rgba(111, 133, 104, 0); }
}

/* ---- Dot de estado (online / offline) ----------------------------------- */
.hmwa-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.hmwa-dot--online  { background: #25d366; }   /* verde WhatsApp vivo: destaca el "online" sobre el botón sage */
.hmwa-dot--offline { background: #b9b1aa; }

/* ---- Burbuja de saludo (marca) ------------------------------------------ */
.hmwa-bubble {
    position: absolute;
    bottom: calc(100% + 14px);
    width: 232px;
    max-width: 70vw;
    padding: 13px 30px 13px 15px;
    background: var(--hk-paper, #FBF6EF);
    color: var(--hk-ink, #3A2C28);
    border: 1px solid var(--hk-line, #EBDDD0);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(58, 44, 40, .16);
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px) scale(.96);
    transform-origin: bottom right;
    transition: opacity .28s ease, transform .28s cubic-bezier(.2, .7, .3, 1);
    pointer-events: none;
}
.hmwa-pos-bottom-right .hmwa-bubble { right: 0; }
.hmwa-pos-bottom-left  .hmwa-bubble { left: 0; transform-origin: bottom left; }

/* Picо que apunta al botón */
.hmwa-bubble::after {
    content: "";
    position: absolute;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: var(--hk-paper, #FBF6EF);
    border-right: 1px solid var(--hk-line, #EBDDD0);
    border-bottom: 1px solid var(--hk-line, #EBDDD0);
    transform: rotate(45deg);
}
.hmwa-pos-bottom-right .hmwa-bubble::after { right: 20px; }
.hmwa-pos-bottom-left  .hmwa-bubble::after { left: 20px; }

.hmwa-fab.hmwa-bubble--show .hmwa-bubble {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.hmwa-bubble__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 500;
}
.hmwa-bubble__close {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--hk-ink-3, #9A8780);
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
}
.hmwa-bubble__close:hover { color: var(--hk-accent, #8A4A4A); }

/* ---- Botón en la ficha de producto -------------------------------------- */
/* Verde-outline: reconocible como WhatsApp, secundario al mostaza de compra */
.hmwa-product-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    margin-top: 12px;
    padding: 12px 18px;
    border: 1.5px solid var(--hmwa-color, #6f8568);   /* --hmwa-color solo vive en .hmwa-fab; aquí cae al fallback → sage */
    border-radius: 999px;
    background: #fff;
    color: #6f8568;
    font-family: Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .01em;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
    -webkit-appearance: none;
    appearance: none;
}
.hmwa-product-btn svg { width: 21px; height: 21px; flex: 0 0 auto; }
.hmwa-product-btn:hover { background: #8AA07F; border-color: #8AA07F; color: #fff; transform: translateY(-1px); }
.hmwa-product-btn:focus-visible { outline: 3px solid rgba(111, 133, 104, .4); outline-offset: 2px; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 767px) {
    .hmwa-fab { bottom: 16px; }
    .hmwa-fab.hmwa-pos-bottom-right { right: 16px; }
    .hmwa-fab.hmwa-pos-bottom-left  { left: 16px; }
    .hmwa-btn { width: 48px; height: 48px; }
    .hmwa-btn svg { width: 24px; height: 24px; }
    .hmwa-dot { width: 10px; height: 10px; top: 0; right: 0; }

    /* Móvil: ocultar la burbuja de saludo — ocupa demasiado y no hay espacio.
     * En desktop se mantiene (petición cliente 2026-06-20). */
    .hmwa-bubble { display: none !important; }
}

/* ---- Accesibilidad: sin movimiento -------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .hmwa-btn::before { animation: none; }
    .hmwa-btn, .hmwa-bubble, .hmwa-product-btn { transition: none; }
}
