/**
 * Ninja Rank Widget CRM - Estilos
 *
 * @package NinjaRank
 * @since 1.0.0
 */

/* ============================================
   BOLINHA FLUTUANTE (BUBBLE)
   ============================================ */

.ninja-widget-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99998;
    display: flex;
    flex-direction: row-reverse; /* Foto à direita, mensagem à esquerda */
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ninja-widget-bubble:hover {
    transform: scale(1.05);
}

.ninja-widget-bubble-photo {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: visible; /* Mudado de hidden para visible para a bolinha aparecer */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ninja-widget-bubble-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%; /* Adicionar border-radius na img ao invés do container */
    border: 3px solid #fff; /* Mover a borda para a imagem */
}

.ninja-widget-bubble-online {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #10b981;
    border: 2px solid #fff;
    border-radius: 50%;
    animation: pulse-online 1.5s ease-in-out infinite;
    z-index: 10; /* Garantir que fique acima da foto */
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
}

@keyframes pulse-online {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.ninja-widget-bubble-message {
    background: #fff;
    padding: 12px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 250px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.ninja-widget-bubble-message::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid #fff;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

/* ============================================
   JANELA DE CHAT
   ============================================ */

.ninja-widget-chat {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    z-index: 99999;
    overflow: hidden;
}

.ninja-widget-chat.open {
    display: flex;
}

/* Header */
.ninja-widget-header {
    padding: 20px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ninja-widget-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ninja-widget-header-photo {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
}

.ninja-widget-header-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.ninja-widget-header-status {
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ninja-widget-status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
}

.ninja-widget-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.ninja-widget-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Body */
.ninja-widget-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
}

.ninja-widget-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Mensagens */
.ninja-widget-message {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.ninja-widget-message-bot {
    flex-direction: row;
}

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

.ninja-widget-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.ninja-widget-message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.ninja-widget-message-bot .ninja-widget-message-bubble {
    background: #fff;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

.ninja-widget-message-user .ninja-widget-message-bubble {
    background: #3b82f6;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Indicador de digitação */
.ninja-widget-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ninja-widget-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 8px 12px;
}

.ninja-widget-typing span {
    width: 8px;
    height: 8px;
    background-color: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    animation: ninja-widget-typing-bounce 1.4s infinite ease-in-out both;
}

.ninja-widget-typing span:nth-child(1) {
    animation-delay: -0.32s;
}

.ninja-widget-typing span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes ninja-widget-typing-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.ninja-widget-typing-text {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}

/* Footer */
.ninja-widget-footer {
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
}

.ninja-widget-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.ninja-widget-input:focus {
    border-color: #3b82f6;
}

.ninja-widget-send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.ninja-widget-send-btn:hover {
    opacity: 0.9;
}

.ninja-widget-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Botões de ação */
.ninja-widget-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0;
    padding: 0 40px;
}

.ninja-widget-country-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ninja-widget-country-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ninja-widget-whatsapp-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ninja-widget-whatsapp-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.ninja-widget-whatsapp-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Animação de entrada */
@keyframes ninja-widget-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ninja-widget-chat.open {
    animation: ninja-widget-slide-in 0.3s ease-out;
}

/* Responsivo */
@media (max-width: 480px) {
    .ninja-widget-bubble {
        bottom: 15px;
        right: 15px;
    }

    .ninja-widget-bubble-message {
        max-width: 200px;
        font-size: 13px;
    }

    .ninja-widget-chat {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}
