/* ===== BIA CHAT WIDGET — estilo BIA Bradesco ===== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── FAB Button — layout copiado de bia-chat-widget.html ── */
#bia-bubble {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6a3de8 0%, #c0306a 55%, #e8442a 100%);
    border: none;
    cursor: pointer;
    box-shadow:
        0 4px 14px rgba(0,0,0,.3),
        0 8px 28px rgba(160,40,120,.45),
        inset 0 1px 0 rgba(255,255,255,.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    z-index: 99998;
    padding: 0;
    transition: transform .2s cubic-bezier(.34,1.5,.64,1), box-shadow .2s ease;
    overflow: hidden;
    outline: none;
}
#bia-bubble:hover {
    transform: scale(1.09);
    box-shadow: 0 6px 20px rgba(0,0,0,.32), 0 12px 36px rgba(160,40,120,.55), inset 0 1px 0 rgba(255,255,255,.18);
}
#bia-bubble:active { transform: scale(.94); }

/* pulse ring */
#bia-bubble::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(160,40,180,.5);
    animation: fab-pulse 2.5s ease-out infinite;
    pointer-events: none;
}
@keyframes fab-pulse {
    0%   { transform: scale(1);    opacity: 1; }
    80%  { transform: scale(1.22); opacity: 0; }
    100% { transform: scale(1.22); opacity: 0; }
}

#bia-bubble-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
    margin-bottom: 1px;
    pointer-events: none;
    mix-blend-mode: multiply; /* elimina o fundo branco do JPG sobre o gradiente */
}
#bia-fab-line1 {
    font-family: 'Nunito', sans-serif;
    font-size: 6.5px;
    font-weight: 600;
    color: rgba(255,255,255,.82);
    text-transform: uppercase;
    letter-spacing: .5px;
    line-height: 1;
    pointer-events: none;
}
#bia-fab-line2 {
    font-family: 'Nunito', sans-serif;
    font-size: 8.5px;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .2px;
    line-height: 1;
    text-shadow: 0 1px 3px rgba(0,0,0,.3);
    pointer-events: none;
}
#bia-bubble-fallback { display: none; }

#bia-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #fff;
    color: #c0306a;
    font-size: 10px;
    font-weight: 800;
    min-width: 19px;
    height: 19px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #c0306a;
    padding: 0 3px;
    line-height: 1;
}

/* ===== JANELA DO CHAT ===== */
#bia-window {
    position: fixed;
    bottom: 108px;
    right: 28px;
    width: 345px;
    height: 480px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 48px rgba(0,0,0,0.25);
    display: none;
    flex-direction: column;
    z-index: 99997;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 13px;
}
#bia-window.open { display: flex; animation: biaSlidUp 0.22s ease; }
@keyframes biaSlidUp {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Cabeçalho exatamente igual à foto */
#bia-header {
    background: #cc0000;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
#bia-header-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
#bia-header-logo img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}
#bia-header-info { flex: 1; min-width: 0; }
#bia-header-title {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#bia-header-subtitle {
    color: rgba(255,255,255,0.85);
    font-size: 11px;
    margin-top: 1px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.bia-online-dot {
    width: 7px;
    height: 7px;
    background: #4dff6e;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
#bia-close-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    transition: color 0.15s;
    flex-shrink: 0;
}
#bia-close-btn:hover { color: #fff; }

/* Área de mensagens */
#bia-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #f5f5f5;
}
#bia-messages::-webkit-scrollbar { width: 3px; }
#bia-messages::-webkit-scrollbar-track { background: transparent; }
#bia-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* Mensagem — estrutura com avatar ao lado */
.bia-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.bia-msg-row.user { flex-direction: row-reverse; }

/* Avatar BIA (foto/logo) */
.bia-msg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.bia-msg-avatar img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}
.bia-msg-avatar.bia-green-b {
    background: #2dbb5d;
    border-color: #2dbb5d;
}
.bia-msg-avatar.bia-green-b span {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
}

/* Bolha de mensagem */
.bia-msg-group { display: flex; flex-direction: column; max-width: 74%; gap: 2px; }
.bia-msg-row.user .bia-msg-group { align-items: flex-end; }
.bia-msg-row.bia .bia-msg-group { align-items: flex-start; }

.bia-msg-bubble {
    padding: 9px 13px;
    border-radius: 18px;
    line-height: 1.45;
    word-break: break-word;
    font-size: 13px;
    position: relative;
}
.bia-msg-row.user .bia-msg-bubble {
    background: #cc0000;
    color: #fff;
    border-bottom-right-radius: 5px;
}
.bia-msg-row.bia .bia-msg-bubble {
    background: #fff;
    color: #222;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.1);
}

.bia-msg-time {
    font-size: 10px;
    color: #bbb;
    margin: 2px 2px 0;
}
.bia-msg-row.user .bia-msg-time { text-align: right; }

/* Arquivo/imagem nas mensagens */
.bia-file-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border-radius: 14px;
    max-width: 210px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.bia-msg-row.user .bia-file-msg { background: rgba(255,255,255,0.15); color: #fff; }
.bia-file-icon { font-size: 22px; flex-shrink: 0; }
.bia-file-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; display: block; }
.bia-file-size { font-size: 10px; color: #aaa; }
.bia-msg-row.user .bia-file-size { color: rgba(255,255,255,0.7); }
.bia-img-preview { max-width: 190px; border-radius: 10px; cursor: pointer; display: block; }

/* Typing dots */
#bia-typing-indicator {
    display: none;
    align-items: flex-end;
    gap: 8px;
    padding: 0 12px 8px;
}
.bia-typing-dots {
    background: #fff;
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    gap: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.bia-dot {
    width: 7px;
    height: 7px;
    background: #ccc;
    border-radius: 50%;
    animation: biaDot 1.3s infinite ease-in-out;
}
.bia-dot:nth-child(2) { animation-delay: 0.2s; }
.bia-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes biaDot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Área de input — igual à foto */
#bia-input-area {
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}
#bia-attach-preview {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 0;
    font-size: 12px;
    color: #666;
}
#bia-preview-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bia-attach-cancel { background: none; border: none; color: #cc0000; cursor: pointer; font-size: 15px; padding: 0; }
#bia-input-row {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 8px;
}
#bia-attach-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    font-size: 18px;
    padding: 4px;
    flex-shrink: 0;
    transition: color 0.15s;
    line-height: 1;
}
#bia-attach-btn:hover { color: #cc0000; }
#bia-text-input {
    flex: 1;
    border: 1px solid #e4e4e4;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 13px;
    outline: none;
    background: #f9f9f9;
    font-family: inherit;
    resize: none;
    max-height: 70px;
    line-height: 1.4;
    color: #333;
}
#bia-text-input::placeholder { color: #bbb; }
#bia-text-input:focus { border-color: #cc0000; background: #fff; }
#bia-send-btn {
    background: #cc0000;
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 18px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
    white-space: nowrap;
}
#bia-send-btn:hover { background: #aa0000; }
#bia-file-input { display: none; }

/* Nome do atendente abaixo das mensagens do admin */
.bia-msg-sender-name {
    font-size: 10px;
    color: #c8102e;
    font-weight: 700;
    margin-left: 2px;
}

/* Mobile */
@media (max-width: 480px) {
    #bia-window { width: calc(100vw - 18px); right: 9px; bottom: 100px; height: 70vh; }
    #bia-bubble { bottom: 14px; right: 14px; width: 60px; height: 60px; }
}
