/* Chat Widget - Universo Underdog */

/* Botao Flutuante */
.chat-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25d366;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.chat-widget-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(37, 211, 102, 0.5);
}

.chat-widget-btn svg {
    width: 32px;
    height: 32px;
    fill: white;
}

.chat-widget-btn.active {
    background: #dc2626;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.4);
}

.chat-widget-btn.active:hover {
    box-shadow: 0 6px 28px rgba(220, 38, 38, 0.5);
}

/* Modal do Chat */
.chat-modal {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #0a0a0f;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #2a2a3a;
}

.chat-modal.open {
    display: flex;
    animation: slideUp 0.3s ease-out;
}

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

/* Header do Chat */
.chat-header {
    background: #dc2626;
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.chat-header-info {
    flex: 1;
}

.chat-header-title {
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
}

.chat-header-status {
    font-size: 0.8rem;
    opacity: 0.9;
    margin: 0;
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chat-close-btn:hover {
    opacity: 1;
}

.chat-close-btn svg {
    width: 20px;
    height: 20px;
}

/* Area de Mensagens */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #0a0a0f;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: #12121a;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #2a2a3a;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #3a3a4a;
}

/* Mensagens */
.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.bot {
    background: #12121a;
    color: #e8e8f0;
    border: 1px solid #2a2a3a;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.user {
    background: #dc2626;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.error {
    background: #7f1d1d;
    color: #fca5a5;
    border: 1px solid #991b1b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* Indicador de digitacao */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #12121a;
    border: 1px solid #2a2a3a;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 80px;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: #9898a8;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.chat-typing span:nth-child(1) { animation-delay: 0s; }
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* Input Area */
.chat-input-area {
    padding: 16px;
    background: #12121a;
    border-top: 1px solid #2a2a3a;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: #0a0a0f;
    border: 1px solid #2a2a3a;
    border-radius: 24px;
    padding: 12px 18px;
    color: #e8e8f0;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #dc2626;
}

.chat-input::placeholder {
    color: #9898a8;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #dc2626;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: #b91c1c;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #2a2a3a;
    cursor: not-allowed;
    transform: none;
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Responsivo */
@media (max-width: 480px) {
    .chat-widget-btn {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .chat-modal {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chat-modal.open {
        animation: slideUpMobile 0.3s ease-out;
    }

    @keyframes slideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}
