/**
 * Botão Flutuante de WhatsApp (multi-atendente) - Borboleta Travel
 *
 * @package Borboleta_Travel
 */

.wa-float {
    --wa-green: #25D366;
    --wa-green-dark: #1da851;

    position: fixed;
    right: 20px;
    bottom: 20px;
    /* Acima do conteúdo e do header (1000), mas abaixo do modal
       "Planeje sua Viagem" (3000) para não flutuar sobre ele. */
    z-index: 2500;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* Some enquanto o modal "Planeje sua Viagem" está aberto */
body:has(.bt-modal-overlay.is-active) .wa-float {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* ==========================================================================
   Botão principal
   ========================================================================== */
.wa-float-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: var(--wa-green);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.42), 0 2px 6px rgba(0, 0, 0, 0.16);
    transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.wa-float-toggle:hover {
    background: var(--wa-green-dark);
    transform: scale(1.06);
}

.wa-float-toggle:focus-visible {
    outline: 3px solid var(--bt-color-teal, #183E40);
    outline-offset: 3px;
}

/* Pulso de atenção (só enquanto o painel está fechado) */
.wa-float-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--wa-green);
    opacity: 0.55;
    animation: waPulse 2.4s ease-out infinite;
    z-index: -1;
}

.wa-float.is-open .wa-float-toggle::before {
    animation: none;
    opacity: 0;
}

@keyframes waPulse {
    0%   { transform: scale(1);   opacity: 0.55; }
    70%  { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* Alternância dos ícones (WhatsApp <-> X) */
.wa-float-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.25s ease;
}

.wa-float-toggle-icon--close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
}

.wa-float.is-open .wa-float-toggle-icon--wa {
    opacity: 0;
    transform: rotate(90deg);
}

.wa-float.is-open .wa-float-toggle-icon--close {
    opacity: 1;
    transform: rotate(0deg);
}

/* Contador de atendentes */
.wa-float-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--bt-color-terracotta, #D95B28);
    color: #ffffff;
    font-family: var(--bt-font-family-ui, sans-serif);
    font-size: 11px;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.wa-float.is-open .wa-float-badge {
    opacity: 0;
}

/* ==========================================================================
   Painel de atendentes
   ========================================================================== */
.wa-float-panel {
    width: 320px;
    max-width: calc(100vw - 40px);
    background: var(--bt-bg-surface, #ffffff);
    border-radius: 16px;
    box-shadow: 0 20px 50px -12px rgba(24, 62, 64, 0.32), 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transform-origin: bottom right;
    animation: waPanelIn 0.22s cubic-bezier(0.34, 1.26, 0.64, 1);
}

@keyframes waPanelIn {
    from { opacity: 0; transform: translateY(10px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.wa-float-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 12px;
    background: var(--bt-color-teal, #183E40);
    color: #ffffff;
}

.wa-float-panel-heading {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wa-float-panel-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--bt-font-family-ui, sans-serif);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #9fe6bb;
}

.wa-float-panel-eyebrow::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--wa-green);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.25);
}

.wa-float-panel-heading strong {
    font-family: var(--bt-font-family-ui, sans-serif);
    font-size: 15px;
    font-weight: 700;
}

.wa-float-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease;
}

.wa-float-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

.wa-float-panel-intro {
    margin: 0;
    padding: 14px 16px 10px;
    font-family: var(--bt-font-family-body, sans-serif);
    font-size: 13px;
    line-height: 1.5;
    color: var(--bt-text-muted, #4B5563);
}

/* Lista de atendentes */
.wa-float-agents {
    margin: 0;
    padding: 0 10px 12px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wa-float-agent {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s ease, transform 0.2s ease;
}

.wa-float-agent:hover,
.wa-float-agent:focus-visible {
    background: #f1f8f4;
    transform: translateX(2px);
}

.wa-float-agent-avatar {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--wa-green);
    color: #ffffff;
}

.wa-float-agent-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.wa-float-agent-name {
    font-family: var(--bt-font-family-ui, sans-serif);
    font-size: 14px;
    font-weight: 700;
    color: var(--bt-text-heading, #183E40);
}

.wa-float-agent-role {
    font-family: var(--bt-font-family-body, sans-serif);
    font-size: 12px;
    line-height: 1.35;
    color: var(--bt-text-muted, #6B7280);
}

.wa-float-agent-number {
    font-family: var(--bt-font-family-ui, sans-serif);
    font-size: 12px;
    font-weight: 600;
    color: var(--wa-green-dark);
}

.wa-float-agent-go {
    flex-shrink: 0;
    color: var(--bt-color-gray-400, #9CA3AF);
    display: flex;
    align-items: center;
}

.wa-float-agent:hover .wa-float-agent-go {
    color: var(--wa-green-dark);
}

/* ==========================================================================
   Responsivo
   ========================================================================== */
@media (max-width: 600px) {
    .wa-float {
        right: 14px;
        bottom: 14px;
        gap: 10px;
    }

    .wa-float-toggle {
        width: 54px;
        height: 54px;
    }

    .wa-float-panel {
        width: calc(100vw - 28px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wa-float-toggle::before {
        animation: none;
        opacity: 0;
    }

    .wa-float-panel {
        animation: none;
    }
}
