/* Chatbot Styles - OBO Instalações e Montagens */

/* Botão flutuante do chatbot - Aparência Porta-Palete */
.chatbot-toggle {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #f97316, #ea580c);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.4);
    z-index: 9999 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    
    /* Animação piscante constante que nunca para */
    animation: pulseConstant 2s infinite;
    position: relative;
    overflow: hidden;
}

/* Animação piscante constante */
@keyframes pulseConstant {
    0% {
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(249, 115, 22, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 12px 35px rgba(249, 115, 22, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 8px 25px rgba(249, 115, 22, 0.4);
    }
}

.chatbot-toggle:hover {
    animation-duration: 1s; /* Acelera a pulsação no hover */
}

/* Ícone do porta-palete - Método direto */
.chatbot-toggle {
    background-image: url('../images/chatbot_porta_palete_icon.png'), linear-gradient(135deg, #f97316, #ea580c);
    background-size: 45px 45px, cover;
    background-repeat: no-repeat, no-repeat;
    background-position: center, center;
    filter: none;
}

/* Garantir que não há conflito com FontAwesome */
.chatbot-toggle i {
    display: none !important;
}

/* Forçar visibilidade */
.chatbot-toggle {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Container principal do chatbot - Sempre visível */
.chatbot-container {
    position: fixed !important;
    bottom: 90px !important;
    right: 20px !important;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9998 !important;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    visibility: visible !important;
    opacity: 1 !important;
}

.chatbot-container.active {
    display: flex !important;
    animation: slideUp 0.3s ease-out;
}

/* Garantir que o chatbot nunca seja escondido por outros elementos */
#chatbot-widget {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    pointer-events: none; /* Permite cliques através do widget */
}

#chatbot-widget * {
    pointer-events: auto; /* Reabilita cliques nos elementos do chatbot */
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header do chatbot */
.chatbot-header {
    background: linear-gradient(135deg, #1a063d, #2563eb);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: #f97316;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    position: relative;
    overflow: hidden;
}

/* Ícone do porta-palete no avatar */
.chatbot-avatar::before {
    content: '';
    width: 24px;
    height: 24px;
    background-image: url('../images/chatbot_porta_palete_icon.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: brightness(0) invert(1); /* Torna a imagem branca */
}

/* Esconder texto do avatar quando usar ícone */
.chatbot-avatar:has(::before) {
    font-size: 0;
}

.chatbot-title {
    display: flex;
    flex-direction: column;
}

.chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-title span {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 2px;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

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

/* Área de mensagens */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* Mensagens */
.message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 85%;
    animation: fadeIn 0.3s ease-out;
}

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

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.message.bot .message-avatar {
    background: #f97316;
    color: white;
}

.message.user .message-avatar {
    background: #1a063d;
    color: white;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    line-height: 1.5;
    font-size: 14px;
}

.message.user .message-content {
    background: #1a063d;
    color: white;
}

.message.bot .message-content::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid white;
}

.message.user .message-content::before {
    content: '';
    position: absolute;
    right: -8px;
    top: 12px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid #1a063d;
}

/* Opções de resposta rápida */
.quick-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.quick-option {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    text-align: left;
}

.quick-option:hover {
    background: #e2e8f0;
    border-color: #f97316;
    transform: translateX(4px);
}

/* Indicador de digitação */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-left: 40px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

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

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

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

@keyframes typingDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Área de input */
.chatbot-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.chatbot-input:focus {
    border-color: #f97316;
}

.chatbot-send {
    width: 40px;
    height: 40px;
    background: #f97316;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-send:hover {
    background: #ea580c;
    transform: scale(1.05);
}

.chatbot-send:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

/* Mensagem de boas-vindas */
.welcome-message {
    text-align: center;
    padding: 20px;
    color: #64748b;
}

.welcome-message h4 {
    color: #1a063d;
    margin-bottom: 8px;
    font-size: 16px;
}

.welcome-message p {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

/* Links e botões especiais */
.message-link {
    color: #f97316;
    text-decoration: none;
    font-weight: 500;
}

.message-link:hover {
    text-decoration: underline;
}

.action-button {
    background: #f97316;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s ease;
}

.action-button:hover {
    background: #ea580c;
}

/* Responsividade */
@media (max-width: 768px) {
    .chatbot-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        bottom: 90px;
        right: 20px;
        left: 20px;
    }
    
    .chatbot-toggle {
        bottom: 20px;
        right: 20px;
    }
}

/* Estados especiais */
.chatbot-container.minimized {
    height: 60px;
}

.chatbot-container.minimized .chatbot-messages,
.chatbot-container.minimized .chatbot-input-area {
    display: none;
}

/* Notificação de nova mensagem */
.message-notification {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    font-weight: bold;
    animation: bounce 0.5s ease-out;
}

@keyframes bounce {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

