/* SmartCatálogo AI - Chat Widget - VERSÃO v3 */

#smart-chat-widget,
#smart-chat-widget * {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
}

:root {
    --chat-primary-color: #6366f1;
}

#smart-chat-widget {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    z-index: 99999 !important;
}

#smart-chat-widget.chat-position-esquerda {
    right: auto !important;
    left: 20px !important;
}

/* BOTÃO DO CHAT - DESKTOP (60% MENOR) */
#smart-chat-widget .chat-toggle {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: var(--chat-primary-color) !important;
    border: none !important;
    color: white !important;
    font-size: 16px !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    z-index: 100000 !important;
}

#smart-chat-widget .chat-toggle:hover {
    transform: scale(1.1) !important;
}

#smart-chat-widget .chat-toggle.is-open {
    background: #ef4444 !important;
}

#smart-chat-widget .chat-container {
    position: fixed !important;
    bottom: 70px !important;
    right: 20px !important;
    width: 340px !important;
    height: 400px !important;
    max-width: calc(100vw - 40px) !important;
    max-height: 70vh !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16) !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: 99998 !important;
}

#smart-chat-widget .chat-header {
    background: var(--chat-primary-color) !important;
    color: white !important;
    padding: 12px 14px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

#smart-chat-widget .chat-header-info {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 1 !important;
}

#smart-chat-widget .chat-avatar {
    width: 32px !important;
    height: 32px !important;
    background: rgba(255,255,255,0.2) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
}

#smart-chat-widget .chat-title {
    font-weight: 600 !important;
    font-size: 13px !important;
}

#smart-chat-widget .chat-status {
    font-size: 10px !important;
    opacity: 0.9 !important;
}

#smart-chat-widget .chat-close-btn {
    background: rgba(255,255,255,0.2) !important;
    border: none !important;
    color: white !important;
    font-size: 20px !important;
    cursor: pointer !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#smart-chat-widget .chat-close-btn:hover {
    background: rgba(255,255,255,0.3) !important;
}

#smart-chat-widget .chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    background: #f8fafc !important;
}

#smart-chat-widget .message {
    display: flex !important;
}

#smart-chat-widget .user-message {
    justify-content: flex-end !important;
}

#smart-chat-widget .user-message div {
    background: var(--chat-primary-color) !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 14px 14px 4px 14px !important;
    max-width: 80% !important;
    word-break: break-word !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
}

#smart-chat-widget .bot-message {
    justify-content: flex-start !important;
}

#smart-chat-widget .bot-message div {
    background: white !important;
    color: #1e293b !important;
    padding: 8px 12px !important;
    border-radius: 14px 14px 14px 4px !important;
    border: 1px solid #e2e8f0 !important;
    max-width: 85% !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
    white-space: normal !important;
    word-break: break-word !important;
}

#smart-chat-widget .chat-image {
    max-width: 100% !important;
    max-height: 120px !important;
    border-radius: 8px !important;
    margin: 4px 0 !important;
}

#smart-chat-widget .typing-dots {
    display: flex !important;
    gap: 4px !important;
    padding: 4px 0 !important;
}

#smart-chat-widget .typing-dots span {
    width: 5px !important;
    height: 5px !important;
    background: #94a3b8 !important;
    border-radius: 50% !important;
    animation: chatTyping 1.4s infinite !important;
}

#smart-chat-widget .typing-dots span:nth-child(2) { animation-delay: 0.2s !important; }
#smart-chat-widget .typing-dots span:nth-child(3) { animation-delay: 0.4s !important; }

@keyframes chatTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.7; }
    30% { transform: translateY(-5px); opacity: 1; }
}

#smart-chat-widget .chat-input-area {
    padding: 8px 10px !important;
    background: white !important;
    border-top: 1px solid #e2e8f0 !important;
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
}

#smart-chat-widget .chat-input {
    flex: 1 !important;
    padding: 8px 12px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 18px !important;
    outline: none !important;
    font-size: 13px !important;
}

#smart-chat-widget .chat-input:focus {
    border-color: var(--chat-primary-color) !important;
}

#smart-chat-widget .chat-send {
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    background: var(--chat-primary-color) !important;
    border: none !important;
    color: white !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
}

#smart-chat-widget .chat-powered {
    text-align: center !important;
    font-size: 9px !important;
    color: #94a3b8 !important;
    padding: 4px !important;
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
}

/* =========================================
   BOTÃO "VER PRODUTO" ESTILIZADO
   ========================================= */

#smart-chat-widget .chat-link {
    display: inline-block !important;
    background: var(--chat-primary-color, #6366f1) !important;
    color: white !important;
    padding: 6px 14px !important;
    border-radius: 16px !important;
    border: none !important;
    text-decoration: none !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    margin-top: 6px !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
}

#smart-chat-widget .chat-link:hover {
    background: #4f46e5 !important;
    transform: scale(1.02) !important;
}

#smart-chat-widget .user-message .chat-link {
    background: rgba(255,255,255,0.2) !important;
    border: 1px solid rgba(255,255,255,0.5) !important;
}

#smart-chat-widget .user-message .chat-link:hover {
    background: rgba(255,255,255,0.3) !important;
}

/* MOBILE - ESCONDE CHAT COMPLETAMENTE */
@media screen and (max-width: 768px) {
    #smart-chat-widget .chat-container {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
    }

    #smart-chat-widget {
        bottom: 16px !important;
        right: 16px !important;
    }

    #smart-chat-widget .chat-toggle {
        width: 46px !important;
        height: 46px !important;
        font-size: 20px !important;
    }
}

@media print {
    #smart-chat-widget {
        display: none !important;
    }
}
