/* BIA Chat Widget Styles */
#bia-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Botão de toggle (bolha flutuante) */
.bia-chat-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 102, 204, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: #fff;
    position: relative;
}

.bia-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0, 102, 204, 0.5);
}

.bia-chat-toggle:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 3px;
}

.bia-chat-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    background: #e53935;
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    transform: scale(0);
    transform-origin: top right;
    transition: transform 0.2s ease;
}

.bia-chat-closed .bia-chat-badge {
    transform: scale(1);
}

#bia-chat-widget.bia-chat-open .bia-chat-badge {
    transform: scale(0);
}

/* Janela do chat */
.bia-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#bia-chat-widget.bia-chat-open .bia-chat-window {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.bia-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 12px;
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    color: #fff;
    border-bottom: none;
}

.bia-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bia-chat-title {
    flex: 1;
    min-width: 0;
}

.bia-chat-title strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.bia-chat-status {
    display: block;
    font-size: 12px;
    opacity: 0.85;
}

.bia-chat-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.bia-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Área de mensagens */
.bia-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.bia-chat-msg {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: bia-chat-fade-in 0.25s ease;
}

@keyframes bia-chat-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bia-chat-msg--bot {
    align-self: flex-start;
}

.bia-chat-msg--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bia-chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e8f0fe;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #0066cc;
}

.bia-chat-msg--user .bia-chat-msg-avatar {
    background: #0066cc;
    color: #fff;
    order: 1;
}

.bia-chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.bia-chat-msg--bot .bia-chat-msg-bubble {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
    color: #212121;
}

.bia-chat-msg--user .bia-chat-msg-bubble {
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Indicador de digitação */
.bia-chat-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 12px;
    color: #757575;
    font-size: 13px;
}

.bia-chat-typing-dots {
    display: flex;
    gap: 3px;
}

.bia-chat-typing-dots span {
    width: 6px;
    height: 6px;
    background: #0066cc;
    border-radius: 50%;
    animation: bia-typing-bounce 1.4s infinite ease-in-out;
}

.bia-chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.bia-chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bia-typing-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Formulário de envio */
.bia-chat-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.bia-chat-input {
    flex: 1;
    border: 1px solid #d0d0d0;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    min-width: 0;
}

.bia-chat-input:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.bia-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bia-chat-send:hover:not(:disabled) {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
}

.bia-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsivo */
@media (max-width: 480px) {
    .bia-chat-window {
        width: calc(100vw - 32px);
        right: -8px;
        bottom: 80px;
        max-height: calc(100vh - 100px);
    }
}