/* ============================================
   CHATBOT WIDGET - BALANÇAS SOLUTION 2026
   ============================================ */

/* Widget Container */
.chatbot-widget {
    position: fixed;
    bottom: 6rem;
    left: 2rem;
    z-index: 1100;
    font-family: var(--font-primary);
}

/* Trigger Button */
.chatbot-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--electric-cyan), var(--neon-teal));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(14, 165, 233, 0.5);
}

.chatbot-trigger.active {
    background: var(--slate-700);
}

.chatbot-trigger.active i::before {
    content: "\f00d";
    /* fa-times */
}

.chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Chat Container */
.chatbot-container {
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 360px;
    max-height: 500px;
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--midnight-blue), var(--ocean-blue));
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--electric-cyan), var(--neon-teal));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.chatbot-info {
    flex: 1;
}

.chatbot-info h4 {
    color: white;
    font-weight: 700;
    font-size: 1rem;
    margin: 0 0 0.25rem;
}

.chatbot-status {
    color: #10b981;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.chatbot-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Messages */
.chatbot-messages {
    padding: 1rem;
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--slate-300) transparent;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 3px;
}

.chatbot-message {
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

.chatbot-message.bot {
    align-self: flex-start;
}

.chatbot-message.user {
    align-self: flex-end;
}

.chatbot-message p {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-xl);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.chatbot-message.bot p {
    background: var(--slate-100);
    color: var(--slate-800);
    border-bottom-left-radius: var(--radius-sm);
}

.chatbot-message.user p {
    background: linear-gradient(135deg, var(--electric-cyan), var(--neon-teal));
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

/* Options */
.chatbot-options {
    padding: 1rem;
    background: var(--slate-50);
    border-top: 1px solid var(--slate-200);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chatbot-option {
    flex: 1 1 calc(50% - 0.25rem);
    padding: 0.75rem 1rem;
    border: 2px solid var(--slate-200);
    background: white;
    border-radius: var(--radius-lg);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--slate-700);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.chatbot-option:hover {
    border-color: var(--electric-cyan);
    background: rgba(14, 165, 233, 0.05);
    color: var(--electric-cyan);
}

.chatbot-option i {
    font-size: 0.9rem;
}

.chatbot-option.chatbot-whatsapp {
    flex: 1 1 100%;
    background: var(--whatsapp-green);
    border-color: var(--whatsapp-green);
    color: white;
}

.chatbot-option.chatbot-whatsapp:hover {
    background: var(--whatsapp-dark);
    border-color: var(--whatsapp-dark);
    color: white;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark Mode */
body.dark-mode .chatbot-container {
    background: var(--slate-800);
}

body.dark-mode .chatbot-messages {
    scrollbar-color: var(--slate-600) transparent;
}

body.dark-mode .chatbot-message.bot p {
    background: var(--slate-700);
    color: var(--slate-200);
}

body.dark-mode .chatbot-options {
    background: var(--slate-900);
    border-color: var(--slate-700);
}

body.dark-mode .chatbot-option {
    background: var(--slate-800);
    border-color: var(--slate-600);
    color: var(--slate-300);
}

body.dark-mode .chatbot-option:hover {
    background: rgba(14, 165, 233, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-widget {
        bottom: 5rem;
        left: 1rem;
        right: 1rem;
    }

    .chatbot-container {
        width: calc(100vw - 2rem);
        max-width: 360px;
    }

    .chatbot-trigger {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
}

/* Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .chatbot-container {
        transition: opacity 0.1s;
        transform: none;
    }

    .chatbot-message {
        animation: none;
    }

    .chatbot-badge {
        animation: none;
    }
}