/* ============================================
   CHATBOT FRONTEND - DESIGN MODERNO
   ============================================ */

#chatbot-bubble {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 28px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: pulse 2s infinite;
}

#chatbot-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

#chatbot-bubble:active {
    transform: scale(0.95);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.6), 0 0 0 8px rgba(102, 126, 234, 0.1);
    }
}

#chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 380px;
    max-width: calc(100vw - 50px);
    max-height: 600px;
    height: 600px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#chatbot-container.open {
    display: flex;
    transform: translateY(0) scale(1);
    opacity: 1;
}

#chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 20px;
    text-align: left;
    font-weight: 600;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Estilo da logo no header */
#chatbot-header-logo {
    background: transparent !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Remove qualquer fundo branco da logo */
#chatbot-header img {
    background: transparent !important;
    mix-blend-mode: normal;
}

#chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

#chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

#chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 14px;
    background: linear-gradient(to bottom, #f0f2f5 0%, #ffffff 100%);
    scroll-behavior: smooth;
}

#chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

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

#chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.user-msg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 16px;
    margin-bottom: 12px;
    margin-left: auto;
    border-radius: 18px 18px 4px 18px;
    max-width: 80%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    animation: slideInRight 0.3s ease;
}

.bot-msg {
    background: #ffffff !important;
    color: #1a1a1a !important;
    padding: 18px 22px;
    margin-bottom: 16px;
    border-radius: 16px;
    max-width: 90%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.08);
    border: none;
    animation: slideInLeft 0.3s ease, popUp 0.4s ease;
    position: relative;
    border-left: 5px solid #667eea;
    backdrop-filter: blur(10px);
}

/* Efeito de pop-up modal */
@keyframes popUp {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    50% {
        transform: scale(1.02) translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Garante que todo texto dentro da mensagem seja visível */
.bot-msg {
    color: #1a1a1a !important;
}

.bot-msg p,
.bot-msg div:not(.chatbot-btn):not(.chatbot-btn-sugestao):not(.btn-option):not(.chatbot-buttons):not(.chatbot-sugestoes),
.bot-msg span:not(.chatbot-btn):not(.chatbot-btn-sugestao):not(.btn-option) {
    color: #1a1a1a !important;
}

.bot-msg strong {
    color: #000 !important;
    font-weight: 700;
}

.bot-msg em {
    color: #333 !important;
    font-style: italic;
}

/* Exceção: botões devem manter cor branca */
.bot-msg .chatbot-btn,
.bot-msg .chatbot-btn-sugestao,
.bot-msg .btn-option,
.bot-msg button,
.bot-msg a.chatbot-btn,
.bot-msg a.chatbot-btn-sugestao {
    color: #fff !important;
}

/* ============================================
   PADRONIZAÇÃO DE TODOS OS BOTÕES DO CHATBOT
   ============================================ */

/* Garante que links e botões dentro das mensagens tenham estilo */
.bot-msg a,
.bot-msg button {
    color: inherit;
    text-decoration: none;
}

/* Padroniza TODOS os botões dentro do chatbot */
#chatbot-messages a,
#chatbot-messages button,
#chatbot-messages .chatbot-btn,
#chatbot-messages .chatbot-btn-sugestao,
#chatbot-messages .btn-option,
.bot-msg a,
.bot-msg button,
.bot-msg .chatbot-btn,
.bot-msg .chatbot-btn-sugestao,
.bot-msg .btn-option {
    display: block !important;
    width: 100% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 16px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
    text-decoration: none !important;
    margin-top: 8px !important;
    margin-bottom: 4px !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    white-space: normal !important;
}

/* Hover para todos os botões */
#chatbot-messages a:hover,
#chatbot-messages button:hover,
#chatbot-messages .chatbot-btn:hover,
#chatbot-messages .chatbot-btn-sugestao:hover,
#chatbot-messages .btn-option:hover,
.bot-msg a:hover,
.bot-msg button:hover,
.bot-msg .chatbot-btn:hover,
.bot-msg .chatbot-btn-sugestao:hover,
.bot-msg .btn-option:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4) !important;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
    color: #fff !important;
}

/* Botão de destaque (Contratar agora) */
#chatbot-messages .chatbot-btn-sugestao.destaque,
#chatbot-messages a.destaque,
.bot-msg .chatbot-btn-sugestao.destaque,
.bot-msg a.destaque {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%) !important;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3) !important;
}

#chatbot-messages .chatbot-btn-sugestao.destaque:hover,
#chatbot-messages a.destaque:hover,
.bot-msg .chatbot-btn-sugestao.destaque:hover,
.bot-msg a.destaque:hover {
    background: linear-gradient(135deg, #f7931e 0%, #ff6b35 100%) !important;
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4) !important;
}

/* Container de botões */
.bot-msg .chatbot-sugestoes,
#chatbot-messages .chatbot-sugestoes {
    margin-top: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

#chatbot-input-area {
    display: flex;
    align-items: center;
    border-top: 1px solid #e9ecef;
    background: #fff;
    padding: 12px 16px;
    gap: 8px;
}

#chatbot-input {
    flex: 1;
    border: 2px solid #e9ecef;
    padding: 12px 16px;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

#chatbot-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#chatbot-input::placeholder {
    color: #adb5bd;
}

#chatbot-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

#chatbot-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

#chatbot-send:active {
    transform: translateY(0);
}

#chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ----- Chat - melhorias de estilo ----- */
#farfale-chatbot { position: fixed; right: 20px; bottom: 20px; width: 360px; max-width: 90%; font-family: Inter, Arial, Helvetica, sans-serif; box-shadow: 0 8px 30px rgba(11,106,106,0.12); border-radius: 12px; overflow: hidden; z-index: 99999; }

/* header */
#fc-header { background:#0B6A6A; color:#fff; padding:12px 16px; font-weight:700; }

/* body */
#fc-body { background:#fff; padding:12px; height:320px; display:flex; flex-direction:column; }

/* mensagens */
#fc-messages { flex:1; overflow:auto; padding-bottom:8px; margin-bottom:8px; }
.fc-msg{ margin:8px 0; display:flex; flex-direction:column; }
.fc-msg.user { align-items:flex-end; }
.fc-msg.bot { align-items:flex-start; }

/* bubbles */
.fc-msg .fc-text{ max-width:80%; padding:10px 14px; border-radius:14px; font-size:14px; line-height:1.35; display:inline-block; }
.fc-msg.user .fc-text{ background:#e6f7ff; color:#073642; border-bottom-right-radius:4px; }
.fc-msg.bot .fc-text{ background:#f5f7f8; color:#333; border-bottom-left-radius:4px; }

/* actions (botões que aparecem dentro do bubble) */
.fc-actions { margin-top:8px; display:flex; flex-wrap:wrap; gap:8px; }
.fc-action-btn { display:inline-block; padding:8px 12px; border-radius:20px; background:#0B6A6A; color:#fff; text-decoration:none; font-size:13px; transition:transform .08s ease, box-shadow .08s ease; box-shadow: 0 4px 12px rgba(11,106,106,0.12);}
.fc-action-btn:hover{ transform:translateY(-2px); box-shadow: 0 8px 18px rgba(11,106,106,0.14); }
.fc-action-btn.secondary { background:#f5f5f5; color:#0b6a6a; border:1px solid #e9e9e9; }

/* contexto: sugestões rápidas (quick replies) */
#fc-quick { margin-top:6px; display:flex; gap:8px; flex-wrap:wrap; }
.fc-quick-btn { background:#f0f6f6; border:none; padding:8px 10px; border-radius:18px; cursor:pointer; font-size:13px; color:#0b6a6a; }

/* typing indicator */
.fc-typing { display:flex; align-items:center; gap:6px; padding:8px 12px; background:#f5f5f5; border-radius:12px; }
.fc-typing .dot { width:7px; height:7px; border-radius:50%; background:#999; opacity:0.6; animation: blink 1s infinite; }
@keyframes blink { 0% {opacity:0.2} 50% {opacity:1} 100% {opacity:0.2} }

/* destaque do botão contratar */
.chatbot-btn-sugestao.destaque { background:#ff6b35 !important; color:#fff !important; }

/* responsividade */
@media (max-width:420px) {
  #farfale-chatbot { width: 94%; right: 3%; bottom: 12px; }
}

/* Container dos botões */
.chatbot-buttons {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 100%;
    box-sizing: border-box;
}

/* Botões individuais */
.btn-option {
    display: block;
    text-align: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    word-wrap: break-word;
    white-space: normal;
}

/* Hover */
.btn-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-option:active {
    transform: translateY(0);
}

.chatbot-btn {
    display: block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    padding: 12px 16px;
    margin-top: 8px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    width: 100%;
    box-sizing: border-box;
}

.chatbot-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: #fff !important;
}

.chatbot-btn:active {
    transform: translateY(0);
}

/* Botões de sugestão */
.chatbot-btn-sugestao {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    padding: 10px 16px;
    margin: 6px 6px 6px 0;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chatbot-btn-sugestao:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: #fff !important;
}

.chatbot-btn-sugestao.destaque {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%) !important;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.chatbot-btn-sugestao.destaque:hover {
    background: linear-gradient(135deg, #f7931e 0%, #ff6b35 100%) !important;
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4);
}

.chatbot-sugestoes {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bot-msg p {
    margin: 8px 0;
    line-height: 1.7;
    display: block;
    color: #1a1a1a !important;
}

.bot-msg br {
    margin-bottom: 8px;
}

.bot-msg ul,
.bot-msg ol {
    margin: 10px 0;
    padding-left: 20px;
    color: #1a1a1a !important;
}

.bot-msg li {
    margin: 6px 0;
    color: #1a1a1a !important;
    line-height: 1.6;
}

/* Força texto visível em TODOS os elementos dentro de .bot-msg (exceto botões) */
#chatbot-messages .bot-msg,
#chatbot-messages .bot-msg *:not(.chatbot-btn):not(.chatbot-btn-sugestao):not(.btn-option):not(button):not(a.chatbot-btn):not(a.chatbot-btn-sugestao):not(a.btn-option):not(.chatbot-buttons):not(.chatbot-sugestoes):not(.typing-indicator):not(.typing-dot) {
    color: #1a1a1a !important;
}

/* Garante que HTML dentro das mensagens seja visível */
#chatbot-messages .bot-msg h1,
#chatbot-messages .bot-msg h2,
#chatbot-messages .bot-msg h3,
#chatbot-messages .bot-msg h4,
#chatbot-messages .bot-msg h5,
#chatbot-messages .bot-msg h6 {
    color: #000 !important;
    font-weight: 700;
    margin: 10px 0 8px 0;
}

/* Força cor do texto diretamente na mensagem - REGRA MAIS ESPECÍFICA */
#chatbot-container #chatbot-messages .bot-msg,
#chatbot-container #chatbot-messages .bot-msg > * {
    color: #1a1a1a !important;
}

/* Remove qualquer estilo inline que possa estar sobrescrevendo */
#chatbot-messages .bot-msg[style*="color"] {
    color: #1a1a1a !important;
}

/* Garante que links de texto (não botões) sejam visíveis */
#chatbot-messages .bot-msg a:not(.chatbot-btn):not(.chatbot-btn-sugestao):not(.btn-option) {
    color: #667eea !important;
    text-decoration: underline;
}

#chatbot-messages .bot-msg a:not(.chatbot-btn):not(.chatbot-btn-sugestao):not(.btn-option):hover {
    color: #764ba2 !important;
}

/* Indicador de "digitando..." */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 18px 18px 18px 4px;
    border: 1px solid #e9ecef;
    max-width: 85px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.typing-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #667eea;
    animation: typing-blink 1.4s infinite;
}

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

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-blink {
    0%, 60%, 100% {
        opacity: 0.4;
        transform: scale(0.9);
    }
    30% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Responsividade */
@media (max-width: 480px) {
    #chatbot-container {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 90px;
        height: calc(100vh - 110px);
        max-height: calc(100vh - 110px);
    }
    
    #chatbot-bubble {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    
    .user-msg,
    .bot-msg {
        max-width: 90%;
    }
}

