/* Estilos para funcionalidades em tempo real */

/* Indicador de conexão WebSocket */
.ws-status {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.ws-status.connected {
    background: rgba(74, 124, 64, 0.9);
    color: white;
}

.ws-status.connecting {
    background: rgba(252, 163, 17, 0.9);
    color: #1a1a1a;
}

.ws-status.disconnected {
    background: rgba(220, 53, 69, 0.9);
    color: white;
}

.ws-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Status online dos amigos */
.friend-item.online::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    background: #4CAF50;
    border-radius: 50%;
    border: 2px solid #1a4a15;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
    animation: pulse-online 2s infinite;
}

@keyframes pulse-online {
    0%, 100% {
        box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
    }
}

/* Indicador "está digitando" no chat */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: #ccc;
    animation: fadeIn 0.3s ease;
}

.typing-indicator .dots {
    display: inline-flex;
    gap: 4px;
}

.typing-indicator .dots::after {
    content: '...';
    animation: typingDots 1.5s infinite;
}

@keyframes typingDots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Animação de entrada para notificações em tempo real */
.notif-item.realtime-new {
    animation: slideInFromRight 0.4s ease-out;
}

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

/* Badge pulsante para novas notificações */
.notif-badge.pulse {
    animation: pulseBadge 0.6s ease-out;
}

@keyframes pulseBadge {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
        background: #ffb74d;
    }
    100% {
        transform: scale(1);
    }
}

/* Badge de mensagens não lidas */
.unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    line-height: 14px;
    min-width: 18px;
    text-align: center;
    border: 2px solid #1a4a15;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mensagens de chat com animação */
.chat-message {
    animation: slideInMessage 0.3s ease-out;
}

.chat-message.sent .message-bubble {
    background: linear-gradient(135deg, #4a7c40 0%, #3a6a30 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(74, 124, 64, 0.3);
}

.chat-message.received .message-bubble {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

/* Notificação toast para eventos em tempo real */
.realtime-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: linear-gradient(135deg, #1a4a15 0%, #2a5a22 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: slideInFromTop 0.4s ease-out;
    max-width: 400px;
}

.realtime-toast.success {
    background: linear-gradient(135deg, #4a7c40 0%, #3a6a30 100%);
}

.realtime-toast.error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.realtime-toast.info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

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

.realtime-toast.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

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

.realtime-toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.realtime-toast-content {
    flex: 1;
}

.realtime-toast-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.realtime-toast-message {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Indicador de reconexão */
.reconnecting-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.reconnecting-card {
    background: linear-gradient(135deg, #1f1f1f 0%, #2f2f2f 100%);
    color: white;
    padding: 32px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 2px solid #4a7c40;
    max-width: 400px;
}

.reconnecting-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(252, 163, 17, 0.2);
    border-top-color: #fca311;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.reconnecting-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fca311;
}

.reconnecting-message {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Responsividade */
@media (max-width: 768px) {
    .ws-status {
        bottom: 70px;
        left: 10px;
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    .realtime-toast {
        top: 60px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .reconnecting-card {
        margin: 20px;
        padding: 24px;
    }
}
