/* SmartChat v6.0.0 -  Chat Autônomo 24/7
/* Header do chat */
[id*="aichatsmart_defaultdefault"][id$="-header"] {
    background-color: #9f740e;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
    position: relative;
    min-height: 60px;
}

[id*="aichatsmart_defaultdefault"][id$="-header"]::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1), transparent);
}

/* Imagem do header */
[id*="aichatsmart_default"][id$="-header-image"] {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Container do conteúdo do header */
[id*="aichatsmart_default"][id$="-header-content"] {
    display: flex;
    align-items: center;
    flex: 1;
}

[id*="aichatsmart_default"][id$="-header-text"] {
    display: flex;
    flex-direction: column;
}

[id*="aichatsmart_default"][id$="-header"] h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

[id*="aichatsmart_default"][id$="-header"] small {
    font-size: 12px;
    opacity: 0.9;
    display: block;
    margin-top: 2px;
}

[id*="aichatsmart_default"][id$="-close"] {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
}

[id*="aichatsmart_default"][id$="-close"]:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

[id*="aichatsmart_default"][id$="-close"]:active {
    transform: scale(0.9);
}

/* Formulário de informações do usuário */
[id*="aichatsmart_default"][id$="-user-info-form"] {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
}

[id*="aichatsmart_default"][id$="-user-info-form"] h5 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-size: 16px;
    font-weight: 600;
}

[id*="aichatsmart_default"][id$="-user-info-form"] input {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

[id*="aichatsmart_default"][id$="-user-info-form"] input:focus {
    outline: none;
    border-color: #9f740e;
    box-shadow: 0 0 0 3px rgba(159, 116, 14, 0.1);
}

[id*="aichatsmart_default"][id$="-start-chat"] {
    width: 100%;
    padding: 12px;
    background-color: #9f740e;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

[id*="aichatsmart_default"][id$="-start-chat"]:hover {
    background-color: #8a6308;
    transform: translateY(-1px);
}

[id*="aichatsmart_default"][id$="-start-chat"]:active {
    transform: translateY(0);
}

/* Área de mensagens */
[id*="aichatsmart_default"][id$="-messages"] {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
    position: relative;
    z-index: 1;
}

[id*="aichatsmart_default"][id$="-messages"]::-webkit-scrollbar {
    width: 6px;
}

[id*="aichatsmart_default"][id$="-messages"]::-webkit-scrollbar-track {
    background: transparent;
}

[id*="aichatsmart_default"][id$="-messages"]::-webkit-scrollbar-thumb {
    background-color: #cbd5e0;
    border-radius: 3px;
}

[id*="aichatsmart_default"][id$="-messages"]::-webkit-scrollbar-thumb:hover {
    background-color: #a0aec0;
}

/* Mensagens */
.ai-message, .user-message {
    max-width: 85% !important;
    padding: 12px 16px !important;
    border-radius: 18px !important;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word !important;
    animation: messageSlide 0.3s ease-out !important;
    position: relative;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px) !important;
    }
    to {
        opacity: 1;
        transform: translateY(0) !important;
    }
}

.ai-message {
    background-color: white;
    color: #2d3748;
    align-self: flex-start;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 18px 18px 18px 4px;
}

.user-message {
    background-color: #e5e7eb;
    color: #374151;
    align-self: flex-end !important;
    margin-left: auto;
    border-radius: 18px 18px 4px 18px;
    position: relative;
}

/* Balão de conversa para mensagens do usuário */
.user-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-left-color: #e5e7eb;
    border-bottom: 0;
    border-right: 0;
}

.ai-message::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right-color: white;
    border-bottom: 0;
    border-left: 0;
}

/* Botão WhatsApp nas mensagens */
.ai-whats-btn {
    display: inline-block;
    background: #25d366 !important;
    color: white !important;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 500;
    margin: 8px 0;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(37, 211, 102, 0.3);
    line-height: 1;
}

.ai-whats-btn:hover {
    background: #128c7e !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 211, 102, 0.4);
    text-decoration: none;
}

/* Indicador de digitação */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    align-self: flex-start;
    border: 1px solid #e2e8f0;
    max-width: 60px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #9f740e;
    border-radius: 50%;
    animation: typingPulse 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 typingPulse {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Container do input - FIXO NO BOTTOM */
[id*="aichatsmart_default"][id$="-input-container"] {
    display: flex;
    padding: 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    gap: 12px;
    align-items: flex-end;
    width: 100%;
    position: relative;
    z-index: 2;
    border-radius: 0 0 16px 16px;
    margin-left:20px;
}

/* Wrapper da imagem do header - círculo branco */
[id*="aichatsmart_default"][id$="-header-image-wrapper"] {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.5);
    overflow: hidden;
    margin-right: 10px;
}

/* Imagem do header - ajustada para ficar dentro do círculo */
[id*="aichatsmart_default"][id$="-header-image"] {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    margin: 0;
}

[id*="aichatsmart_default"][id$="-button"] svg {
    fill: #ffffff !important; /* Garante que o preenchimento seja branco */
    stroke: #ffffff !important; /* Garante que o contorno seja branco, se houver */
}

[id*="aichatsmart_default"][id$="-send"] svg {
    fill: #ffffff !important; /* Garante que o preenchimento seja branco */
    stroke: #ffffff !important; /* Garante que o contorno seja branco, se houver */
}

/* Responsivo para mobile */
@media (max-width: 480px) {
    [id*="aichatsmart_default"][id$="-header-image-wrapper"] {
        width: 36px;
        height: 36px;
        margin-right: 8px;
    }

    [id*="aichatsmart_default"][id$="-header-image"] {
        width: 28px;
        height: 28px;
    }
}

/* Campo de input */
[id*="aichatsmart_default"][id$="-input"] {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    resize: none;
    font-family: inherit;
    background: #f7fafc;
    min-height: 20px;
    max-height: 100px;
    width: 100%;
}

[id*="aichatsmart_default"][id$="-input"]:focus {
    border-color: #9f740e;
    box-shadow: 0 0 0 3px rgba(159, 116, 14, 0.1);
    background: white;
}

[id*="aichatsmart_default"][id$="-input"]::placeholder {
    color: #a0aec0;
}

[id*="aichatsmart_default"][id$="-input"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Botão de envio */
[id*="aichatsmart_default"][id$="-send"] {
    width: 44px;
    height: 44px;
    background-color: #9f740e;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;   
    transition: all 0.2s ease;    
    outline: none;
    padding:0 !important;
    position: relative;
}

[id*="aichatsmart_default"][id$="-send"]:hover:not(:disabled) {
    background-color: #8a6308;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(159, 116, 14, 0.3);
}

[id*="aichatsmart_default"][id$="-send"]:active:not(:disabled) {
    transform: scale(0.95);
}

[id*="aichatsmart_default"][id$="-send"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Ícone do botão de envio - BRANCO */
[id*="aichatsmart_default"][id$="-send"] svg {
    width: 20px !important;
    height: 20px !important;
    transition: transform 0.2s ease;
    fill: white !important;
    stroke: white !important;
    stroke-width: 1.5;
    position: absolute;
    top: 13px;
    left: 20px;
}

[id$="-send"] svg {
    margin-left:-10px;
}

[id*="aichatsmart_default"][id$="-send"]:hover:not(:disabled) svg {
    transform: translateX(2px);
}

/* Responsividade para mobile */
@media (max-width: 480px) {
    [id*="aichatsmart_default"][id$="-container"] {
        bottom: 15px;
        right: 15px;
        left: 15px;
    }

    [id*="aichatsmart_default"][id$="-window"] {
        width: 100%;
        height: 70vh;
        max-height: 500px;
        bottom: 80px;
        right: 0;
        left: 0;
    }

    [id*="aichatsmart_default"][id$="-button"] {
        width: 56px;
        height: 56px;
        margin-left: auto;
    }

    [id*="aichatsmart_default"][id$="-button"] svg {
        width: 24px;
        height: 24px;
    }

    .ai-message, .user-message {
        max-width: 90%;
        font-size: 14px;
    }

    [id*="aichatsmart_default"][id$="-messages"] {
        padding: 15px;
        gap: 10px;
    }

    [id*="aichatsmart_default"][id$="-input-container"] {
        padding: 15px;
        gap: 10px;
    }

    [id*="aichatsmart_default"][id$="-header"] {
        padding: 16px 20px;
    }

    [id*="aichatsmart_default"][id$="-header"] h4 {
        font-size: 15px;
    }

    [id*="aichatsmart_default"][id$="-header"] small {
        font-size: 11px;
    }

    [id*="aichatsmart_default"][id$="-send"] svg {
        width: 18px !important;
        height: 18px !important;
    }

    [id*="aichatsmart_default"][id$="-header-image"] {
        width: 32px;
        height: 32px;
        margin-right: 8px;
    }

    [id*="aichatsmart_default"][id$="-user-info-form"] {
        padding: 15px;
    }
}

/* Animações de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Aplicar animação ao botão quando carregado */
[id*="aichatsmart_default"][id$="-button"] {
    animation: bounceIn 0.6s ease-out;
}

/* Estados de foco para acessibilidade */
[id*="aichatsmart_default"][id$="-button"]:focus-visible,
[id*="aichatsmart_default"][id$="-close"]:focus-visible,
[id*="aichatsmart_default"][id$="-send"]:focus-visible {
    outline: 2px solid #9f740e;
    outline-offset: 2px;
}

[id*="aichatsmart_default"][id$="-input"]:focus-visible {
    outline: none;
}

.icon {
    color: #fff;
    fill:#fff;
}

/* Melhorias de contraste */
.ai-message {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
}

/* Suavização de texto */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevenção de seleção indevida */
[id*="aichatsmart_default"][id$="-button"],
[id*="aichatsmart_default"][id$="-close"],
[id*="aichatsmart_default"][id$="-send"] {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Estilo para links nas mensagens */
.ai-message a,
.user-message a {
    color: inherit;
    text-decoration: none;
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    margin: 5px 0;
    cursor: pointer;
}

.ai-message a:hover,
.user-message a:hover {
    text-decoration: none;
}

/* Compatibilidade com temas WordPress */
[id*="aichatsmart_default"] * {
    box-sizing: border-box;
}

/* Garantir que o chat não seja afetado por estilos globais */
[id*="aichatsmart_default"] {
    all: initial;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

[id*="aichatsmart_default"] * {    
    display: revert;
    box-sizing: border-box;
}

/* Estilos específicos para abas da página de administração */
.aichatsmart-admin-tab {
    padding: 30px !important;
}

/* Melhorias para a página de status */
.aichatsmart-status-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.aichatsmart-status-button {
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.aichatsmart-status-button.primary {
    background: #0073aa;
    color: white;
}

.aichatsmart-status-button.secondary {
    background: #f0f0f1;
    color: #2c3338;
    border: 1px solid #c3c4c7;
}

.aichatsmart-status-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#aichatsmart_default-window{
    max-height: 60vh;
}

#aichatsmart_default-window {
    display: flex;
    position: absolute;
    bottom: 80px;
    right: 0px;
    width: 360px;
    height: 70vh;
    background: white;
    border-radius: 16px;
    box-shadow: rgba(0, 0, 0, 0.15) 0px 10px 40px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    opacity: 1 !important;
    visibility: visible !important;
}

/* Garante que o SVG não suma */
#aichatsmart_default--send svg {
    display: block !important;
    visibility: visible !important;
    width: 26px !important;
    height: 26px !important;
    color: white !important;
    stroke: white !important;
}

#aichatsmart_default--send {    
     width: 34px !important;
     height: 34px !important;
     border: none !important;
     border-radius: 50% !important;
     cursor: pointer !important;
     display: flex !important;
     align-items: center !important;
     justify-content: center !important;
     color: white !important;
}

/* Animação de pulinhos */
@keyframes smartChatBounce {
    0%, 100% { transform: translateY(0); }
    15% { transform: translateY(-15px); }
    30% { transform: translateY(0); }
    45% { transform: translateY(-8px); }
    60% { transform: translateY(0); }
}

#aichatsmart_default-button {
    width: 60px;
    height: 60px;
    background-color: #0039ed;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: smartChatBounce 3s ease infinite;
    /* Opcional: melhora a fluidez em navegadores mobile */
    will-change: transform;
    transition: transform 0.3s ease;
    padding:0 !important;    
}

/* Pausa a animação ao passar o mouse para dar feedback ao usuário */
#aichatsmart_default-button:hover {
    animation-play-state: paused;
    transform: scale(1.1); /* Um leve zoom ao passar o mouse */
}