/**
 * FAQ Chat Styles
 * Version: 1.0.0
 * Author: Hueini David
 */

/* Botão Flutuante */
.chat-faq-float {
    position: fixed !important;
    bottom: 120px !important;
    right: 40px !important;
    width: 60px !important;
    height: 60px !important;
    background: var(--bg-color, #0f0f0f) !important;
    color: #fff !important;
    border-radius: 8px !important; /* Igual ao LinkedIn */
    padding: 0 !important; /* Sem padding interno */
    /* Borda igual ao LinkedIn */
    border: 1px solid var(--hover-color, #12f7ff) !important;
    outline: 2px solid var(--bg-color, #0f0f0f) !important;
    box-shadow: var(--neon-box-shadow, 0 0 10px rgba(18, 247, 255, 0.3), 0 0 20px rgba(18, 247, 255, 0.2)) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: move !important; /* Cursor de arrastar */
    z-index: 10000 !important;
    transition: transform 0.3s ease, filter 0.3s ease !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    user-select: none !important; /* Prevenir seleção de texto */
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    touch-action: none !important; /* Melhor controle em touch devices */
}

/* Imagem dentro do botão */
.chat-faq-float img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    border-radius: 4px !important; /* Igual ao LinkedIn */
    transition: filter 0.3s ease !important;
}

.chat-faq-float:hover {
    transform: translateY(-2px) scale(1.1) !important;
    filter: brightness(1.2) !important;
    box-shadow: 0 0 20px var(--hover-color, #12f7ff) !important;
    border-color: var(--hover-color, #12f7ff) !important;
}

.chat-faq-float:hover img {
    filter: drop-shadow(0 4px 8px rgba(18, 247, 255, 0.3)) !important;
}

.chat-faq-float:active {
    cursor: grabbing !important; /* Cursor ao arrastar */
    transform: scale(0.95) !important;
}

/* Container do Chat */
.chat-faq-container {
    position: fixed;
    bottom: 190px;
    right: 40px;
    width: 370px;
    max-width: calc(100vw - 80px);
    background: var(--bg-color, #0f0f0f);
    border-radius: 8px; /* Igual ao LinkedIn */
    /* Borda igual ao LinkedIn */
    border: 1px solid var(--hover-color, #12f7ff);
    outline: 2px solid var(--bg-color, #0f0f0f);
    box-shadow: var(--neon-box-shadow, 0 0 10px rgba(18, 247, 255, 0.3), 0 0 20px rgba(18, 247, 255, 0.2));
    z-index: 9999; /* Um pouco menor que o botão para ficar atrás */
    color: #fff;
    display: none;
    flex-direction: column;
    transition: left 0.3s ease, top 0.3s ease, box-shadow 0.3s, border 0.3s, outline 0.3s; /* Transição suave ao mover */
}

.chat-faq-container:hover {
    box-shadow: 0 0 20px var(--hover-color, #12f7ff);
    border-color: var(--hover-color, #12f7ff);
}

.chat-faq-container.show {
    display: flex !important;
}

/* Header */
.chat-faq-header {
    background: #1a1a1a;
    color: #12f7ff;
    padding: 16px 20px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    font-weight: 600;
    font-size: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-faq-close {
    background: none;
    border: none;
    color: #12f7ff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 8px;
    transition: color 0.2s;
}

.chat-faq-close:hover {
    color: #ff0056;
}

/* Body */
.chat-faq-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 400px;
    background: #0f0f0f;
}

.chat-faq-body::-webkit-scrollbar {
    width: 8px;
}

.chat-faq-body::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.chat-faq-body::-webkit-scrollbar-thumb {
    background: #12f7ff;
    border-radius: 4px;
}

.chat-faq-body::-webkit-scrollbar-thumb:hover {
    background: #0ea8b0;
}

/* Mensagens */
.chat-message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    animation: messageSlideIn 0.3s ease;
    line-height: 1.5;
}

.chat-message.user {
    background: #1a1a1a;
    color: #fff;
    margin-left: 20px;
    border: 1px solid #12f7ff;
}

.chat-message.bot {
    background: #12f7ff;
    color: #000;
    margin-right: 20px;
}

.chat-message.error {
    background: #ff0056;
    color: #fff;
    margin-right: 20px;
}

.chat-message strong {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

/* Footer */
.chat-faq-footer {
    padding: 16px 20px;
    background: #1a1a1a;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-top: 1px solid #12f7ff;
}

.chat-faq-input-group {
    display: flex;
    gap: 10px;
}

#chat-faq-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #12f7ff;
    background: #0f0f0f;
    color: #fff;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

#chat-faq-input:focus {
    border-color: #12f7ff;
    box-shadow: 0 0 8px rgba(18, 247, 255, 0.3);
}

#chat-faq-send {
    padding: 12px 24px;
    background: #12f7ff;
    color: #000;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#chat-faq-send:hover {
    background: #0ea8b0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(18, 247, 255, 0.4);
}

#chat-faq-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading dots (Processando...) */
.loading-dots {
    display: inline-block;
}

.loading-dots span {
    animation: loadingDot 1.4s infinite;
    opacity: 0;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingDot {
    0%, 20% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Cursor piscando (efeito de digitação) */
.typing-cursor {
    display: inline-block;
    color: #12f7ff;
    animation: blink 0.8s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

.typing-text {
    display: inline;
}

/* Animações */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsivo */
@media (max-width: 768px) {
    .chat-faq-container {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 140px; /* Acima do botão do menu (80px) + espaço */
    }
    
    .chat-faq-float {
        /* Posição fixa acima do botão do menu */
        position: fixed !important;
        bottom: 80px !important; /* Acima do botão do menu que está em 20px */
        right: 20px !important;
        left: auto !important;
        top: auto !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 1.5rem !important;
        border-radius: 5px !important;
        border: 1px solid var(--hover-color, #12f7ff) !important;
        outline: 2px solid var(--bg-color, #0f0f0f) !important;
        box-shadow: var(--neon-box-shadow, 0 0 10px rgba(18, 247, 255, 0.3), 0 0 20px rgba(18, 247, 255, 0.2)) !important;
        padding: 0 !important;
        /* Desabilitar arrastar no mobile */
        cursor: pointer !important;
        user-select: none !important;
        touch-action: auto !important;
        /* Melhorar área de toque no mobile */
        -webkit-tap-highlight-color: rgba(18, 247, 255, 0.2);
        -webkit-touch-callout: none;
    }
    
    .chat-faq-float img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        border-radius: 3px !important;
        pointer-events: none; /* Garantir que o toque seja no botão, não na imagem */
    }
}

@media (max-width: 480px) {
    .chat-faq-container {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 110px; /* Acima do botão do menu (60px) + espaço */
    }
    
    .chat-faq-float {
        /* Posição fixa acima do botão do menu em telas pequenas */
        position: fixed !important;
        bottom: 70px !important; /* Acima do botão do menu que está em 20px */
        right: 20px !important;
        left: auto !important;
        top: auto !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.2rem !important;
        border-radius: 5px !important;
        border: 1px solid var(--hover-color, #12f7ff) !important;
        outline: 2px solid var(--bg-color, #0f0f0f) !important;
        box-shadow: var(--neon-box-shadow, 0 0 10px rgba(18, 247, 255, 0.3), 0 0 20px rgba(18, 247, 255, 0.2)) !important;
        padding: 0 !important;
        cursor: pointer !important;
    }
    
    .chat-faq-float img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        border-radius: 3px !important;
    }
}
