/* === CHATBOT WIDGET STYLES === */

.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Botão Flutuante do Chat */
.chat-button {
    position:relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3);
    transition: transform 0.3s ease;

}

.chat-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(37, 211, 102, 0.4);
}

.chat-button:active {
    transform: translateY(-1px);
}

.chat-button.chat-open {
    background: linear-gradient(135deg, #ff4757 0%, #c44569 100%);
}

.chat-icon, .close-icon {
    width: 24px;
    height: 24px;
    color: white;
    transition: all 0.3s ease;
}

/* Badge de Notificação */
.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 3px solid white;
    animation: pulse 2s infinite;
}

.chat-badge.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Janela do Chat */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: var(--bg-primary, white);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color, #e1e5e9);
    animation: chatSlideUp 0.3s ease;
}

.chat-window.show {
    display: flex;
}

.chat-window.minimized {
    height: 60px;
}

.chat-window.minimized .chat-messages,
.chat-window.minimized .quick-suggestions,
.chat-window.minimized .chat-input-area {
    display: none;
}

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

/* Header do Chat */
.chat-header {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-info {
    flex: 1;
}

.chat-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-status.online::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: blink 2s infinite;
}

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

.chat-actions {
    display: flex;
    gap: 5px;
}

.minimize-btn, .close-chat-btn {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.minimize-btn:hover, .close-chat-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Área de Mensagens */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: var(--bg-secondary, #f8f9fa);
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color, #ccc);
    border-radius: 2px;
}

/* Mensagens */
.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: messageSlideIn 0.3s ease;
}

.message.user-message {
    flex-direction: row-reverse;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--accent-color, #667eea);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-message .message-avatar {
    background: var(--success-color, #28a745);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.message-content {
    max-width: 70%;
}

.bot-message .message-content {
    background: white;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.user-message .message-content {
    background: var(--accent-color, #667eea);
    color: white;
    border-radius: 18px 18px 4px 18px;
    padding: 12px 16px;
}

.message-content p {
    margin: 0;
    line-height: 1.4;
    color: inherit;
}

.message-time {
    font-size: 10px;
    color: var(--text-muted, #999);
    display: block;
    margin-top: 4px;
}

.user-message .message-time {
    color: rgba(255,255,255,0.8);
}

/* Sugestões Rápidas */
.quick-suggestions {
    padding: 15px 20px;
    background: var(--bg-primary, white);
    border-top: 1px solid var(--border-color, #e1e5e9);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-btn {
    background: var(--bg-secondary, #f8f9fa);
    border: 1px solid var(--border-color, #e1e5e9);
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary, #666);
}

.suggestion-btn:hover {
    background: var(--accent-color, #667eea);
    color: white;
    border-color: var(--accent-color, #667eea);
}

/* Área de Input */
.chat-input-area {
    background: var(--bg-primary, white);
    border-top: 1px solid var(--border-color, #e1e5e9);
    padding: 15px 20px;
}

.chat-input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 25px;
    padding: 5px;
    border: 1px solid var(--border-color, #e1e5e9);
}

#chatInput {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 15px;
    outline: none;
    font-size: 14px;
    color: var(--text-primary, #333);
}

#chatInput::placeholder {
    color: var(--text-muted, #999);
}

.send-btn {
    width: 35px;
    height: 35px;
    background: var(--accent-color, #667eea);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.send-btn svg {
    width: 16px;
    height: 16px;
}

/* Chat Footer */
.chat-footer {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.typing-indicator {
    font-size: 12px;
    color: var(--text-muted, #999);
    display: flex;
    align-items: center;
    gap: 5px;
}

.typing-indicator span:nth-child(1),
.typing-indicator span:nth-child(2),
.typing-indicator span:nth-child(3) {
    width: 4px;
    height: 4px;
    background: var(--text-muted, #999);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Botão WhatsApp */
.whatsapp-btn {
    background: #25d366;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.whatsapp-btn:hover {
    background: #128c7e;
    transform: translateY(-1px);
}

.whatsapp-btn svg {
    width: 14px;
    height: 14px;
}

/* Notificação */
.chat-notification {
    position: absolute;
    bottom: 85px;
    right: 70px;
    background: var(--bg-primary, white);
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color, #e1e5e9);
    min-width: 200px;
    animation: notificationSlide 0.3s ease;
}

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

.notification-content strong {
    color: var(--text-primary, #333);
    font-size: 13px;
}

.notification-content p {
    margin: 4px 0 0 0;
    color: var(--text-secondary, #666);
    font-size: 12px;
}

/* Dark Mode Support */
[data-theme="dark"] .chat-window {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .chat-messages {
    background: var(--bg-secondary);
}

[data-theme="dark"] .bot-message .message-content {
    background: var(--bg-accent);
    color: var(--text-primary);
}

[data-theme="dark"] .chat-notification {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

/* Responsividade */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        max-width: 350px;
    }
    
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .message-content {
        max-width: 85%;
    }
}

/* Estados de carregamento */
.loading-message {
    opacity: 0.7;
}

.loading-message::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 5px;
    border: 2px solid #ddd;
    border-top-color: var(--accent-color, #667eea);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}