/*-----------------------------------
    Boton flotante de WhatsApp con
    selector de sucursal
------------------------------------*/

.wa-flotante {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9998;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    font-family: inherit;
}

/* --- Boton circular --- */
.wa-flotante__boton {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, #25d366 0%, #128c7e 100%);
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(18, 140, 126, .38), 0 2px 6px rgba(0, 0, 0, .18);
    transition: transform .4s cubic-bezier(.2, .8, .2, 1) .12s,
                opacity .3s ease .12s,
                box-shadow .25s ease;
}

.wa-flotante__boton:hover,
.wa-flotante__boton:focus-visible {
    box-shadow: 0 14px 30px rgba(18, 140, 126, .5), 0 2px 6px rgba(0, 0, 0, .18);
    transform: translateY(-2px);
    outline: none;
}

.wa-flotante__boton:focus-visible {
    outline: 3px solid #0b6b60;
    outline-offset: 3px;
}

/* Halo que invita a pulsar */
.wa-flotante__boton::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(37, 211, 102, .55);
    animation: waHalo 2.6s ease-out infinite;
    pointer-events: none;
}

/* El icono se sale de la pantalla hacia la derecha */
.wa-flotante.is-abierto .wa-flotante__boton {
    transform: translateX(150%) scale(.6) rotate(12deg);
    opacity: 0;
    pointer-events: none;
    transition-delay: 0s;
}

.wa-flotante.is-abierto .wa-flotante__boton::after {
    animation: none;
    opacity: 0;
}

@keyframes waHalo {
    0%   { transform: scale(1);   opacity: .9; }
    70%  { transform: scale(1.5); opacity: 0; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* --- Panel con las tarjetas de sucursal --- */
.wa-flotante__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(320px, calc(100vw - 32px));
    padding: 14px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 45px rgba(9, 42, 38, .25), 0 2px 8px rgba(0, 0, 0, .08);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(48px) scale(.94);
    transform-origin: bottom right;
    transition: opacity .16s ease,
                transform .16s ease,
                visibility 0s linear .16s;
}

.wa-flotante.is-abierto .wa-flotante__panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0) scale(1);
    transition: opacity .26s ease .28s,
                transform .32s cubic-bezier(.2, .8, .2, 1) .28s,
                visibility 0s linear .28s;
}

.wa-flotante__cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 4px 12px;
}

.wa-flotante__cabecera p {
    margin: 0;
    color: #1f3b36;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.wa-flotante__cerrar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #eef5f3;
    color: #4a6560;
    font-size: 16px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.wa-flotante__cerrar:hover,
.wa-flotante__cerrar:focus-visible {
    background: #dcebe7;
    color: #1f3b36;
    outline: none;
}

/* --- Tarjetas --- */
.wa-sucursal {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid #e3eeeb;
    border-radius: 13px;
    background: #f8fbfa;
    color: #1f3b36;
    text-decoration: none;
    opacity: 0;
    transform: translateX(60px);
    transition: opacity .3s ease, transform .3s ease,
                background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.wa-sucursal:last-child {
    margin-bottom: 0;
}

.wa-flotante.is-abierto .wa-sucursal {
    opacity: 1;
    transform: translateX(0);
    transition-delay: .38s;
}

.wa-flotante.is-abierto .wa-sucursal:nth-child(3) {
    transition-delay: .46s;
}

.wa-sucursal:hover,
.wa-sucursal:focus-visible {
    background: #fff;
    border-color: #b9e3d5;
    box-shadow: 0 6px 16px rgba(18, 140, 126, .14);
    transform: translateX(0);
    outline: none;
}

.wa-sucursal:focus-visible {
    box-shadow: 0 0 0 3px rgba(37, 211, 102, .35);
}

.wa-sucursal__icono {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, #25d366 0%, #128c7e 100%);
    color: #fff;
    font-size: 21px;
}

.wa-sucursal__texto {
    flex: 1 1 auto;
    min-width: 0;
}

.wa-sucursal__texto strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.wa-sucursal__texto small {
    display: block;
    color: #6a827d;
    font-size: 11.5px;
    line-height: 1.35;
}

.wa-sucursal__flecha {
    flex: 0 0 auto;
    color: #8bb3a9;
    font-size: 13px;
    transition: transform .2s ease, color .2s ease;
}

.wa-sucursal:hover .wa-sucursal__flecha,
.wa-sucursal:focus-visible .wa-sucursal__flecha {
    color: #128c7e;
    transform: translateX(2px);
}

@media (max-width: 575.98px) {
    .wa-flotante {
        right: 14px;
        bottom: 14px;
    }

    .wa-flotante__boton {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wa-flotante__boton,
    .wa-flotante__panel,
    .wa-sucursal,
    .wa-sucursal__flecha {
        transition-duration: .01ms !important;
        transition-delay: 0s !important;
        animation: none !important;
    }
}
