/* ========================================
   CHAT WIDGET
   ======================================== */

.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    max-height: 500px;
    background: var(--cinza-escuro);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    border: 2px solid var(--dourado);
    overflow: hidden;
    z-index: 1500;
    transition: var(--transition);
}

.chat-widget.minimized {
    max-height: 60px;
}

.chat-widget.minimized .chat-body {
    display: none;
}

.chat-header {
    background: linear-gradient(135deg, var(--verde), #00b347);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header-info svg {
    color: var(--branco);
    width: 20px;
    height: 20px;
}

.chat-header-info h4 {
    color: var(--branco);
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.status {
    font-size: 0.7rem;
    color: var(--branco);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--branco);
    animation: blink 2s infinite;
}

.status.online::before {
    background: #00ff00;
}

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

.chat-toggle {
    background: transparent;
    border: none;
    color: var(--branco);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.chat-body {
    display: flex;
    flex-direction: column;
    height: 420px;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--preto);
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: messageSlide 0.3s ease-out;
}

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

.message.sent {
    align-self: flex-end;
}

.message.received {
    align-self: flex-start;
}

.message-content {
    padding: 0.875rem 1rem;
    border-radius: 12px;
    word-wrap: break-word;
}

.message.sent .message-content {
    background: var(--verde);
    color: var(--branco);
}

.message.received .message-content {
    background: var(--cinza-medio);
    color: var(--branco);
}

.chat-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--cinza-medio);
    border-top: 1px solid var(--cinza-claro);
}

.attach-btn,
.send-btn {
    background: transparent;
    border: none;
    color: var(--dourado);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
}

.attach-btn:hover,
.send-btn:hover {
    background: var(--cinza-claro);
}

.chat-input-area input {
    flex: 1;
    padding: 0.75rem;
    background: var(--cinza-escuro);
    border: 1px solid var(--cinza-claro);
    border-radius: 8px;
    color: var(--branco);
    font-size: 0.95rem;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--dourado);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--cinza-medio);
    border-radius: 12px;
    width: fit-content;
    margin-bottom: 1rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--cinza-claro);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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