/* ==============================> Estilos de WhatsApp Flotante */

/* ANIMACIONES */

@keyframes pulso-wsp-footer {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgb(37, 211, 102, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 12px rgba(37, 211, 102, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* BOTON WHATSAPP FLOTANTE */

.boton-wsp-izquierdo {
    position: fixed;
    bottom: 36px;
    left: 36px;
    z-index: 1000;
    padding: 8px;
    background: #25d366;
    width: 65px;
    height: 65px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50px;
    color: #fff;
    font-size: 32px;
    animation: pulso-wsp-footer 1.6s infinite;
    transition: .4s all ease-in-out;
}

.boton-wsp-izquierdo:hover {
    color: #fff;
    background: #128c7e;
}

@media(max-width: 768px) {
    .boton-wsp-izquierdo {
        bottom: 16px;
        left: 16px;
    }
}

/* ==============================> Panel flotante de múltiples asesores */

/* VARIABLES */

.wsp-flotante {
    --wsp-verde: #25d366;
    --wsp-verde-oscuro: #128c7e;
    --wsp-texto: #3c4043;
    --wsp-texto-suave: #6b7280;
    --wsp-fondo: #fff;
    --wsp-fondo-item: #f4f5f7;
    --wsp-offset: 36px;
    --wsp-ancho: 340px;
    --wsp-boton: 65px;

    position: fixed;
    bottom: calc(var(--wsp-offset) + env(safe-area-inset-bottom, 0px));
    left: calc(var(--wsp-offset) + env(safe-area-inset-left, 0px));
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}

/* El botón deja de posicionarse solo: lo posiciona el contenedor */

.wsp-flotante .boton-wsp-izquierdo {
    position: relative;
    bottom: auto;
    left: auto;
    z-index: 2;
    flex: 0 0 auto;
    width: var(--wsp-boton);
    height: var(--wsp-boton);
    padding: 8px;
    border: 0;
    cursor: pointer;
    font-family: inherit;
}

.wsp-flotante.wsp-abierto .boton-wsp-izquierdo {
    animation: none;
    transform: scale(1);
    background: var(--wsp-verde);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

.wsp-toggle__abrir,
.wsp-toggle__cerrar {
    grid-area: 1 / 1;
    transition: opacity .25s ease, transform .25s ease;
}

.wsp-toggle {
    display: grid !important;
    place-items: center;
}

.wsp-toggle__cerrar {
    width: 28px;
    height: 28px;
    opacity: 0;
    transform: rotate(-90deg) scale(.6);
}

.wsp-abierto .wsp-toggle__abrir {
    opacity: 0;
    transform: rotate(90deg) scale(.6);
}

.wsp-abierto .wsp-toggle__cerrar {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* CAPA OSCURA (solo pantallas pequeñas) */

.wsp-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(17, 24, 39, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}

/* PANEL */

.wsp-panel {
    position: absolute;
    bottom: calc(var(--wsp-boton) + 14px);
    left: 0;
    z-index: 1;
    width: min(var(--wsp-ancho), calc(100vw - (var(--wsp-offset) * 2)));
    max-height: min(70vh, 560px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--wsp-fondo);
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(.96);
    transform-origin: bottom left;
    pointer-events: none;
    transition: opacity .28s ease, transform .28s ease, visibility .28s;
}

.wsp-abierto .wsp-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* CABECERA DEL PANEL */

.wsp-panel__cabecera {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    background: var(--wsp-verde);
    color: #fff;
}

.wsp-panel__marca {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #fff;
    color: var(--wsp-verde);
    font-size: 24px;
}

.wsp-panel__textos {
    min-width: 0;
}

.wsp-panel__titulo {
    margin: 0;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 700;
    color: #fff;
    overflow-wrap: anywhere;
}

.wsp-panel__subtitulo {
    margin: 3px 0 0;
    font-size: 13px;
    line-height: 1.35;
    color: rgba(255, 255, 255, .9);
    overflow-wrap: anywhere;
}

/* LISTA DE ASESORES */

.wsp-panel__lista {
    margin: 0;
    padding: 14px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.wsp-panel__item {
    margin: 0;
    list-style: none;
}

.wsp-asesor {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 0;
    border-left: 3px solid var(--wsp-verde);
    border-radius: 8px;
    background: var(--wsp-fondo-item);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background .25s ease, transform .25s ease;
}

.wsp-asesor:hover,
.wsp-asesor:focus-visible {
    background: #e9eef1;
    outline: none;
}

.wsp-asesor:focus-visible {
    box-shadow: 0 0 0 2px var(--wsp-verde-oscuro);
}

.wsp-asesor:active {
    transform: scale(.98);
}

.wsp-asesor__avatar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--wsp-verde);
    color: #fff;
    font-size: 24px;
}

.wsp-asesor__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.wsp-asesor__info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wsp-asesor__nombre {
    font-size: 15px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--wsp-texto);
    overflow-wrap: anywhere;
}

.wsp-asesor__cargo {
    font-size: 12.5px;
    line-height: 1.3;
    color: var(--wsp-texto-suave);
    overflow-wrap: anywhere;
}

.wsp-asesor__accion {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--wsp-verde);
    font-size: 22px;
    transition: transform .25s ease;
}

.wsp-asesor:hover .wsp-asesor__accion {
    transform: translateX(2px);
}

/* RESPONSIVE */

/* Tablet */
@media (max-width: 1024px) {
    .wsp-flotante {
        --wsp-offset: 28px;
    }
}

/* Móvil */
@media (max-width: 768px) {
    .wsp-flotante {
        --wsp-offset: 16px;
        --wsp-boton: 58px;
        --wsp-ancho: 330px;
    }

    .wsp-panel {
        max-height: min(68vh, 480px);
    }

    .wsp-panel__cabecera {
        padding: 16px;
        gap: 10px;
    }

    .wsp-panel__titulo {
        font-size: 16px;
    }

    .wsp-panel__subtitulo {
        font-size: 12.5px;
    }
}

/* Móvil chico: el panel ocupa el ancho útil y aparece la capa oscura */
@media (max-width: 600px) {
    .wsp-panel {
        width: calc(100vw - (var(--wsp-offset) * 2));
    }

    .wsp-abierto .wsp-overlay {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-width: 380px) {
    .wsp-flotante {
        --wsp-offset: 12px;
        --wsp-boton: 54px;
    }

    .wsp-asesor {
        gap: 10px;
        padding: 9px 10px;
    }

    .wsp-asesor__avatar {
        width: 40px;
        height: 40px;
        font-size: 21px;
    }

    .wsp-asesor__nombre {
        font-size: 14px;
    }
}

/* Pantallas bajas / móvil en horizontal */
@media (max-height: 520px) {
    .wsp-panel {
        max-height: calc(100vh - var(--wsp-boton) - (var(--wsp-offset) * 3));
    }

    .wsp-panel__cabecera {
        padding: 12px 16px;
    }

    .wsp-panel__lista {
        padding: 10px;
        gap: 8px;
    }
}

/* Accesibilidad: sin animaciones si el usuario las desactivó */
@media (prefers-reduced-motion: reduce) {

    .wsp-flotante .boton-wsp-izquierdo,
    .wsp-panel,
    .wsp-asesor,
    .wsp-overlay,
    .wsp-toggle__abrir,
    .wsp-toggle__cerrar {
        animation: none !important;
        transition: none !important;
    }
}

/* ==============================> Estilos del Shortcode de WhatsApp */

/* WSP Predeterminado */

.whatsapp-predeterminado {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--wd-brd-radius);
    background: var(--e-global-color-secondary);
    font-size: var(--wd-text-font-size);
    line-height: calc(var(--wd-text-font-size) + 4px);
    color: #fff;
    transition: .4s all ease-in-out;
}

.whatsapp-predeterminado i {
    font-size: calc(var(--wd-text-font-size) + 4px);
    transition: .4s all ease-in-out;
}

.whatsapp-predeterminado:hover {
    background: var(--e-global-color-primary);
    color: #fff;
}

/* WSP Cabecera */

.whatsapp-cabecera {
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    position: relative;
    color: #fff;
    font-size: 13px;
    line-height: calc(var(--wd-text-font-size) + 1px);
    background: transparent;
    border-radius: 12px;
    border: 1px solid #fff;
    gap: 8px;
    transition: .4s all ease-in-out;
}

.whatsapp-cabecera i {
    font-size: calc(var(--wd-text-font-size) + 4px);
    transition: .4s all ease-in-out;
}

.whatsapp-cabecera:hover {
    background: var(--e-global-color-primary);
    border-color: var(--e-global-color-primary);
    color: #000;
}

/* WSP Icono */

.whatsapp-icono {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: var(--wd-brd-radius);
    font-size: 20px;
    width: 32px;
    height: 32px;
    background: #25d366;
    color: #fff;
    transition: .4s all ease-in-out;
}

.whatsapp-icono:hover {
    color: #fff;
}

/* ==============================> BOTÓN DE WHATSAPP EN WOOCOMMERCE (producto / carrito / checkout) */

.btn-wsp-product {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #25D366;
    color: white;
    padding: 10px 15px;
    border-radius: var(--btn-accented-brd-radius);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 14px;
    font-weight: 600;
    vertical-align: middle;
    transition: background 0.3s;
    height: auto;
    max-width: fit-content;
}

.btn-wsp-product:hover {
    background-color: #128C7E;
    color: white;
}

.btn-wsp-product i {
    margin-right: 5px;
    font-size: 16px;
}

/* En carrito y checkout el botón va en su propia línea, debajo de los totales */

.btn-wsp-wc {
    margin-top: 12px;
}

.cart-collaterals .btn-wsp-wc,
.woocommerce-checkout .btn-wsp-wc {
    display: flex;
    width: 100%;
    max-width: none;
}

/* RESPONSIVE */

@media(max-width: 768px) {
    .single-product form.cart {
        flex-wrap: wrap;
    }
}

