/* ==========================================
   CHATBOT AI - FRONTEND STYLES
   Design moderno, responsivo e chamativo
   Dopamine colors: Azul (#3B82F6) e Roxo (#8b5cf6)
   ========================================== */

:root {
    --chatbot-primary: #3B82F6;
    --chatbot-secondary: #8b5cf6;
    --chatbot-bg: #ffffff;
    --chatbot-text: #1F2937;
    --chatbot-light: #F3F4F6;
    --chatbot-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* Widget Container */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Toggle Button */
.chatbot-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    border: none;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    animation: chatbot-pulse 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 50px rgba(59, 130, 246, 0.4);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-icon,
.chatbot-icon-close {
    width: 32px;
    height: 32px;
    color: white;
    transition: all 0.3s ease;
}

.chatbot-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg);
}

.chatbot-toggle.active .chatbot-icon {
    opacity: 0;
    transform: rotate(90deg);
}

.chatbot-toggle.active .chatbot-icon-close {
    opacity: 1;
    transform: rotate(0deg);
}

/* Notification Badge */
.chatbot-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 24px;
    height: 24px;
    background: #EF4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 3px solid white;
    animation: chatbot-bounce 1s ease-in-out infinite;
}

.chatbot-notification-badge.hidden {
    display: none;
}

/* Chat Container */
.chatbot-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 600px;
    background: var(--chatbot-bg);
    border-radius: 20px;
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-container.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* Chat Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    position: relative;
    overflow: hidden;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: chatbot-header-glow 3s ease-in-out infinite;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.chatbot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chatbot-avatar svg {
    width: 24px;
    height: 24px;
    color: white;
}

.chatbot-header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
}

.chatbot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10B981;
    border-radius: 50%;
    animation: chatbot-pulse-dot 2s ease-in-out infinite;
}

.chatbot-minimize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.chatbot-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.chatbot-minimize svg {
    width: 20px;
    height: 20px;
    color: white;
}

/* Lead Form */
.chatbot-lead-form {
    padding: 30px 20px;
    background: linear-gradient(180deg, #F9FAFB 0%, #ffffff 100%);
    border-bottom: 1px solid #E5E7EB;
    display: none;
}

.chatbot-lead-form.active {
    display: block;
}

.lead-form-content h4 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: var(--chatbot-text);
}

.lead-form-content p {
    margin: 0 0 20px 0;
    color: #6B7280;
    font-size: 14px;
}

.form-field {
    margin-bottom: 15px;
}

.form-field input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-field input:focus {
    outline: none;
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.lead-submit-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.lead-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.lead-submit-btn svg {
    width: 20px;
    height: 20px;
}

/* Chat Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #FAFAFA;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

.chatbot-message {
    display: flex;
    gap: 12px;
    animation: chatbot-message-in 0.4s ease-out;
}

.chatbot-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.message-avatar.bot {
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
}

.message-avatar.user {
    background: #6B7280;
}

.message-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

.message-content {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message.bot .message-content {
    background: white;
    color: var(--chatbot-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chatbot-message.user .message-content {
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    color: white;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.chatbot-typing {
    display: none;
    padding: 14px 18px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    margin: 0 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chatbot-typing.active {
    display: flex;
    gap: 6px;
    animation: chatbot-message-in 0.3s ease-out;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--chatbot-primary);
    border-radius: 50%;
    animation: chatbot-typing-dot 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Input Wrapper */
.chatbot-input-wrapper {
    border-top: 1px solid #E5E7EB;
    background: white;
    padding: 16px 20px 12px 20px;
}

.chatbot-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #E5E7EB;
    border-radius: 24px;
    font-size: 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--chatbot-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.chatbot-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.chatbot-send-btn:active {
    transform: scale(0.95);
}

.chatbot-send-btn svg {
    width: 22px;
    height: 22px;
    color: white;
}

.chatbot-footer-text {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: #9CA3AF;
}

/* Animations */
@keyframes chatbot-pulse {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 10px 40px rgba(139, 92, 246, 0.5), 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
}

@keyframes chatbot-bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

@keyframes chatbot-message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes chatbot-typing-dot {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

@keyframes chatbot-pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.9);
    }
}

@keyframes chatbot-header-glow {
    0%, 100% {
        transform: translate(-25%, -25%);
    }
    50% {
        transform: translate(-30%, -30%);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .chatbot-container {
        width: 100%;
        height: calc(100vh - 80px);
        max-height: 650px;
        bottom: 70px;
        border-radius: 16px;
    }
    
    .message-content {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .chatbot-container {
        bottom: 70px;
        right: 0;
        left: 0;
        width: calc(100vw - 20px);
        margin: 0 10px;
        height: calc(100vh - 100px);
        max-height: 600px;
        border-radius: 16px;
    }
    
    .chatbot-toggle {
        width: 56px;
        height: 56px;
    }
    
    .chatbot-icon,
    .chatbot-icon-close {
        width: 28px;
        height: 28px;
    }
}
