/* ============================================
   eMerchan - Chat Widget Styles
   Usa CSS variables do tema (dark/light)
   ============================================ */

/* Botao flutuante */
.chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--gradient-green);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(79, 138, 92, 0.5);
}

.chat-toggle-icon,
.chat-toggle-close {
    font-size: 24px;
    line-height: 1;
    color: #fff;
}

/* Painel do chat */
.chat-panel {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 380px;
    max-height: 520px;
    background: var(--surface-card);
    border: 1px solid var(--outline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.25s ease;
}

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

/* Header do chat */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--outline);
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
}

.chat-header strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.chat-status {
    font-size: 0.75rem;
    color: var(--em-green-light);
}

/* Area de mensagens */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 280px;
    max-height: 340px;
}

/* Baloes de mensagem */
.chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-msg-bot {
    align-self: flex-start;
    background: var(--surface-elevated);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-msg-user {
    align-self: flex-end;
    background: var(--em-green);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Indicador de digitando */
.chat-typing {
    align-self: flex-start;
    padding: 10px 14px;
    background: var(--surface-elevated);
    border-radius: var(--radius-md);
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.chat-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    background: var(--text-muted);
    animation: typingBounce 1.2s infinite;
}

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

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Area de input */
.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--outline);
    background: var(--surface-card);
}

.chat-input-area input {
    flex: 1;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--outline);
    background: var(--surface-dark);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast);
}

.chat-input-area input:focus {
    border-color: var(--em-green);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--gradient-green);
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--transition-fast);
}

.chat-send-btn:hover {
    opacity: 0.85;
}

/* Filter Pills */
.filter-pill {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--outline);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-pill:hover {
    border-color: var(--em-green);
    color: var(--em-green-light);
}

.filter-pill.active {
    background: var(--em-green);
    border-color: var(--em-green);
    color: #fff;
    font-weight: 500;
}

/* Responsivo */
@media (max-width: 768px) {
    .chat-panel {
        width: calc(100vw - 32px);
        right: 16px;
        bottom: 76px;
        max-height: 60vh;
    }

    .chat-toggle {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }

    .chat-toggle-icon,
    .chat-toggle-close {
        font-size: 20px;
    }

    .chat-messages {
        min-height: 120px;
        max-height: 40vh;
        padding: 12px;
        gap: 8px;
    }

    .chat-msg {
        max-width: 90%;
        font-size: 0.84rem;
        padding: 8px 12px;
    }

    .chat-header {
        padding: 10px 12px;
    }

    .chat-input-area {
        padding: 8px 12px;
    }

    .chat-input-area input {
        padding: 8px 12px;
        font-size: 0.84rem;
    }

    .chat-send-btn {
        width: 36px;
        height: 36px;
    }
}
