/* v2/css/chatbot.css */

/* Botão FAB flutuante */
.abaete-chatbot-fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #004696 0%, #0066cc 100%);
    color: white;
    border: none;
    box-shadow: 0 8px 24px rgba(0, 70, 150, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9990;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
}

.abaete-chatbot-fab:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 30px rgba(0, 70, 150, 0.4);
    background: linear-gradient(135deg, #003c80 0%, #0055b3 100%);
}

.abaete-chatbot-fab:active {
    transform: scale(0.95);
}

/* Animação de pulse no FAB para atrair atenção sutilmente */
.abaete-chatbot-fab::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #0066cc;
    opacity: 0.8;
    animation: fabPulse 2.5s infinite;
    pointer-events: none;
    box-sizing: border-box;
}

@keyframes fabPulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

.abaete-chatbot-fab .material-icons-outlined {
    font-size: 28px;
}

/* Container do Popover do Chatbot */
.abaete-chatbot-popover {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 380px;
    height: 560px;
    max-height: 80vh;
    background: white;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(0, 70, 150, 0.18);
    border: 1px solid rgba(0, 70, 150, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 9990;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-origin: bottom right;
}

/* Transições Vue */
.chatbot-fade-enter-from,
.chatbot-fade-leave-to {
    opacity: 0;
    transform: scale(0.8) translateY(30px);
}

.chatbot-fade-enter-active,
.chatbot-fade-leave-active {
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Cabeçalho do Chat */
.chatbot-header {
    background: linear-gradient(135deg, #004696 0%, #00224d 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--abaete-yellow, #FFEE9D);
}

.chatbot-header-text h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.chatbot-header-text span {
    font-size: 11px;
    opacity: 0.7;
    display: block;
}

.chatbot-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-btn-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    opacity: 0.8;
}

.chatbot-btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

/* Área de Mensagens */
.chatbot-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 70, 150, 0.2) transparent;
}

.chatbot-messages-area::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages-area::-webkit-scrollbar-thumb {
    background-color: rgba(0, 70, 150, 0.1);
    border-radius: 10px;
}

/* Balão de Mensagem */
.chatbot-msg-row {
    display: flex;
    width: 100%;
}

.chatbot-msg-row.user {
    justify-content: flex-end;
}

.chatbot-msg-row.bot {
    justify-content: flex-start;
}

.chatbot-msg-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 13.5px;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}

.chatbot-msg-row.user .chatbot-msg-bubble {
    background: #004696;
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-msg-row.bot .chatbot-msg-bubble {
    background: white;
    color: #334155;
    border-bottom-left-radius: 4px;
    border: 1px solid #f1f5f9;
}

/* Estilização para Links clicáveis gerados pelo Bot */
.chatbot-msg-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #0066cc;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    background: rgba(0, 102, 204, 0.05);
    padding: 2px 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.chatbot-msg-link:hover {
    background: rgba(0, 102, 204, 0.1);
    color: #004696;
}

/* Indicador de Digitação */
.chatbot-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.chatbot-typing-dot {
    width: 6px;
    height: 6px;
    background-color: #94a3b8;
    border-radius: 50%;
    animation: chatbotTyping 1.4s infinite ease-in-out both;
}

.chatbot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chatbot-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes chatbotTyping {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Chips / Sugestões rápidas */
.chatbot-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 20px 14px 20px;
    background-color: #f8fafc;
    flex-shrink: 0;
    border-top: 1px solid rgba(0,0,0,0.02);
}

.chatbot-chip {
    background: white;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.chatbot-chip:hover {
    border-color: #004696;
    color: #004696;
    background: rgba(0, 70, 150, 0.03);
}

/* Rodapé / Input de Chat */
.chatbot-input-area {
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    flex-shrink: 0;
}

.chatbot-input-field {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px 14px;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s;
    background: #f8fafc;
}

.chatbot-input-field:focus {
    border-color: #004696;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 70, 150, 0.08);
}

/* Botões de Ação do Input */
.chatbot-action-btn {
    background: transparent;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s;
    position: relative;
}

.chatbot-action-btn:hover {
    background: #f1f5f9;
    color: #004696;
}

.chatbot-action-btn.active {
    background: #fee2e2;
    color: #ef4444;
    animation: voiceActivePulse 1.5s infinite;
}

@keyframes voiceActivePulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.chatbot-action-btn.send-btn {
    background: #004696;
    color: white;
    box-shadow: 0 3px 8px rgba(0, 70, 150, 0.2);
}

.chatbot-action-btn.send-btn:hover {
    background: #003673;
    color: white;
    transform: scale(1.05);
}

/* Tooltip de gravação de voz */
.chatbot-recording-tooltip {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: #334155;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    pointer-events: none;
}

.chatbot-recording-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #334155;
}

/* Responsividade Mobile */
@media (max-width: 480px) {
    .abaete-chatbot-popover {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
        z-index: 10000; /* Fica acima do topbar e do sidebar */
    }
    
    .chatbot-header {
        border-radius: 0;
        padding-top: calc(45px + env(safe-area-inset-top));
    }

    .abaete-chatbot-fab {
        bottom: 20px;
        right: 20px;
        width: 54px;
        height: 54px;
    }
}
