/* ==========================================================================
   Conversa por WhatsApp (botão flutuante + janela)
   ========================================================================== */
.fb-wa {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 55;
    font-family: inherit;
}

/* Botão redondo (seletor reforçado: vence as regras gerais de border-radius do site) */
.fb-wa .fb-wa__button,
.fb-wa a.fb-wa__button.rounded-full {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem !important;
    height: 3rem !important;
    padding: 0 !important;
    border: 0;
    border-radius: 9999px !important;
    text-decoration: none !important;
    background: #25d366;
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fb-wa .fb-wa__button svg {
    width: 1.5rem;
    height: 1.5rem;
}

.fb-wa .fb-wa__button:hover {
    transform: scale(1.06);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
}

/* Anel a pulsar suavemente para chamar a atenção */
.fb-wa__button::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    border: 2px solid #25d366;
    animation: fb-wa-pulse 2.6s ease-out infinite;
    pointer-events: none;
}

@keyframes fb-wa-pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    70%,
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

.fb-wa.is-open .fb-wa__button::after {
    animation: none;
}

/* Balão de convite */
.fb-wa__hint {
    position: absolute;
    right: 3.75rem;
    bottom: 0.35rem;
    padding: 0.6rem 0.9rem;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    color: #111827;
    animation: fb-wa-in 0.35s ease;
}

.dark .fb-wa__hint {
    background: #17231d;
    color: #ffffff;
}

/* Janela */
.fb-wa__panel {
    position: absolute;
    right: 0;
    bottom: 4rem;
    width: min(22rem, calc(100vw - 2rem));
    overflow: hidden;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
    animation: fb-wa-in 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.dark .fb-wa__panel {
    background: #0f1813;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

@keyframes fb-wa-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.fb-wa__head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
    background: #0b120f;
    color: #ffffff;
}

.fb-wa__avatar {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    background: #25d366;
}

.fb-wa__avatar svg {
    width: 1.4rem;
    height: 1.4rem;
}

.fb-wa__name {
    margin: 0;
    font-weight: 700;
    color: #87e64b;
}

.fb-wa__status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.1rem 0 0;
    font-size: 0.78rem;
    color: #c9d3cd;
}

.fb-wa__dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #25d366;
}

.fb-wa__close {
    margin-left: auto;
    padding: 0.35rem;
    border: 0;
    background: transparent;
    color: #c9d3cd;
    cursor: pointer;
}

.fb-wa__close:hover {
    color: #ffffff;
}

/* Conversa */
.fb-wa__body {
    padding: 1.25rem 1.1rem;
    background: #ece5dd;
}

.dark .fb-wa__body {
    background: #0b1511;
}

.fb-wa__bubble {
    max-width: 85%;
    padding: 0.7rem 0.9rem;
    border-radius: 0 10px 10px 10px;
    background: #ffffff;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
    font-size: 0.9rem;
    line-height: 1.45;
    color: #111827;
}

.dark .fb-wa__bubble {
    background: #17231d;
    color: #e5e7eb;
}

.fb-wa__bubble p {
    margin: 0;
}

.fb-wa__bubble p+p {
    margin-top: 0.25rem;
}

/* Botão "Iniciar conversa" */
.fb-wa__start {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    margin: 0.9rem 1.1rem 1.1rem;
    padding: 0.8rem 1rem;
    border-radius: 8px !important;
    background: #25d366;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff !important;
    transition: background-color 0.2s ease;
}

.fb-wa__start,
.fb-wa__start:hover {
    text-decoration: none !important;
}

.fb-wa__start:hover {
    background: #1ebe5a;
}

.fb-wa__start svg {
    width: 1.2rem;
    height: 1.2rem;
}

/* O botão "voltar ao topo" sobe para não ficar por baixo do WhatsApp */
#back-to-top {
    bottom: 5.25rem !important;
}

/* Telemóvel: acima da barra fixa de contacto */
@media (max-width: 1023px) {
    .fb-wa {
        right: 1rem;
        bottom: 5.25rem;
    }

    .fb-wa__hint {
        display: none;
    }

    #back-to-top {
        right: auto !important;
        left: 1rem !important;
        bottom: 5.5rem !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fb-wa__button::after {
        animation: none;
    }
}

/* ==========================================================================
   Botão do WhatsApp sempre circular (independente das regras gerais do site)
   ========================================================================== */
#fb-wa-button {
    width: 3rem !important;
    height: 3rem !important;
    min-width: 3rem !important;
    padding: 0 !important;
    border-radius: 50% !important;
    clip-path: circle(50% at 50% 50%);
    /* recorte circular garantido */
    box-shadow: none !important;
    /* a sombra passa para o contorno (abaixo) */
}

/* O anel a pulsar sai do botão (o recorte escondê-lo-ia) e passa para o contentor */
#fb-wa-button::after {
    display: none !important;
}

.fb-wa::before,
.fb-wa::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    pointer-events: none;
}

/* Sombra suave por baixo do botão */
.fb-wa::before {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Anel a pulsar */
.fb-wa::after {
    border: 2px solid #25d366;
    animation: fb-wa-pulse 2.6s ease-out infinite;
}

.fb-wa.is-open::after {
    animation: none;
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    .fb-wa::after {
        animation: none;
        opacity: 0;
    }
}
