
    getSmartStatusPill(item) {
        const today = new Date();
        const startDate = this.parseDate(item.start_date);
        const endDate = this.parseDate(item.end_date);
        const completion = item.completion_percentage || 0;
        
        if (!startDate || !endDate) {
            return "<span class=\"status-pill status-not-started\">لم يحدد</span>";
        }
        
        if (completion >= 100) {
            return "<span class=\"status-pill status-completed\">مكتمل</span>";
        }
        
        if (today < startDate) {
            return "<span class=\"status-pill status-not-started\">لم يبدأ</span>";
        }
        
        const totalDuration = endDate - startDate;
        const elapsed = today - startDate;
        const expectedProgress = Math.min(100, (elapsed / totalDuration) * 100);
        
        if (today > endDate) {
            if (completion < 100) {
                return "<span class=\"status-pill status-delayed\">متأخر</span>";
            } else {
                return "<span class=\"status-pill status-completed\">مكتمل</span>";
            }
        }
        
        const daysUntilEnd = Math.ceil((endDate - today) / (1000 * 60 * 60 * 24));
        
        if (daysUntilEnd <= 2 && completion < 70) {
            return "<span class=\"status-pill status-critical\">حرج</span>";
        }
        
        const progressGap = expectedProgress - completion;
        if (progressGap > 20 || (daysUntilEnd <= 3 && completion < 80)) {
            return "<span class=\"status-pill status-warning\">تحذير</span>";
        }
        
        if (progressGap > 30) {
            return "<span class=\"status-pill status-delayed\">متأخر</span>";
        }
        
        return "<span class=\"status-pill status-on-time\">في الموعد</span>";
    }
